aboutsummaryrefslogtreecommitdiff
path: root/internal/game/sys_combat.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-18 05:31:09 -0400
committerhistoria <[not public]>2026-09-18 05:31:09 -0400
commit153acb7f644d755c45533b7c5311e3ffa47e8973 (patch)
tree7645e6f7b65bc3830b078e3b9336d2e6b199d584 /internal/game/sys_combat.go
parent87d08f0151e643951769e323995f1c5ed89ee200 (diff)
downloadthehouseoficarus-153acb7f644d755c45533b7c5311e3ffa47e8973.tar.gz
fix: harden engine across casino, economy, concurrency, security, and content
Diffstat (limited to 'internal/game/sys_combat.go')
-rw-r--r--internal/game/sys_combat.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/internal/game/sys_combat.go b/internal/game/sys_combat.go
index 26dac2a..b2a2463 100644
--- a/internal/game/sys_combat.go
+++ b/internal/game/sys_combat.go
@@ -105,6 +105,20 @@ func (g *Game) checkAggro(sess *net.Session) {
aggMob := mob
keepRolling := func() (keep bool) {
+ // The retry subscription outlives the session that armed it (only
+ // mob/combat/room state ends it), so a player who has since logged
+ // out, disconnected, or logged in again on a new connection must
+ // not have combat started for them here: the mob's own subscribers
+ // would then keep fighting a character who is not in the world.
+ if sess.Player == nil || sess.IsDisconnecting() {
+ return false
+ }
+ g.charsMu.Lock()
+ current := g.loggedInChars[p.Name]
+ g.charsMu.Unlock()
+ if current != nil && current != sess {
+ return false
+ }
if g.Combat.Get(p.Name) != nil {
return false
}