about summary refs log tree commit diff stats
path: root/apworld/client/source_runtime.gd
blob: 146587afa5b72a955d2cf10decae1f9ac448e9d6 (plain) (blame)
1
2
3
4
5
6
7
8
9
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888
extends Node

var source_path


func _init(path):
	source_path = path


func path_exists(path):
	return FileAccess.file_exists("%s/%s" % [source_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