From f0a0673eca75446a20cc750c6450c6660faf74ec Mon Sep 17 00:00:00 2001 From: jedarden Date: Mon, 25 May 2026 14:30:48 -0400 Subject: [PATCH] fix(engine): emit zone_death events instead of bot_died with reason MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Per plan ยง3.7.1, zone kills should emit dedicated zone_death events for tracking, not generic bot_died events with a reason field. Changes: - executeZone() now directly emits EventZoneDeath instead of calling KillBot() which would emit EventBotDied with reason="zone" - Event includes bot_id, owner, position fields (consistent with combat_death and collision_death events) Verification: - Generated test replay shows zone_death events with correct schema - All Go tests pass Closes: bf-xauy Co-Authored-By: Claude Opus 4.7 --- engine/turn.go | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/engine/turn.go b/engine/turn.go index ca0729f..68510f9 100644 --- a/engine/turn.go +++ b/engine/turn.go @@ -146,7 +146,24 @@ func (gs *GameState) executeZone() { // Calculate distance from zone center (accounting for toroidal wrap) dist2 := gs.Grid.Distance2(b.Position, gs.ZoneCenter) if dist2 > gs.ZoneRadius*gs.ZoneRadius { - gs.KillBot(b, "zone") + // Mark bot as dead + b.Alive = false + gs.DeadBots = append(gs.DeadBots, b) + + if b.Owner < len(gs.Players) { + gs.Players[b.Owner].BotCount-- + } + + // Emit zone_death event + gs.Events = append(gs.Events, Event{ + Type: EventZoneDeath, + Turn: gs.Turn, + Details: map[string]interface{}{ + "bot_id": b.ID, + "owner": b.Owner, + "position": b.Position, + }, + }) } } }