From 43ad4ecbab20dfb6491314af8d1294765d359653 Mon Sep 17 00:00:00 2001 From: Nitwel Date: Thu, 25 Jan 2024 12:36:33 +0100 Subject: [PATCH] more small fixes --- content/system/house/room/states/edit.gd | 4 ++++ content/system/house/room/states/view.gd | 15 ++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/content/system/house/room/states/edit.gd b/content/system/house/room/states/edit.gd index 2226b46..05dd188 100644 --- a/content/system/house/room/states/edit.gd +++ b/content/system/house/room/states/edit.gd @@ -20,6 +20,7 @@ func _on_enter(): height_edge.visible = true room.room_ceiling.get_node("CollisionShape3D").disabled = (floor_corner == null && height_corner == null) + room.room_floor.get_node("CollisionShape3D").disabled = false var ceiling_shape = WorldBoundaryShape3D.new() ceiling_shape.plane = Plane(Vector3.DOWN, 0) @@ -39,6 +40,9 @@ func _on_leave(): height_corner.visible = false height_edge.visible = false + room.room_ceiling.get_node("CollisionShape3D").disabled = true + room.room_floor.get_node("CollisionShape3D").disabled = true + room.room_ceiling.get_node("Clickable").on_click.disconnect(_on_click_ceiling) room.room_floor.get_node("Clickable").on_click.disconnect(_on_click_floor) diff --git a/content/system/house/room/states/view.gd b/content/system/house/room/states/view.gd index fc2db20..06e4715 100644 --- a/content/system/house/room/states/view.gd +++ b/content/system/house/room/states/view.gd @@ -20,10 +20,16 @@ func _on_enter(): if room.wall_mesh.mesh == null: return + var ceiling_shape = room.room_ceiling.get_node("CollisionShape3D") + var floor_shape = room.room_floor.get_node("CollisionShape3D") + + ceiling_shape.disabled = false + floor_shape.disabled = false + room.ceiling_mesh.mesh = generate_ceiling_mesh() - room.room_ceiling.get_node("CollisionShape3D").shape = room.ceiling_mesh.mesh.create_trimesh_shape() - room.room_floor.get_node("CollisionShape3D").shape = room.ceiling_mesh.mesh.create_trimesh_shape() - room.room_ceiling.get_node("CollisionShape3D").shape.backface_collision = true + ceiling_shape.shape = room.ceiling_mesh.mesh.create_trimesh_shape() + floor_shape.shape = room.ceiling_mesh.mesh.create_trimesh_shape() + ceiling_shape.shape.backface_collision = true var collisions = generate_collision() @@ -41,6 +47,9 @@ func _on_leave(): room.wall_mesh.visible = false room.ceiling_mesh.visible = false + room.room_ceiling.get_node("CollisionShape3D").disabled = true + room.room_floor.get_node("CollisionShape3D").disabled = true + for collision in room.wall_collisions.get_children(): collision.queue_free()