X Tutup
Skip to content

Commit d0ed7d4

Browse files
committed
Fix for inventory item use
Cherry-pick code updated from a fix in `carenalgas:popochiu:develop` to make using inventory items to work again. - Update project icon. - Update introductory dialog to English. - Update navigation agent radius to 0 in walkable areas.
1 parent b19c56f commit d0ed7d4

File tree

6 files changed

+24
-13
lines changed

6 files changed

+24
-13
lines changed

addons/popochiu/engine/objects/inventory_item/popochiu_inventory_item.gd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,12 @@ func _on_gui_input(event: InputEvent) -> void:
343343
if not PopochiuUtils.is_click_or_touch_pressed(event): return
344344

345345
var event_index := PopochiuUtils.get_click_or_touch_index(event)
346+
347+
# Fix #224 Clean E.clicked when an inventory item is clicked to ensure that the event is not
348+
# mishandled by the GUI
349+
if E.clicked:
350+
E.clicked = null
351+
346352
I.clicked = self
347353
last_click_button = event_index
348354

addons/popochiu/engine/objects/room/popochiu_room.gd

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,16 @@ func _physics_process(delta):
114114

115115

116116
func _unhandled_input(event: InputEvent):
117-
if not has_player: return
117+
if (
118+
not PopochiuUtils.get_click_or_touch_index(event) in [
119+
MOUSE_BUTTON_LEFT, MOUSE_BUTTON_RIGHT
120+
]
121+
or (not event is InputEventScreenTouch and E.hovered)
122+
):
123+
return
118124

125+
# Fix #224 Item should be removed only if the click was done anywhere in the room when the
126+
# cursor is not hovering another object
119127
if I.active:
120128
if event.is_action_released("popochiu-look")\
121129
or event.is_action_pressed("popochiu-interact"):
@@ -125,13 +133,7 @@ func _unhandled_input(event: InputEvent):
125133
I.set_active_item()
126134
return
127135

128-
if PopochiuUtils.get_click_or_touch_index(event) != MOUSE_BUTTON_LEFT:
129-
return
130-
131-
if not event is InputEventScreenTouch and E.hovered:
132-
return
133-
134-
if is_instance_valid(C.player) and C.player.can_move:
136+
if has_player and is_instance_valid(C.player) and C.player.can_move:
135137
# Set this property to null in order to cancel any running interaction with a
136138
# PopochiuClickable (check PopochiuCharacter.walk_to_clicked(...))
137139
E.clicked = null

game/rooms/house/room_house.gd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ func _on_room_entered() -> void:
2121
# is visible.
2222
func _on_room_transition_finished() -> void:
2323
if state.visited_first_time:
24-
await C.Goddiu.say("[wave]¡¡Holaaaa!![/wave]")
25-
await C.Popsy.say("[rainbow]Holaaaaaaaaaa[/rainbow]")
24+
await C.Goddiu.say("[wave]¡¡Hiiiii!![/wave]")
25+
await C.Popsy.say("[rainbow]Hiiiiiiiiiiiiiiiii[/rainbow]")
2626

2727

2828
# What happens before Popochiu unloads the room.

game/rooms/house/room_house.tscn

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@
1515
[ext_resource type="PackedScene" uid="uid://bil27y44847wc" path="res://game/characters/popsy/character_popsy.tscn" id="12_yd7us"]
1616

1717
[sub_resource type="NavigationPolygon" id="NavigationPolygon_kuj1q"]
18-
vertices = PackedVector2Array(125, 28, 49, 40, -16, 40, -135, 31, -122, 0, 80, -7)
18+
vertices = PackedVector2Array(149, 35, 51, 50, -17, 50, -150, 40, -129, -10, 84, -18)
1919
polygons = Array[PackedInt32Array]([PackedInt32Array(0, 1, 2, 3, 4, 5)])
2020
outlines = Array[PackedVector2Array]([PackedVector2Array(-129, -10, 84, -18, 149, 35, 51, 50, -17, 50, -150, 40)])
2121
source_geometry_group_name = &"navigation_polygon_source_group"
22+
agent_radius = 0.0
2223

2324
[node name="RoomHouse" type="Node2D"]
2425
script = ExtResource("1_qtcms")
@@ -70,6 +71,7 @@ polygon = PackedVector2Array(-11, 21, -11, -14, 8, -29, 28, -17, 30, 23)
7071
[node name="ToyCar" parent="Props" instance=ExtResource("10_hcj88")]
7172
position = Vector2(81, 110)
7273
texture = ExtResource("11_54r3c")
74+
walk_to_point = Vector2(21, -5)
7375
interaction_polygon = PackedVector2Array(-7, -7, 7, -6, 11, 6, -10, 6)
7476

7577
[node name="Hotspots" type="Node2D" parent="."]

game/rooms/outside/room_outside.tscn

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@
1212
[ext_resource type="Script" path="res://game/rooms/outside/hotspots/door/hotspot_door.gd" id="11_10688"]
1313

1414
[sub_resource type="NavigationPolygon" id="NavigationPolygon_ow5ee"]
15-
vertices = PackedVector2Array(36, 7, 202, 62, 200, 70, -19, 22, -38, 9, -33, 47, -202, 69, -74, 51, -107, 36, -197, 27, -122, 6, -79, 7)
16-
polygons = Array[PackedInt32Array]([PackedInt32Array(0, 1, 2, 3, 4), PackedInt32Array(5, 3, 2), PackedInt32Array(5, 2, 6, 7), PackedInt32Array(8, 7, 6, 9), PackedInt32Array(8, 9, 10, 11), PackedInt32Array(11, 10, 0), PackedInt32Array(4, 11, 0)])
15+
vertices = PackedVector2Array(36, -3, 214, 56, 209, 81, -32, 25, -41, 19, -39, 38, -214, 79, -72, 41, -90, 33, -207, 19, -125, -4, -75, 17)
16+
polygons = Array[PackedInt32Array]([PackedInt32Array(0, 1, 2, 3, 4), PackedInt32Array(5, 3, 2), PackedInt32Array(5, 2, 6, 7), PackedInt32Array(8, 7, 6, 9), PackedInt32Array(8, 9, 10, 11), PackedInt32Array(11, 10, 0, 4)])
1717
outlines = Array[PackedVector2Array]([PackedVector2Array(-207, 19, -125, -4, 36, -3, 214, 56, 209, 81, -214, 79), PackedVector2Array(-41, 19, -75, 17, -90, 33, -72, 41, -39, 38, -32, 25)])
1818
source_geometry_group_name = &"navigation_polygon_source_group"
19+
agent_radius = 0.0
1920

2021
[node name="RoomOutside" type="Node2D"]
2122
script = ExtResource("1_1vr1w")

icon_v2-sample_project.png

286 Bytes
Loading

0 commit comments

Comments
 (0)
X Tutup