feat(combat): dead enemies are stunned right after Die

Live sent SetStunned to every dead object with a combat AI in the
packet right after its Die: 7,098 of 7,105 such deaths (7,424 decoded
stuns, all the same: no originator, push, can't attack, move or turn,
ignore immunity). Objects without combat AI (smashables, 9,393 deaths)
never got one. DLU sent none, so a dying enemy could keep turning or
start an attack while its death plays.

Check: kill enemies mid-attack and while they chase you; they stop
moving, turning and attacking the moment they die, and the death and
loot still play normally.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-09-29 03:13:17 -05:00
parent 6a438ac419
commit 08053a1b01
2 changed files with 52 additions and 0 deletions

View File

@@ -764,6 +764,18 @@ void DestroyableComponent::Smash(const LWOOBJID source, const eKillType killType
die.lootOwnerID = source;
die.Send(UNASSIGNED_SYSTEM_ADDRESS);
// Live stunned every dead enemy right after its Die (7,098 of 7,105 deaths of objects with combat AI): no
// originator, push, can't attack, move or turn, ignoring immunity. Nothing else that dies gets it.
if (m_Parent->HasComponent(eReplicaComponentType::BASE_COMBAT_AI)) {
GameMessages::SetStunned stun;
stun.target = m_Parent->GetObjectID();
stun.StateChangeType = eStateChangeType::PUSH;
stun.bCantAttack = true;
stun.bCantMove = true;
stun.bCantTurn = true;
stun.Send(UNASSIGNED_SYSTEM_ADDRESS);
}
// Live told the killer right after Die, before the loot: EnemiesSmashed for an NPC, SmashablesSmashed for another
// smashable. Racing counts its own (RacingSmashablesSmashed).
if (owner && owner != m_Parent) {