aboutsummaryrefslogtreecommitdiff
path: root/internal/game/exit_discovery.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-07-06 23:05:04 -0400
committerhistoria <[not public]>2026-07-06 23:05:04 -0400
commit9292634f2f8d71a53879ff07e1330c671b207d51 (patch)
treedcffadf7f697e8ad0705d787d8f599bdeeedb812 /internal/game/exit_discovery.go
parent911aae15f4e869c93239ef7c630c61e1d9d4ef3f (diff)
downloadthehouseoficarus-9292634f2f8d71a53879ff07e1330c671b207d51.tar.gz
feat: split the concept of hidden and impassable exits. add player_flag for discovered hidden exits.
Diffstat (limited to 'internal/game/exit_discovery.go')
-rw-r--r--internal/game/exit_discovery.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/internal/game/exit_discovery.go b/internal/game/exit_discovery.go
new file mode 100644
index 0000000..1d07e13
--- /dev/null
+++ b/internal/game/exit_discovery.go
@@ -0,0 +1,31 @@
+package game
+
+import (
+ "fmt"
+ "strings"
+
+ "thehouseoficarus/internal/player"
+ "thehouseoficarus/internal/world"
+)
+
+func discoveredExitFlag(roomID int, dir world.ExitDir) string {
+ return fmt.Sprintf("hidden_exit_%d_%s", roomID, strings.ToLower(string(dir)))
+}
+
+func (g *Game) exitDiscovered(p *player.Player, roomID int, dir world.ExitDir) bool {
+ if p.GodMode {
+ return true
+ }
+ return getPlayerFlagInt(p, discoveredExitFlag(roomID, dir)) != 0
+}
+
+func (g *Game) markExitDiscovered(p *player.Player, roomID int, dir world.ExitDir) {
+ g.setPlayerFlag(p, discoveredExitFlag(roomID, dir), 1)
+}
+
+func (g *Game) exitHiddenFiltered(p *player.Player, roomID int, dir world.ExitDir, exitHidden bool) bool {
+ if !exitHidden {
+ return true
+ }
+ return g.exitDiscovered(p, roomID, dir)
+}