Add portal to tavern zone

This commit is contained in:
Jared Miller 2026-02-11 22:09:14 -05:00
parent d6920834c8
commit 7154dd86d3
Signed by: shmup
GPG key ID: 22B5C6D66A38B06C
2 changed files with 31 additions and 0 deletions

View file

@ -19,3 +19,9 @@ rows = [
[terrain.impassable] [terrain.impassable]
tiles = ["#"] tiles = ["#"]
[[portals]]
x = 4
y = 5
target = "hub:14,7"
label = "the tavern door"

View file

@ -351,3 +351,28 @@ aliases = ["gateway", "gate", "portal"]
assert portal.aliases == ["gateway", "gate", "portal"] assert portal.aliases == ["gateway", "gate", "portal"]
finally: finally:
temp_path.unlink() temp_path.unlink()
def test_tavern_has_portal_to_hub():
"""Tavern zone has a portal at the door leading to hub zone."""
project_root = pathlib.Path(__file__).resolve().parents[1]
tavern_path = project_root / "content" / "zones" / "tavern.toml"
zone = load_zone(tavern_path)
# Find portals in zone
portals = [obj for obj in zone._contents if obj.__class__.__name__ == "Portal"]
assert len(portals) == 1
# Check portal is at the door (4, 5) and leads to hub
portal = portals[0]
assert portal.name == "the tavern door"
assert portal.x == 4
assert portal.y == 5
assert portal.target_zone == "hub"
assert portal.target_x == 14
assert portal.target_y == 7
# Verify portal is accessible at door coordinates
contents_at_door = zone.contents_at(4, 5)
assert portal in contents_at_door