package game import ( "thehouseoficarus/internal/net" "thehouseoficarus/internal/player" ) // releaseCharacterRuntime tears down a character's live world presence when it // leaves the world, whether through the quit countdown final tick or a hard // disconnect. Keeping it in one place is what stops a per-player system from // being cleaned up on one exit path and forgotten on another: the quit path // used to leave a player occupying a safespot cover and holding a stale action. // // It deliberately does NOT detach the session registry, touch trigger // sequences, persist the character, or resolve casino wagers. Callers own // those because their ordering differs: disconnect must snapshot locked // sequences (persistLockedOnDisconnect) before sequences are dropped, and // resolves casino wagers through its deferral/refund path, while quit forfeits // a mid-round stake immediately before saving. func (g *Game) releaseCharacterRuntime(sess *net.Session, p *player.Player) { if p == nil { return } g.stopCombat(p.Name) g.cancelRest(p.Name) g.cancelAction(p) if ss, ok := g.safespot.Get(p.Name); ok { g.forceLeaveSafespot(sess, p, &ss, "") } delete(g.hackingStates, p.Name) }