From a47d4c204028e5b7c208532e88583c08b4814a47 Mon Sep 17 00:00:00 2001 From: Nitwel Date: Sun, 28 Jan 2024 17:37:26 +0100 Subject: [PATCH] fix bug saving multiple entities --- content/system/house/house.gd | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/content/system/house/house.gd b/content/system/house/house.gd index b6e4df0..c1fd636 100644 --- a/content/system/house/house.gd +++ b/content/system/house/house.gd @@ -37,7 +37,11 @@ func update_house(): var new_room = Store.house.rooms[index] create_room(new_room.name, 0) - for entity in Store.house.entities: + print(Store.house.entities) + + for entity_index in range(Store.house.entities.size()): + var entity = Store.house.entities[entity_index] + var entity_instance = create_entity_in(entity.id, entity.room) if entity_instance == null: @@ -174,8 +178,6 @@ func create_entity_in(entity_id: String, room_name: String): room.get_node("Entities").add_child(entity) entity.global_position = room.get_aabb().position + room.get_aabb().size / 2.0 - save_all_entities() - return entity func update_mini_view():