diff options
Diffstat (limited to 'Archipelago/load.gd')
-rw-r--r-- | Archipelago/load.gd | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Archipelago/load.gd b/Archipelago/load.gd new file mode 100644 index 0000000..b0ccafc --- /dev/null +++ b/Archipelago/load.gd | |||
@@ -0,0 +1,36 @@ | |||
1 | extends "res://scripts/load.gd" | ||
2 | |||
3 | |||
4 | func _load(): | ||
5 | global._print("Hooked Load Start") | ||
6 | |||
7 | var apclient = global.get_node("Archipelago") | ||
8 | |||
9 | # TODO: Override the YOU panel with the AP slot name | ||
10 | |||
11 | # This is the best time to create the location nodes, since the map is now | ||
12 | # loaded but the panels haven't been solved from the save file yet. | ||
13 | var panels_parent = self.get_node("Panels") | ||
14 | var location_script = ResourceLoader.load("user://maps/Archipelago/location.gd") | ||
15 | for location_name in apclient._location_name_to_id: | ||
16 | var location = location_script.new() | ||
17 | location.ap_name = location_name | ||
18 | location.ap_id = apclient._location_name_to_id[location_name] | ||
19 | location.name = "AP_location_" + location.ap_id | ||
20 | self.add_child(location) | ||
21 | |||
22 | var panels = apclient._panel_ids_by_location[String(location.ap_id)] | ||
23 | location.total = panels.size() | ||
24 | |||
25 | for panel in panels: | ||
26 | var that_panel = panels_parent.get_node(panel) | ||
27 | that_panel.get_node("Viewport/GUI/Panel/TextEdit").connect( | ||
28 | "answer_correct", location, "handle_correct" | ||
29 | ) | ||
30 | |||
31 | # Process any items received while the map was loading. | ||
32 | apclient.mapFinishedLoading() | ||
33 | |||
34 | # Proceed with the rest of the load. | ||
35 | global._print("Hooked Load End") | ||
36 | ._load() | ||