Skip to content

Commit

Permalink
Hotfix for Door Issues
Browse files Browse the repository at this point in the history
Cogito Door:
- Fixes issues with properly loading door position if it was not a sliding door.
  • Loading branch information
Phazorknight committed Apr 30, 2024
1 parent 45e67fd commit 2ee8503
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 101 deletions.
28 changes: 23 additions & 5 deletions COGITO/CogitoObjects/Cogito_Door.gd
Original file line number Diff line number Diff line change
Expand Up @@ -231,21 +231,39 @@ func close_door(_interactor: Node3D):
func set_state():
if is_open:
if auto_close_time > 0:
is_open = false
position = closed_position
set_to_closed_position()
interaction_text = interaction_text_when_closed
else:
position = open_position
set_to_open_position()
interaction_text = interaction_text_when_open
else:
if is_sliding:
position = closed_position
set_to_closed_position()
interaction_text = interaction_text_when_closed
if is_locked:
interaction_text = interaction_text_when_locked
object_state_updated.emit(interaction_text)


func set_to_open_position():
if is_sliding:
position = open_position
else:
if use_z_axis:
rotation.z = deg_to_rad(open_rotation_deg)
else:
rotation.y = deg_to_rad(open_rotation_deg)


func set_to_closed_position():
if is_sliding:
position = closed_position
else:
if use_z_axis:
rotation.z = deg_to_rad(closed_rotation_deg)
else:
rotation.y = deg_to_rad(closed_rotation_deg)


func save():
var state_dict = {
"node_path" : self.get_path(),
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_6ni2c"]
[sub_resource type="Resource" id="Resource_rrh0b"]
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_u4vu3"]
[sub_resource type="Resource" id="Resource_dg2yg"]
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_6ni2c")
inventory_data = SubResource("Resource_rrh0b")
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_u4vu3")
inventory_data = SubResource("Resource_dg2yg")
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 @@ -124,7 +124,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_8g6xp"]
[sub_resource type="Resource" id="Resource_aw2x7"]
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 @@ -3291,7 +3291,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_8g6xp")
inventory_data = SubResource("Resource_aw2x7")
step_height_camera_lerp = 1.5

[node name="Player_HUD" parent="." node_paths=PackedStringArray("player") instance=ExtResource("5_to5tg")]
Expand Down
Loading

0 comments on commit 2ee8503

Please sign in to comment.