diff options
| author | historia <[not public]> | 2026-06-21 22:19:17 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-06-21 22:19:17 -0400 |
| commit | a3ae1e6aad696f584d138d9363c05dedff136a65 (patch) | |
| tree | 81e615f7227bc9d1ec79ceefc7311ecde917b074 /internal/game/game.go | |
| parent | 84072ffe6365ad57c4976e9272762aa6db41de7e (diff) | |
| download | thehouseoficarus-a3ae1e6aad696f584d138d9363c05dedff136a65.tar.gz | |
feat: safespot system implemented
Diffstat (limited to 'internal/game/game.go')
| -rw-r--r-- | internal/game/game.go | 18 |
1 files changed, 18 insertions, 0 deletions
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() + } } }) } |
