diff --git a/addons/Rakugo/main.gd b/addons/Rakugo/main.gd index 1de30f26..820ed5e4 100644 --- a/addons/Rakugo/main.gd +++ b/addons/Rakugo/main.gd @@ -475,12 +475,12 @@ func get_value(var_name:String): return null func get_node_value(var_name:String) -> Dictionary: - var s = NodeLink.new("").var_prefix - return get_value(s + var_name) + var p = NodeLink.new("").var_prefix + return get_value(p + var_name) func get_avatar_value(var_name:String) -> Dictionary: - var s = Avatar.new("").var_prefix - return get_value(s + var_name) + var p = Avatar.new("").var_prefix + return get_value(p + var_name) ## returns type of variable defined using define func get_type(var_name:String) -> int: @@ -736,13 +736,13 @@ func _get_history_id() -> int: ## id_of_current_scene is id to scene defined in scenes_links or full path to scene func jump( id_of_scene:String, node_name:String, - dialog_name:String, state := 0 + dialog_name:String, state := 0, force_reload := false ) -> void: $Jump.invoke( id_of_scene, node_name, dialog_name, - state + state, force_reload ) ## use this to assign beginning scene and dialog diff --git a/addons/Rakugo/nodes/rakugo_anim_player.gd b/addons/Rakugo/nodes/rakugo_anim_player.gd index 44998c8b..fd975502 100644 --- a/addons/Rakugo/nodes/rakugo_anim_player.gd +++ b/addons/Rakugo/nodes/rakugo_anim_player.gd @@ -13,7 +13,7 @@ func _ready() -> void: add_to_group("save", true) return - + Rakugo.connect("play_anim", self, "_on_play") Rakugo.connect("stop_anim", self, "_on_stop") @@ -47,13 +47,18 @@ func _on_stop(id : String, reset : bool) -> void: seek(0, true) func on_save(): - node_link = Rakugo.get_node_link(node_id) + if not node_link: + prints("error with saveing:" , node_id) + return + node_link.value["anim_name"] = current_animation node_link.value["is_playing"] = is_playing() func on_load(game_version:String) -> void: - node_link = Rakugo.get_node_link(node_id) - + if not node_link: + prints("error with loading:" , node_id) + return + if "is_playing" in node_link.value: if node_link.value["is_playing"]: if "anim_name" in node_link.value: diff --git a/addons/Rakugo/nodes/rakugo_audio_player.gd b/addons/Rakugo/nodes/rakugo_audio_player.gd index f4b2c87f..8285f140 100644 --- a/addons/Rakugo/nodes/rakugo_audio_player.gd +++ b/addons/Rakugo/nodes/rakugo_audio_player.gd @@ -45,13 +45,18 @@ func _on_stop(id : String) -> void: stop() func on_save(): - node_link = Rakugo.get_node_link(node_id) + if not node_link: + prints("error with saveing:" , node_id) + return + node_link.value["is_playing"] = is_playing() node_link.value["from_pos"] = last_pos func on_load(game_version:String) -> void: - node_link = Rakugo.get_node_link(node_id) - + if not node_link: + prints("error with loading:" , node_id) + return + if "is_playing" in node_link: if node_link.value["is_playing"]: var last_pos = node_link.value["from_pos"] diff --git a/addons/Rakugo/nodes/rakugo_avatar.gd b/addons/Rakugo/nodes/rakugo_avatar.gd index fc9ae67f..43d942af 100644 --- a/addons/Rakugo/nodes/rakugo_avatar.gd +++ b/addons/Rakugo/nodes/rakugo_avatar.gd @@ -68,11 +68,9 @@ func _exit_tree() -> void: Rakugo.variables.erase(id) func on_save() -> void: - avatar_link = Rakugo.get_avatar_link(avatar_id) avatar_link.value["state"] = _state func on_load(game_version:String) -> void: - avatar_link = Rakugo.get_avatar_link(avatar_id) _state = avatar_link.value["state"] _on_show(avatar_id, _state , {}) diff --git a/addons/Rakugo/nodes/rakugo_control.gd b/addons/Rakugo/nodes/rakugo_control.gd index fa7cab5d..b5aa94c7 100644 --- a/addons/Rakugo/nodes/rakugo_control.gd +++ b/addons/Rakugo/nodes/rakugo_control.gd @@ -110,7 +110,10 @@ func on_save() -> void: remove_from_group("save") return - node_link = Rakugo.get_node_link(node_id) + if not node_link: + prints("error with saveing:" , node_id) + return + node_link.value["visible"] = visible node_link.value["state"] = _state node_link.value["show_args"] = last_show_args @@ -119,7 +122,10 @@ func on_load(game_version:String) -> void: if not _register: return - node_link = Rakugo.get_node_link(node_id) + if not node_link: + prints("error with loading:" , node_id) + return + visible = node_link.value["visible"] if visible: diff --git a/addons/Rakugo/nodes/rakugo_node2d.gd b/addons/Rakugo/nodes/rakugo_node2d.gd index 5f3bd762..671c553d 100644 --- a/addons/Rakugo/nodes/rakugo_node2d.gd +++ b/addons/Rakugo/nodes/rakugo_node2d.gd @@ -37,7 +37,7 @@ func _ready() -> void: node_link = Rakugo.node_link(node_id, get_path()) else: - node_link.node_path = get_path() + node_link.value.node_path = get_path() add_to_group("save", true) @@ -99,13 +99,18 @@ func _exit_tree() -> void: Rakugo.variables.erase(id) func on_save() -> void: - node_link = Rakugo.get_node_link(node_id) + if not node_link: + prints("error with saveing:" , node_id) + return + node_link.value["visible"] = visible node_link.value["state"] = _state node_link.value["show_args"] = last_show_args func on_load(game_version:String) -> void: - node_link = Rakugo.get_node_link(node_id) + if not node_link: + prints("error with loading:" , node_id) + return if "visible" in node_link.value: visible = node_link.value["visible"] diff --git a/addons/Rakugo/nodes/rakugo_spatial.gd b/addons/Rakugo/nodes/rakugo_spatial.gd index 802f5a24..70e0aa4c 100644 --- a/addons/Rakugo/nodes/rakugo_spatial.gd +++ b/addons/Rakugo/nodes/rakugo_spatial.gd @@ -100,12 +100,19 @@ func _exit_tree() -> void: Rakugo.variables.erase(id) func on_save() -> void: + if not node_link: + prints("error with saveing:" , node_id) + return + node_link.value["visible"] = visible node_link.value["state"] = _state node_link.value["show_args"] = last_show_args func on_load(game_version:String) -> void: - node_link = Rakugo.get_node_link(node_id) + if not node_link: + prints("error with loading:" , node_id) + return + visible = node_link.value["visible"] if visible: