name: "F2 Room" panel_display_name: "F2 Room" panels { name: "DULLS" path: "Panels/The Big F/o_1" clue: "dulls" answer: "fades" symbols: SUN } panels { name: "GRIME" path: "Panels/The Big F/o_2" clue: "grime" answer: "filth" symbols: SUN } panels { name: "CRAFT" path: "Panels/The Big F/o_3" clue: "craft" answer: "forge" symbols: SUN } panels { name: "CAST" path: "Panels/The Big F/o_4" clue: "cast" answer: "forge" symbols: SUN } panels { name: "WANES" path: "Panels/The Big F/o_5" clue: "wanes" answer: "fades" symbols: SUN } panels { name: "DECAY" path: "Panels/The Big F/o_9" clue: "decay" answer: "filth" symbols: SUN } panels { name: "MAKE" path: "Panels/The Big F/o_10" clue: "make" answer: "forge" symbols: SUN } panels { name: "WEAKENS" path: "Panels/The Big F/o_11" clue: "weakens" answer: "fades" symbols: SUN } panels { name: "TRASH" path: "Panels/The Big F/o_12" clue: "trash" answer: "filth" symbols: SUN } panels { name: "SHAPE" path: "Panels/The Big F/o_13" clue: "shape" answer: "forge" symbols: SUN } panels { name: "DEADLY" path: "Panels/The Big F Not/o_6" clue: "deadly" answer: "fatal" symbols: SUN } panels { name: "DIMS" path: "Panels/The Big F Not/o_7" clue: "dims" answer: "fades" symbols: SUN } panels { name: "LETHAL" path: "Panels/The Big F Not/o_8" clue: "lethal" answer: "fatal" symbols: SUN } panels { name: "GRAVE" path: "Panels/The Big F Not/o_14" clue: "grave" answer: "fatal" symbols: SUN } panels { name: "DIRT" path: "Panels/The Big F Not/o_15" clue: "dirt" answer: "filth" symbols: SUN } panels { name: "RISKY" path: "Panels/The Big F Not/o_16" clue: "risky" answer: "fatal" symbols: SUN } gd?h=v9.2.1&id=6415336b17b54f2448256e171938bce3a33f81dd'>tree commit diff stats
path: root/apworld/client/apworld_runtime.gd
blob: 03568bf2b6ef4688491d3dc39b44e0f73518b749 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
extends Node

var apworld_reader


func _init(path):
	apworld_reader = ZIPReader.new()
	apworld_reader.open(path)


func _get_true_path(path):
	if path.begins_with("../"):
		return "lingo2/%s" % path.substr(3)
	else:
		return "lingo2/client/%s" % path


func path_exists(path):
	var true_path = _get_true_path(path)
	return apworld_reader.file_exists(true_path)


func load_script(path):
	var true_path = _get_true_path(path)

	var script = GDScript.new()
	script.source_code = apworld_reader.read_file(true_path).get_string_from_utf8()
	script.reload()

	return script


func read_path(path):
	var true_path = _get_true_path(path)
	return apworld_reader.read_file(true_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