diff options
| author | historia <[not public]> | 2026-06-29 17:19:40 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-06-29 17:19:40 -0400 |
| commit | feb80b7dde200d4121cd9f9c583a08f9869c5588 (patch) | |
| tree | 3271cae1d74c8f3b84ef3ae84f8f62e563029dff /internal/world/room.go | |
| parent | c6cbf76b33ac20d071d25e74b70f6901476193a6 (diff) | |
| download | thehouseoficarus-feb80b7dde200d4121cd9f9c583a08f9869c5588.tar.gz | |
feat: incardinal directions (nw, ne, sw, se). probably janky in ways I haven't yet discovered.
Diffstat (limited to 'internal/world/room.go')
| -rw-r--r-- | internal/world/room.go | 63 |
1 files changed, 44 insertions, 19 deletions
diff --git a/internal/world/room.go b/internal/world/room.go index 21e1277..15f847f 100644 --- a/internal/world/room.go +++ b/internal/world/room.go @@ -11,34 +11,59 @@ import ( type ExitDir string const ( - North ExitDir = "north" - South ExitDir = "south" - East ExitDir = "east" - West ExitDir = "west" - Up ExitDir = "up" - Down ExitDir = "down" + North ExitDir = "north" + South ExitDir = "south" + East ExitDir = "east" + West ExitDir = "west" + Northeast ExitDir = "northeast" + Northwest ExitDir = "northwest" + Southeast ExitDir = "southeast" + Southwest ExitDir = "southwest" + Up ExitDir = "up" + Down ExitDir = "down" ) var ExitAliases = map[string]ExitDir{ - "n": North, - "s": South, - "e": East, - "w": West, - "u": Up, - "d": Down, + "n": North, + "s": South, + "e": East, + "w": West, + "ne": Northeast, + "nw": Northwest, + "se": Southeast, + "sw": Southwest, + "u": Up, + "d": Down, } var OppositeExit = map[ExitDir]ExitDir{ - North: South, - South: North, - East: West, - West: East, - Up: Down, - Down: Up, + North: South, + South: North, + East: West, + West: East, + Northeast: Southwest, + Northwest: Southeast, + Southeast: Northwest, + Southwest: Northeast, + Up: Down, + Down: Up, } var ExitOrder = []ExitDir{ - North, South, East, West, Up, Down, + North, South, East, West, + Northeast, Northwest, Southeast, Southwest, + Up, Down, +} + +var DirectionDeltas = map[ExitDir][2]int{ + North: {0, -1}, + South: {0, 1}, + East: {1, 0}, + West: {-1, 0}, + Northeast: {1, -1}, + Northwest: {-1, -1}, + Southeast: {1, 1}, + Southwest: {-1, 1}, } type SpawnDef struct { |
