diff options
| author | historia <[not public]> | 2026-07-06 23:05:04 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-07-06 23:05:04 -0400 |
| commit | 9292634f2f8d71a53879ff07e1330c671b207d51 (patch) | |
| tree | dcffadf7f697e8ad0705d787d8f599bdeeedb812 /internal/game/cmd_walk.go | |
| parent | 911aae15f4e869c93239ef7c630c61e1d9d4ef3f (diff) | |
| download | thehouseoficarus-9292634f2f8d71a53879ff07e1330c671b207d51.tar.gz | |
feat: split the concept of hidden and impassable exits. add player_flag for discovered hidden exits.
Diffstat (limited to 'internal/game/cmd_walk.go')
| -rw-r--r-- | internal/game/cmd_walk.go | 13 |
1 files changed, 8 insertions, 5 deletions
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 } |
