From 9292634f2f8d71a53879ff07e1330c671b207d51 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Mon, 6 Jul 2026 23:05:04 -0400 Subject: feat: split the concept of hidden and impassable exits. add player_flag for discovered hidden exits. --- internal/game/cmd_walk.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'internal/game/cmd_walk.go') diff --git a/internal/game/cmd_walk.go b/internal/game/cmd_walk.go index 9bc7183..4b3b7e0 100644 --- a/internal/game/cmd_walk.go +++ b/internal/game/cmd_walk.go @@ -23,7 +23,7 @@ func (g *Game) doWalk(sess *net.Session, args []string) { input := strings.Join(args, "") if roomID, err := strconv.Atoi(input); err == nil { - path := g.findPathToRoom(p.RoomID, roomID, p.GodMode) + path := g.findPathToRoom(p, p.RoomID, roomID) if path == nil { sess.WriteLine(fmt.Sprintf("No path found to room #%d.", roomID)) return @@ -188,7 +188,7 @@ var walkSearchDirs = []world.ExitDir{ world.Up, world.Down, } -func (g *Game) findPathToRoom(fromRoom, toRoom int, godMode bool) []string { +func (g *Game) findPathToRoom(p *player.Player, fromRoom, toRoom int) []string { if fromRoom == toRoom { return nil } @@ -216,9 +216,12 @@ func (g *Game) findPathToRoom(fromRoom, toRoom int, godMode bool) []string { if !exists { continue } - if exitDef.Hidden && !godMode { - continue - } + if !p.GodMode && exitDef.AlwaysBlocked { + continue + } + if exitDef.Hidden && !g.exitDiscovered(p, cur.roomID, dir) { + continue + } if visited[exitDef.Room] { continue } -- cgit v1.2.3