From c9da387ede51f207825b63d9f13036a7b661d4b3 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Thu, 7 Aug 2025 16:05:15 -0400 Subject: Started apworld vcpkg's libprotobuf is older than what PIP has, but neither are completely up to date either. Ugh. Doors have a room now because that's where the location will go. --- apworld/player_logic.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 apworld/player_logic.py (limited to 'apworld/player_logic.py') diff --git a/apworld/player_logic.py b/apworld/player_logic.py new file mode 100644 index 0000000..f54573f --- /dev/null +++ b/apworld/player_logic.py @@ -0,0 +1,24 @@ +from typing import TYPE_CHECKING, NamedTuple + +if TYPE_CHECKING: + from . import Lingo2World + + +class PlayerLocation(NamedTuple): + name: str + code: int | None + + +class Lingo2PlayerLogic: + locations_by_room: dict[int, list[PlayerLocation]] + + def __init__(self, world: "Lingo2World"): + self.locations_by_room = {} + + code = 1 + for door in world.static_logic.objects.doors: + if not door.HasField("room_id"): + continue + + self.locations_by_room.setdefault(door.room_id, []).append(PlayerLocation(door.name, code)) + code += 1 -- cgit 1.4.1