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/client.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/client.gd')
-rw-r--r-- | Archipelago/client.gd | 49 |
1 files changed, 12 insertions, 37 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(): |