diff options
| author | Star Rauchenberger <fefferburbia@gmail.com> | 2025-08-07 16:05:15 -0400 |
|---|---|---|
| committer | Star Rauchenberger <fefferburbia@gmail.com> | 2025-08-07 16:05:15 -0400 |
| commit | c9da387ede51f207825b63d9f13036a7b661d4b3 (patch) | |
| tree | 08425dbc57c92ac72fef43c32ecbd5805f18f1f8 /apworld/player_logic.py | |
| parent | 3c26cedd030c464e3b8a5576a98c19eb45134658 (diff) | |
| download | lingo2-archipelago-c9da387ede51f207825b63d9f13036a7b661d4b3.tar.gz lingo2-archipelago-c9da387ede51f207825b63d9f13036a7b661d4b3.tar.bz2 lingo2-archipelago-c9da387ede51f207825b63d9f13036a7b661d4b3.zip | |
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.
Diffstat (limited to 'apworld/player_logic.py')
| -rw-r--r-- | apworld/player_logic.py | 24 |
1 files changed, 24 insertions, 0 deletions
| 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 @@ | |||
| 1 | from typing import TYPE_CHECKING, NamedTuple | ||
| 2 | |||
| 3 | if TYPE_CHECKING: | ||
| 4 | from . import Lingo2World | ||
| 5 | |||
| 6 | |||
| 7 | class PlayerLocation(NamedTuple): | ||
| 8 | name: str | ||
| 9 | code: int | None | ||
| 10 | |||
| 11 | |||
| 12 | class Lingo2PlayerLogic: | ||
| 13 | locations_by_room: dict[int, list[PlayerLocation]] | ||
| 14 | |||
| 15 | def __init__(self, world: "Lingo2World"): | ||
| 16 | self.locations_by_room = {} | ||
| 17 | |||
| 18 | code = 1 | ||
| 19 | for door in world.static_logic.objects.doors: | ||
| 20 | if not door.HasField("room_id"): | ||
| 21 | continue | ||
| 22 | |||
| 23 | self.locations_by_room.setdefault(door.room_id, []).append(PlayerLocation(door.name, code)) | ||
| 24 | code += 1 | ||
