fix delete button

This commit is contained in:
Nitwel 2024-05-24 11:02:50 +02:00
parent 5520ea4298
commit ef9f82682e
3 changed files with 5 additions and 8 deletions

View File

@ -53,6 +53,7 @@ unique_name_in_owner = true
transform = Transform3D(0.999999, -1.39635e-11, 0, 1.31553e-10, 1, 0, 0, 0, 1, 0.336726, 0.575093, -0.437942) transform = Transform3D(0.999999, -1.39635e-11, 0, 1.31553e-10, 1, 0, 0, 0, 1, 0.336726, 0.575093, -0.437942)
[node name="XRSimulator" parent="." instance=ExtResource("5_3qc8g")] [node name="XRSimulator" parent="." instance=ExtResource("5_3qc8g")]
disable_xr_in_editor = false
min_camera_height = 0.01 min_camera_height = 0.01
xr_origin = NodePath("../XROrigin3D") xr_origin = NodePath("../XROrigin3D")

View File

@ -103,14 +103,10 @@ func delete_room(room_name):
if editing_room == room: if editing_room == room:
editing_room = null editing_room = null
room.get_parent().remove_child(room) rooms.remove_child(room)
room.queue_free() room.queue_free()
await room.tree_exited
var store_room = Store.house.get_room(room_name) Store.house.state.rooms = Store.house.state.rooms.filter(func(r): return r.name != room_name)
if store_room != null:
Store.house.state.rooms.erase(store_room)
Store.house.save_local() Store.house.save_local()

View File

@ -42,8 +42,8 @@ func _ready():
sync_room_button.visible=editing_room.value sync_room_button.visible=editing_room.value
sync_room_label.visible=editing_room.value sync_room_label.visible=editing_room.value
sync_room_button.disabled=!editing_room.value sync_room_button.disabled=!editing_room.value
delete_button.visible=editing_room.value delete_button.visible=rooms_map.selected_room.value != null
delete_button.disabled=!editing_room.value delete_button.disabled=rooms_map.selected_room.value == null
) )
if !Store.house.is_loaded(): await Store.house.on_loaded if !Store.house.is_loaded(): await Store.house.on_loaded