summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2024-12-10 14:36:38 -0500
committerGitHub <noreply@github.com>2024-12-10 20:36:38 +0100
commit1c7fcd002eb59e8cda09997eb89ecd609aff7275 (patch)
tree9e19ab6e89b2215d8f1cfb36d4915f07b1290e00
parentb5fc38f1f961f13d885b13582e3709704a0e57c3 (diff)
downloadlingo-apworld-1c7fcd002eb59e8cda09997eb89ecd609aff7275.tar.gz
lingo-apworld-1c7fcd002eb59e8cda09997eb89ecd609aff7275.tar.bz2
lingo-apworld-1c7fcd002eb59e8cda09997eb89ecd609aff7275.zip
Lingo: Fix number hunt issues on panels mode (#4342)
-rw-r--r--data/generated.datbin149230 -> 149485 bytes
-rw-r--r--test/TestDatafile.py7
-rw-r--r--utils/pickle_static_data.py16
3 files changed, 16 insertions, 7 deletions
diff --git a/data/generated.dat b/data/generated.dat index 9abb027..8b159d4 100644 --- a/data/generated.dat +++ b/data/generated.dat
Binary files differ
diff --git a/test/TestDatafile.py b/test/TestDatafile.py index 60acb3e..a01ff41 100644 --- a/test/TestDatafile.py +++ b/test/TestDatafile.py
@@ -1,7 +1,7 @@
1import os 1import os
2import unittest 2import unittest
3 3
4from ..static_logic import HASHES 4from ..static_logic import HASHES, PANELS_BY_ROOM
5from ..utils.pickle_static_data import hash_file 5from ..utils.pickle_static_data import hash_file
6 6
7 7
@@ -14,3 +14,8 @@ class TestDatafile(unittest.TestCase):
14 "LL1.yaml hash does not match generated.dat. Please regenerate using 'python worlds/lingo/utils/pickle_static_data.py'") 14 "LL1.yaml hash does not match generated.dat. Please regenerate using 'python worlds/lingo/utils/pickle_static_data.py'")
15 self.assertEqual(ids_file_hash, HASHES["ids.yaml"], 15 self.assertEqual(ids_file_hash, HASHES["ids.yaml"],
16 "ids.yaml hash does not match generated.dat. Please regenerate using 'python worlds/lingo/utils/pickle_static_data.py'") 16 "ids.yaml hash does not match generated.dat. Please regenerate using 'python worlds/lingo/utils/pickle_static_data.py'")
17
18 def test_panel_doors_are_set(self) -> None:
19 # This panel is defined earlier in the file than the panel door, so we want to check that the panel door is
20 # correctly applied.
21 self.assertNotEqual(PANELS_BY_ROOM["Outside The Agreeable"]["FIVE (1)"].panel_door, None)
diff --git a/utils/pickle_static_data.py b/utils/pickle_static_data.py index cd5c4b4..df82a12 100644 --- a/utils/pickle_static_data.py +++ b/utils/pickle_static_data.py
@@ -111,6 +111,16 @@ def load_static_data(ll1_path, ids_path):
111 with open(ll1_path, "r") as file: 111 with open(ll1_path, "r") as file:
112 config = Utils.parse_yaml(file) 112 config = Utils.parse_yaml(file)
113 113
114 # We have to process all panel doors first so that panels can see what panel doors they're in even if they're
115 # defined earlier in the file than the panel door.
116 for room_name, room_data in config.items():
117 if "panel_doors" in room_data:
118 PANEL_DOORS_BY_ROOM[room_name] = dict()
119
120 for panel_door_name, panel_door_data in room_data["panel_doors"].items():
121 process_panel_door(room_name, panel_door_name, panel_door_data)
122
123 # Process the rest of the room.
114 for room_name, room_data in config.items(): 124 for room_name, room_data in config.items():
115 process_room(room_name, room_data) 125 process_room(room_name, room_data)
116 126
@@ -515,12 +525,6 @@ def process_room(room_name, room_data):
515 for source_room, doors in room_data["entrances"].items(): 525 for source_room, doors in room_data["entrances"].items():
516 process_entrance(source_room, doors, room_obj) 526 process_entrance(source_room, doors, room_obj)
517 527
518 if "panel_doors" in room_data:
519 PANEL_DOORS_BY_ROOM[room_name] = dict()
520
521 for panel_door_name, panel_door_data in room_data["panel_doors"].items():
522 process_panel_door(room_name, panel_door_name, panel_door_data)
523
524 if "panels" in room_data: 528 if "panels" in room_data:
525 PANELS_BY_ROOM[room_name] = dict() 529 PANELS_BY_ROOM[room_name] = dict()
526 530