aboutsummaryrefslogtreecommitdiff
path: root/internal/game/cmd_sneak.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-19 03:15:59 -0400
committerhistoria <[not public]>2026-09-19 03:15:59 -0400
commit0e60567a7a0addb9421769ee7be7853bfa8788cb (patch)
tree7645112db0e4eae95b8a83c1e4f9aab38bede655 /internal/game/cmd_sneak.go
parentcc33072eced3d5460512c09c42ec4531c807d7af (diff)
downloadthehouseoficarus-0e60567a7a0addb9421769ee7be7853bfa8788cb.tar.gz
refactor: simplifcation, change how rooms are stored in player yaml, remove legacy code
Diffstat (limited to 'internal/game/cmd_sneak.go')
-rw-r--r--internal/game/cmd_sneak.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/internal/game/cmd_sneak.go b/internal/game/cmd_sneak.go
index 5ae60e7..ce063ce 100644
--- a/internal/game/cmd_sneak.go
+++ b/internal/game/cmd_sneak.go
@@ -2,10 +2,25 @@ package game
import (
"fmt"
+ "strconv"
+ "strings"
"thehouseoficarus/internal/net"
)
+// clearGuardWatchRoom drops the sneak/guard-watch cycle timers for one room.
+// Called when the room's content is reconciled or the room is deleted, so the
+// map does not retain entries for rooms/objects that no longer exist for the
+// life of the process.
+func (g *Game) clearGuardWatchRoom(roomID int) {
+ prefix := strconv.Itoa(roomID) + ":"
+ for key := range g.guardWatchTimers {
+ if strings.HasPrefix(key, prefix) {
+ delete(g.guardWatchTimers, key)
+ }
+ }
+}
+
func (g *Game) executeSneak(sess *net.Session, args []string, rawInput string) {
g.doSneak(sess)
}