Skip to content

Commit

Permalink
Fixed: Automatic door close now set their state to closed when return…
Browse files Browse the repository at this point in the history
…ing to scene.
  • Loading branch information
Phazorknight committed Apr 9, 2024
1 parent 893164a commit 76da194
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 100 deletions.
8 changes: 6 additions & 2 deletions COGITO/CogitoObjects/Cogito_Door.gd
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,13 @@ func close_door(_interactor: Node3D):

func set_state():
if is_open:
if is_sliding:
if auto_close_time > 0:
is_open = false
position = closed_position
interaction_text = interaction_text_when_closed
else:
position = open_position
interaction_text = interaction_text_when_open
interaction_text = interaction_text_when_open
else:
if is_sliding:
position = closed_position
Expand Down
8 changes: 4 additions & 4 deletions COGITO/DemoScenes/COGITO_01_Demo.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ script = ExtResource("16_fg1wi")
inventory_item = ExtResource("17_nl6sa")
quantity = 2

[sub_resource type="Resource" id="Resource_n26k3"]
[sub_resource type="Resource" id="Resource_k3oka"]
resource_local_to_scene = true
script = ExtResource("2_chxar")
inventory_slots = Array[ExtResource("16_fg1wi")]([SubResource("Resource_v7b11"), SubResource("Resource_eku8j"), null, null])
Expand Down Expand Up @@ -348,7 +348,7 @@ size = Vector3(1.5, 0.01, 1.5)
[sub_resource type="BoxShape3D" id="BoxShape3D_ht4uj"]
size = Vector3(100, 3, 100)

[sub_resource type="Resource" id="Resource_nqqkb"]
[sub_resource type="Resource" id="Resource_7op24"]
resource_local_to_scene = true
script = ExtResource("2_chxar")
inventory_slots = Array[ExtResource("16_fg1wi")]([null, null, null, null, null, null, null, null])
Expand Down Expand Up @@ -1253,7 +1253,7 @@ transform = Transform3D(1, 0, 0, 0, 0.707107, 0.707107, 0, -0.707107, 0.707107,
[node name="Chest" parent="INTERACTIVE_OBJECTS" groups=["external_inventory"] instance=ExtResource("14_d7sxi")]
transform = Transform3D(0.686504, 0, -0.727126, 0, 1, 0, 0.727126, 0, 0.686504, -4.38933, 0.0425703, 5.97176)
inventory_name = "Chest"
inventory_data = SubResource("Resource_n26k3")
inventory_data = SubResource("Resource_k3oka")
uses_animation = true
open_animation = "open"

Expand Down Expand Up @@ -1613,7 +1613,7 @@ transform = Transform3D(-1, 0, 8.74228e-08, 0, 1, 0, -8.74228e-08, 0, -1, 2.1480
transform = Transform3D(-1, 0, 7.45058e-07, 0, 1, 0, -7.45058e-07, 0, -1, -7.5375, 0.905039, -3.30884)
pause_menu = NodePath("../TabMenu")
player_hud = NodePath("../Player_HUD")
inventory_data = SubResource("Resource_nqqkb")
inventory_data = SubResource("Resource_7op24")
step_height_camera_lerp = 1.5

[node name="Player_HUD" parent="." node_paths=PackedStringArray("player") instance=ExtResource("4_1ofwa")]
Expand Down
4 changes: 2 additions & 2 deletions COGITO/DemoScenes/COGITO_04_Demo_Lobby.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ volumetric_fog_temporal_reprojection_amount = 0.85
density = 0.04
albedo = Color(0.694118, 0.694118, 0.694118, 1)

[sub_resource type="Resource" id="Resource_0qwjs"]
[sub_resource type="Resource" id="Resource_5e8so"]
resource_local_to_scene = true
script = ExtResource("4_0kggm")
inventory_slots = Array[Resource("res://COGITO/InventoryPD/CustomResources/InventorySlotPD.gd")]([null, null, null, null, null, null, null, null])
Expand Down Expand Up @@ -3290,7 +3290,7 @@ material = SubResource("FogMaterial_4avjx")
transform = Transform3D(-1, 0, 7.45058e-07, 0, 1, 0, -7.45058e-07, 0, -1, 3.03073, 0.905039, -17.9321)
pause_menu = NodePath("../PauseMenu")
player_hud = NodePath("../Player_HUD")
inventory_data = SubResource("Resource_0qwjs")
inventory_data = SubResource("Resource_5e8so")
step_height_camera_lerp = 1.5

[node name="Player_HUD" parent="." node_paths=PackedStringArray("player") instance=ExtResource("5_to5tg")]
Expand Down
3 changes: 2 additions & 1 deletion COGITO/InventoryPD/UiScenes/InventoryUI.gd
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ func _ready():


func set_inventory_data(inventory_data : InventoryPD):
inventory_data.inventory_updated.connect(populate_item_grid)
if !inventory_data.inventory_updated.is_connected(populate_item_grid):
inventory_data.inventory_updated.connect(populate_item_grid)
label.text = inventory_name
populate_item_grid(inventory_data)

Expand Down
3 changes: 2 additions & 1 deletion COGITO/InventoryPD/UiScenes/hot_bar_inventory.gd
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ func set_inventory_data(inventory_data : InventoryPD) -> void:
if !inventory_data.inventory_updated.is_connected(populate_hotbar):
inventory_data.inventory_updated.connect(populate_hotbar)
populate_hotbar(inventory_data)
hot_bar_use.connect(inventory_data.use_slot_data)
if !hot_bar_use.is_connected(inventory_data.use_slot_data):
hot_bar_use.connect(inventory_data.use_slot_data)

func populate_hotbar(inventory_data : InventoryPD) -> void:
for child in h_box_container.get_children():
Expand Down
Loading

0 comments on commit 76da194

Please sign in to comment.