diff options
Diffstat (limited to 'Archipelago')
-rw-r--r-- | Archipelago/client.gd | 49 | ||||
-rw-r--r-- | Archipelago/load.gd | 55 |
2 files changed, 43 insertions, 61 deletions
diff --git a/Archipelago/client.gd b/Archipelago/client.gd index a816c42..a4ffb1b 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd | |||
@@ -73,12 +73,6 @@ var _players = [] | |||
73 | var _player_name_by_slot = {} | 73 | var _player_name_by_slot = {} |
74 | var _checked_locations = [] | 74 | var _checked_locations = [] |
75 | var _slot_data = {} | 75 | var _slot_data = {} |
76 | var _door_ids_by_item = {} | ||
77 | var _mentioned_doors = [] | ||
78 | var _painting_ids_by_item = {} | ||
79 | var _mentioned_paintings = [] | ||
80 | var _panel_ids_by_location = {} | ||
81 | var _paintings = {} | ||
82 | var _paintings_mapping = {} | 76 | var _paintings_mapping = {} |
83 | var _localdata_file = "" | 77 | var _localdata_file = "" |
84 | var _death_link = false | 78 | var _death_link = false |
@@ -230,25 +224,6 @@ func _on_data(): | |||
230 | for player in _players: | 224 | for player in _players: |
231 | _player_name_by_slot[player["slot"]] = player["alias"] | 225 | _player_name_by_slot[player["slot"]] = player["alias"] |
232 | 226 | ||
233 | if _slot_data.has("door_ids_by_item_id"): | ||
234 | _door_ids_by_item = _slot_data["door_ids_by_item_id"] | ||
235 | |||
236 | _mentioned_doors = [] | ||
237 | for item in _door_ids_by_item.values(): | ||
238 | for door in item: | ||
239 | _mentioned_doors.append(door) | ||
240 | if _slot_data.has("painting_ids_by_item_id"): | ||
241 | _painting_ids_by_item = _slot_data["painting_ids_by_item_id"] | ||
242 | |||
243 | _mentioned_paintings = [] | ||
244 | for item in _painting_ids_by_item.values(): | ||
245 | for painting in item: | ||
246 | _mentioned_paintings.append(painting) | ||
247 | if _slot_data.has("panel_ids_by_location_id"): | ||
248 | _panel_ids_by_location = _slot_data["panel_ids_by_location_id"] | ||
249 | if _slot_data.has("paintings"): | ||
250 | _paintings = _slot_data["paintings"] | ||
251 | |||
252 | _death_link = _slot_data.has("death_link") and _slot_data["death_link"] | 227 | _death_link = _slot_data.has("death_link") and _slot_data["death_link"] |
253 | if _death_link: | 228 | if _death_link: |
254 | sendConnectUpdate(["DeathLink"]) | 229 | sendConnectUpdate(["DeathLink"]) |
@@ -260,7 +235,7 @@ func _on_data(): | |||
260 | if _slot_data.has("shuffle_doors"): | 235 | if _slot_data.has("shuffle_doors"): |
261 | _door_shuffle = (_slot_data["shuffle_doors"] > 0) | 236 | _door_shuffle = (_slot_data["shuffle_doors"] > 0) |
262 | if _slot_data.has("shuffle_paintings"): | 237 | if _slot_data.has("shuffle_paintings"): |
263 | _painting_shuffle = (_slot_data["shuffle_paintings"] > 0) | 238 | _painting_shuffle = _slot_data["shuffle_paintings"] |
264 | if _slot_data.has("shuffle_panels"): | 239 | if _slot_data.has("shuffle_panels"): |
265 | _panel_shuffle = _slot_data["shuffle_panels"] | 240 | _panel_shuffle = _slot_data["shuffle_panels"] |
266 | if _slot_data.has("seed"): | 241 | if _slot_data.has("seed"): |
@@ -585,17 +560,21 @@ func processItem(item, index, from, flags): | |||
585 | 560 | ||
586 | global._print(item) | 561 | global._print(item) |
587 | 562 | ||
588 | var stringified = String(item) | 563 | var gamedata = $Gamedata |
589 | if _door_ids_by_item.has(stringified): | 564 | var item_name = "Unknown" |
565 | if _item_id_to_name.has(item): | ||
566 | item_name = _item_id_to_name[item] | ||
567 | |||
568 | if gamedata.door_ids_by_item_id.has(item_name): | ||
590 | var doorsNode = get_tree().get_root().get_node("Spatial/Doors") | 569 | var doorsNode = get_tree().get_root().get_node("Spatial/Doors") |
591 | for door_id in _door_ids_by_item[stringified]: | 570 | for door_id in gamedata.door_ids_by_item_id[item_name]: |
592 | doorsNode.get_node(door_id).openDoor() | 571 | doorsNode.get_node(door_id).openDoor() |
593 | 572 | ||
594 | if _painting_ids_by_item.has(stringified): | 573 | if gamedata.painting_ids_by_item_id.has(item_name): |
595 | var real_parent_node = get_tree().get_root().get_node("Spatial/Decorations/Paintings") | 574 | var real_parent_node = get_tree().get_root().get_node("Spatial/Decorations/Paintings") |
596 | var fake_parent_node = get_tree().get_root().get_node_or_null("Spatial/AP_Paintings") | 575 | var fake_parent_node = get_tree().get_root().get_node_or_null("Spatial/AP_Paintings") |
597 | 576 | ||
598 | for painting_id in _painting_ids_by_item[stringified]: | 577 | for painting_id in gamedata.painting_ids_by_item_id[item_name]: |
599 | var painting_node = real_parent_node.get_node_or_null(painting_id) | 578 | var painting_node = real_parent_node.get_node_or_null(painting_id) |
600 | if painting_node != null: | 579 | if painting_node != null: |
601 | painting_node.movePainting() | 580 | painting_node.movePainting() |
@@ -606,10 +585,6 @@ func processItem(item, index, from, flags): | |||
606 | painting_node.get_node("Script").movePainting() | 585 | painting_node.get_node("Script").movePainting() |
607 | 586 | ||
608 | # Handle progressive items. | 587 | # Handle progressive items. |
609 | var item_name = "Unknown" | ||
610 | if _item_id_to_name.has(item): | ||
611 | item_name = _item_id_to_name[item] | ||
612 | |||
613 | if item_name in progressive_items.keys(): | 588 | if item_name in progressive_items.keys(): |
614 | if not item_name in _progressive_progress: | 589 | if not item_name in _progressive_progress: |
615 | _progressive_progress[item_name] = 0 | 590 | _progressive_progress[item_name] = 0 |
@@ -659,11 +634,11 @@ func processItem(item, index, from, flags): | |||
659 | 634 | ||
660 | 635 | ||
661 | func doorIsVanilla(door): | 636 | func doorIsVanilla(door): |
662 | return !_mentioned_doors.has(door) | 637 | return !$Gamedata.mentioned_doors.has(door) |
663 | 638 | ||
664 | 639 | ||
665 | func paintingIsVanilla(painting): | 640 | func paintingIsVanilla(painting): |
666 | return !_mentioned_paintings.has(painting) | 641 | return !$Gamedata.mentioned_paintings.has(painting) |
667 | 642 | ||
668 | 643 | ||
669 | func evaluateSolvability(): | 644 | func evaluateSolvability(): |
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 |