From a3ae1e6aad696f584d138d9363c05dedff136a65 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Sun, 21 Jun 2026 22:19:17 -0400 Subject: feat: safespot system implemented --- internal/game/game.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'internal/game/game.go') diff --git a/internal/game/game.go b/internal/game/game.go index 8bf289b..d3bb391 100644 --- a/internal/game/game.go +++ b/internal/game/game.go @@ -57,6 +57,16 @@ type Game struct { guardWatchTimers map[string]int farmTickCounter int hackingStates map[string]*hacking.Session + safespotMu sync.Mutex + safespotStates map[string]*SafespotState +} + +type SafespotState struct { + Active bool + ObjectDefID string + ObjectIndex int + RoomID int + HideCountdown int } func New(dataDir string, colorConfig *config.ColorsConfig, valConfig config.ValidationConfig) *Game { @@ -81,6 +91,7 @@ func New(dataDir string, colorConfig *config.ColorsConfig, valConfig config.Vali pendingDepletions: nil, guardWatchTimers: make(map[string]int), hackingStates: make(map[string]*hacking.Session), + safespotStates: make(map[string]*SafespotState), } g.CourseStore.LoadAll() g.LoadMods() @@ -98,6 +109,13 @@ func (g *Game) SetHub(hub *net.Hub) { delete(g.loggedInChars, p.Name) g.charsMu.Unlock() delete(g.hackingStates, p.Name) + g.safespotMu.Lock() + if ss, ok := g.safespotStates[p.Name]; ok { + g.safespotMu.Unlock() + g.forceLeaveSafespot(sess, p, ss, "") + } else { + g.safespotMu.Unlock() + } } }) } -- cgit v1.2.3