Skip to content

Commit

Permalink
Lingo: Fix number hunt issues on panels mode (ArchipelagoMW#4342)
Browse files Browse the repository at this point in the history
  • Loading branch information
hatkirby authored Dec 10, 2024
1 parent 5dd19fc commit 925fb96
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
Binary file modified worlds/lingo/data/generated.dat
Binary file not shown.
7 changes: 6 additions & 1 deletion worlds/lingo/test/TestDatafile.py
Original file line number Diff line number Diff line change
@@ -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


Expand All @@ -14,3 +14,8 @@ def test_check_hashes(self) -> None:
"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)
16 changes: 10 additions & 6 deletions worlds/lingo/utils/pickle_static_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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()

Expand Down

0 comments on commit 925fb96

Please sign in to comment.