From cb2eca4fed1eb3692eaa13715f65ebcaf8472b64 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Thu, 25 Sep 2025 14:14:22 -0400 Subject: Client can be run from zipped apworld now --- apworld/client/source_runtime.gd | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'apworld/client/source_runtime.gd') diff --git a/apworld/client/source_runtime.gd b/apworld/client/source_runtime.gd index fbb7009..35428ea 100644 --- a/apworld/client/source_runtime.gd +++ b/apworld/client/source_runtime.gd @@ -7,9 +7,23 @@ func _init(path): source_path = path -func load_path(path): +func load_script(path): return ResourceLoader.load("%s/%s" % [source_path, path]) func read_path(path): return FileAccess.get_file_as_bytes("%s/%s" % [source_path, path]) + + +func load_script_as_scene(path, scene_name): + var script = load_script(path) + var instance = script.new() + instance.name = scene_name + + get_tree().unload_current_scene() + _load_scene.call_deferred(instance) + + +func _load_scene(instance): + get_tree().get_root().add_child(instance) + get_tree().current_scene = instance -- cgit 1.4.1