bugfix: Detonated GLA Demo Battle Buses are no longer instantly deleted without firing their death weapons - #3264
Conversation
…ed without firing their death weapons
PR Summary by QodoEnsure Battle Bus detonations trigger all death behaviors
AI Description
Diagram
High-Level Assessment
Files changed (3)
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can copy the agent prompt from any finding and feed it to your IDE agent |
|
| Filename | Overview |
|---|---|
| GeneralsMD/Code/GameEngine/Include/GameLogic/Module/BattleBusSlowDeathBehavior.h | Exposes the existing Battle Bus real-death state through the new slow-death interface. |
| GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SlowDeathBehavior.h | Adds a real-death query with a default implementation inherited by the concrete slow-death hierarchy. |
| GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/UndeadBody.cpp | Prevents second-life processing after completed deaths and routes genuine second-life selections through the full die-module lifecycle. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Lethal damage reaches UndeadBody] --> B[ActiveBody applies damage]
B --> C{Object effectively dead?}
C -->|Yes| D[Return; onDie lifecycle already handled]
C -->|No| E[Initialize second life]
E --> F[Select applicable SlowDeathBehavior]
F --> G{Real death?}
G -->|No: Battle Bus transition| H[Begin transitional slow death]
G -->|Yes| I[Set forced-kill flag]
I --> J[ActiveBody applies final death]
J --> K[Object onDie invokes applicable die modules]
K --> L[Death weapons and slow-death behavior execute]
Reviews (1): Last reviewed commit: "bugfix: Detonated GLA Demo Battle Buses ..." | Re-trigger Greptile
| if (sdu->isRealDeath()) | ||
| { | ||
| damageInfo->in.m_kill = true; | ||
| ActiveBody::attemptDamage(damageInfo); |
There was a problem hiding this comment.
I am confused by this implementation. The function says startSecondLife, so we now expect a second life with health restore, armor set change, ..., but here it will attempt the kill afterwards. Should this code perhaps be executed before this function is called? Aka shouldStartSecondLife is false when suicided?
The reason I am raising this is, the code reads confusing this way, regardless whether functionally it is working correctly in game.
There was a problem hiding this comment.
This implementation follows the existing setup where a death type handled by a different SlowDeathBehavior (not BattleBusSlowDeathBehavior) would immediately kill the unit. Instead of manually calling the SlowDeathBehavior modules' death logic, they are now intrinsically called through the damage → death path, and only if there's no SlowDeathBehavior to handle it.
Explicitly checking for SUICIDED or any such death types is not as clean or flexible because a mod might use a custom setup where the death types are handled differently. For example, someone might make a zombie unit that immediately dies without rising again if it dies via a HOLY death type.
Perhaps the naming is the source of the confusion. We already have attemptDamage - would attemptSecondLife be more suitable?
There was a problem hiding this comment.
It is not just the function name. Look at all the things that happen before the suicide:
m_isSecondLife = TRUE;
setMaxHealth(data->m_secondLifeMaxHealth, FULLY_HEAL);
setArmorSetFlag(ARMORSET_SECOND_LIFE);
So it fully prepares for a second life, but then it dies. How does that make sense?
There was a problem hiding this comment.
Perhaps it does not make sense, but this is how the retail logic already works. Whether the original logic makes sense is secondary to this fix, which I intended to involve minimal refactoring for safety and simplicity. Would you prefer I move all of those lines below the death logic?
There was a problem hiding this comment.
Yes I think the suicide kill should be before it decides to go to second life.
This change fixes an issue where the GLA Demo Battle Bus would not trigger any death behaviours besides
SlowDeathBehaviormodules when initially killed via an unhandled death type. This resolves the issue where aSUICIDEDdeath would instantly delete the Battle Bus without dealing any suicide damage if the Demolitions upgrade was researched.Before
The Battle Bus deals no damage to surrounding enemies when suicided
BEFORE.mp4
After
The Battle Bus now deals damage to surrounding enemies when suicided
AFTER.mp4