fix save system
This commit is contained in:
parent
01eabd22b3
commit
f368961bf1
|
@ -5,9 +5,6 @@ extends StaticBody3D
|
|||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
if HomeApi.has_connected() == false:
|
||||
await HomeApi.on_connect
|
||||
|
||||
var stateInfo = await HomeApi.get_state(entity_id)
|
||||
set_text(stateInfo)
|
||||
|
||||
|
|
|
@ -85,10 +85,13 @@ func _generate_save_tree(node: Node):
|
|||
func _build_save_tree(tree: Dictionary):
|
||||
var new_object = load(tree["filename"]).instantiate()
|
||||
|
||||
get_node(tree["parent"]).add_child(new_object)
|
||||
|
||||
if new_object.has_method("_load"):
|
||||
new_object.call("_load", VariantSerializer.parse_value(tree["data"]))
|
||||
else:
|
||||
for key in tree["data"].keys():
|
||||
new_object.set(key, VariantSerializer.parse_value(tree["data"][key]))
|
||||
|
||||
get_node(tree["parent"]).add_child(new_object)
|
||||
|
||||
for child in tree["children"]:
|
||||
_build_save_tree(child)
|
||||
|
|
Loading…
Reference in New Issue
Block a user