Merge pull request #2 from vstrucovski/main

fix save/load
pull/6/head
Kenney 2023-09-27 15:11:36 +07:00 committed by GitHub
commit 60c893fd25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

@ -128,6 +128,7 @@ func action_save():
if Input.is_action_just_pressed("save"):
print("Saving map...")
map.structures.clear()
for cell in gridmap.get_used_cells():
var data_structure:DataStructure = DataStructure.new()
@ -147,7 +148,8 @@ func action_load():
gridmap.clear()
map = ResourceLoader.load("user://map.res")
if not map:
map = DataMap.new()
for cell in map.structures:
gridmap.set_cell_item(Vector3i(cell.position.x, 0, cell.position.y), cell.structure, cell.orientation)