123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- extends Spatial
- export var collected_items = []
- export var flowerspot_status = []
- func _ready():
- # Called when the node is added to the scene for the first time.
- # Initialization here
- pass
- func save_world_data(lv_name):
- collected_items.clear()
- flowerspot_status.clear()
- #print ("WorldSaveData.gd::save_world_data called - " + lv_name)
-
- var spawners = get_tree().get_nodes_in_group("group_spawner")
- for s in spawners:
- if (s.spawned_object != null):
- var wr = weakref(s.spawned_object)
- if (!wr.get_ref() or str(s.spawned_object) == "[Deleted Object]"):
- print (str(s.spawned_object) + str(" collected"))
- collected_items.push_back(s.name)
-
- else:
- print (str(s.spawned_object) + str(" OK"))
-
- if (wr.get_ref() and str(s.spawned_object) == "[Deleted Object]"):
- print ("ERROR: !wr.get_ref() got wrong result")
- else:
- collected_items.push_back(s.name)
- var spots = get_tree().get_nodes_in_group("group_flowerspot")
- for s in spots:
- var flowerspot = []
- flowerspot.push_back(s.name)
- flowerspot.push_back(s.status)
- flowerspot_status.push_back(flowerspot)
-
- get_node("/root/Save").save_node_data_by_name(self, lv_name + str(self.name))
- func save():
- var save_dict = {
- collected_items = collected_items,
- flowerspot_status = flowerspot_status
- }
- return save_dict
|