diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2023-08-01 17:11:10 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2023-08-01 17:11:10 -0400 |
commit | 6d8b971e7824dd6486bb4cb5a0f72eda7c5e47d3 (patch) | |
tree | 5e3ecfb848f4bb525a9c75a1627120bf9f2cad28 /Archipelago/load.gd | |
parent | 62f06090014aee90231eb90da36d5ae1b65171a3 (diff) | |
download | lingo-archipelago-6d8b971e7824dd6486bb4cb5a0f72eda7c5e47d3.tar.gz lingo-archipelago-6d8b971e7824dd6486bb4cb5a0f72eda7c5e47d3.tar.bz2 lingo-archipelago-6d8b971e7824dd6486bb4cb5a0f72eda7c5e47d3.zip |
Gamedata is generated from main AP yaml
We now also include static data that was previously sent in slot data.
Diffstat (limited to 'Archipelago/load.gd')
-rw-r--r-- | Archipelago/load.gd | 55 |
1 files changed, 31 insertions, 24 deletions
diff --git a/Archipelago/load.gd b/Archipelago/load.gd index 0157395..95f0fb8 100644 --- a/Archipelago/load.gd +++ b/Archipelago/load.gd | |||
@@ -93,27 +93,31 @@ func _load(): | |||
93 | 93 | ||
94 | # This is the best time to create the location nodes, since the map is now | 94 | # This is the best time to create the location nodes, since the map is now |
95 | # loaded but the panels haven't been solved from the save file yet. | 95 | # loaded but the panels haven't been solved from the save file yet. |
96 | var gamedata = apclient.get_node("Gamedata") | ||
96 | var panels_parent = self.get_node("Panels") | 97 | var panels_parent = self.get_node("Panels") |
97 | var location_script = ResourceLoader.load("user://maps/Archipelago/location.gd") | 98 | var location_script = ResourceLoader.load("user://maps/Archipelago/location.gd") |
98 | for location_id in apclient._panel_ids_by_location.keys(): | 99 | for location_id in gamedata.panel_ids_by_location_id.keys(): |
99 | var location = location_script.new() | 100 | if apclient._location_name_to_id.has(location_id): |
100 | location.ap_id = int(location_id) | 101 | var location = location_script.new() |
101 | location.name = "AP_location_" + location.ap_id | 102 | location.ap_id = int(apclient._location_name_to_id[location_id]) |
102 | self.add_child(location) | 103 | location.name = "AP_location_%d" % location.ap_id |
103 | 104 | self.add_child(location) | |
104 | var panels = apclient._panel_ids_by_location[String(location.ap_id)] | 105 | |
105 | location.total = panels.size() | 106 | var panels = gamedata.panel_ids_by_location_id[location_id] |
106 | 107 | location.total = panels.size() | |
107 | for panel in panels: | 108 | |
108 | var that_panel | 109 | for panel in panels: |
109 | if panel.begins_with("EndPanel"): | 110 | var that_panel |
110 | that_panel = self.get_node("Decorations").get_node(panel) | 111 | if panel.begins_with("EndPanel"): |
111 | else: | 112 | that_panel = self.get_node("Decorations").get_node(panel) |
112 | that_panel = panels_parent.get_node(panel) | 113 | else: |
113 | 114 | that_panel = panels_parent.get_node(panel) | |
114 | that_panel.get_node("Viewport/GUI/Panel/TextEdit").connect( | 115 | |
115 | "answer_correct", location, "handle_correct" | 116 | that_panel.get_node("Viewport/GUI/Panel/TextEdit").connect( |
116 | ) | 117 | "answer_correct", location, "handle_correct" |
118 | ) | ||
119 | else: | ||
120 | global._print("Could not find location ID for %s" % location_id) | ||
117 | 121 | ||
118 | # HOT CRUSTS should be at eye-level, have a yellow block behind it, and | 122 | # HOT CRUSTS should be at eye-level, have a yellow block behind it, and |
119 | # not vanish when solved. | 123 | # not vanish when solved. |
@@ -133,8 +137,6 @@ func _load(): | |||
133 | var rng = RandomNumberGenerator.new() | 137 | var rng = RandomNumberGenerator.new() |
134 | rng.seed = apclient._slot_seed | 138 | rng.seed = apclient._slot_seed |
135 | 139 | ||
136 | var gamedata = apclient.get_node("Gamedata") | ||
137 | |||
138 | # Remove opaque wall in front of FOURTH. | 140 | # Remove opaque wall in front of FOURTH. |
139 | set_gridmap_tile(-71.5, 1.5, -64.5, "MeshInstance18") | 141 | set_gridmap_tile(-71.5, 1.5, -64.5, "MeshInstance18") |
140 | 142 | ||
@@ -309,7 +311,7 @@ func _load(): | |||
309 | remaining.append(all_paintings[j]) | 311 | remaining.append(all_paintings[j]) |
310 | all_paintings.remove(j) | 312 | all_paintings.remove(j) |
311 | 313 | ||
312 | for painting in apclient._paintings.keys(): | 314 | for painting in gamedata.paintings.keys(): |
313 | if randomized.has(painting): | 315 | if randomized.has(painting): |
314 | continue | 316 | continue |
315 | 317 | ||
@@ -364,7 +366,11 @@ func _load(): | |||
364 | # disable them. | 366 | # disable them. |
365 | var panel_script = ResourceLoader.load("user://maps/Archipelago/panel.gd") | 367 | var panel_script = ResourceLoader.load("user://maps/Archipelago/panel.gd") |
366 | for panel in gamedata.panels: | 368 | for panel in gamedata.panels: |
367 | var panel_node = panels_parent.get_node(panel["id"]) | 369 | var panel_node |
370 | if panel["id"].begins_with("EndPanel"): | ||
371 | panel_node = self.get_node("Decorations").get_node(panel["id"]) | ||
372 | else: | ||
373 | panel_node = panels_parent.get_node(panel["id"]) | ||
368 | var script_instance = panel_script.new() | 374 | var script_instance = panel_script.new() |
369 | script_instance.name = "AP_Panel" | 375 | script_instance.name = "AP_Panel" |
370 | script_instance.data = panel | 376 | script_instance.data = panel |
@@ -445,7 +451,8 @@ func instantiate_painting(name, scene): | |||
445 | var mps_inst = mypainting_script.new() | 451 | var mps_inst = mypainting_script.new() |
446 | mps_inst.set_name("Script") | 452 | mps_inst.set_name("Script") |
447 | 453 | ||
448 | var pconfig = apclient._paintings[name] | 454 | var gamedata = apclient.get_node("Gamedata") |
455 | var pconfig = gamedata.paintings[name] | ||
449 | mps_inst.orientation = pconfig["orientation"] | 456 | mps_inst.orientation = pconfig["orientation"] |
450 | if pconfig["move"]: | 457 | if pconfig["move"]: |
451 | mps_inst.move = true | 458 | mps_inst.move = true |