From 1c7fcd002eb59e8cda09997eb89ecd609aff7275 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Tue, 10 Dec 2024 14:36:38 -0500 Subject: Lingo: Fix number hunt issues on panels mode (#4342) --- data/generated.dat | Bin 149230 -> 149485 bytes test/TestDatafile.py | 7 ++++++- utils/pickle_static_data.py | 16 ++++++++++------ 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/data/generated.dat b/data/generated.dat index 9abb027..8b159d4 100644 Binary files a/data/generated.dat and b/data/generated.dat 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 @@ import os import unittest -from ..static_logic import HASHES +from ..static_logic import HASHES, PANELS_BY_ROOM from ..utils.pickle_static_data import hash_file @@ -14,3 +14,8 @@ class TestDatafile(unittest.TestCase): "LL1.yaml hash does not match generated.dat. Please regenerate using 'python worlds/lingo/utils/pickle_static_data.py'") self.assertEqual(ids_file_hash, HASHES["ids.yaml"], "ids.yaml hash does not match generated.dat. Please regenerate using 'python worlds/lingo/utils/pickle_static_data.py'") + + def test_panel_doors_are_set(self) -> None: + # This panel is defined earlier in the file than the panel door, so we want to check that the panel door is + # correctly applied. + 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): with open(ll1_path, "r") as file: config = Utils.parse_yaml(file) + # We have to process all panel doors first so that panels can see what panel doors they're in even if they're + # defined earlier in the file than the panel door. + for room_name, room_data in config.items(): + if "panel_doors" in room_data: + PANEL_DOORS_BY_ROOM[room_name] = dict() + + for panel_door_name, panel_door_data in room_data["panel_doors"].items(): + process_panel_door(room_name, panel_door_name, panel_door_data) + + # Process the rest of the room. for room_name, room_data in config.items(): process_room(room_name, room_data) @@ -515,12 +525,6 @@ def process_room(room_name, room_data): for source_room, doors in room_data["entrances"].items(): process_entrance(source_room, doors, room_obj) - if "panel_doors" in room_data: - PANEL_DOORS_BY_ROOM[room_name] = dict() - - for panel_door_name, panel_door_data in room_data["panel_doors"].items(): - process_panel_door(room_name, panel_door_name, panel_door_data) - if "panels" in room_data: PANELS_BY_ROOM[room_name] = dict() -- cgit 1.4.1