Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1260,7 +1260,12 @@ void PhysicsBehavior::onCollide( Object *other, const Coord3D *loc, const Coord3
else
{
// fall into a nonbuilding -- whatever. if we're a vehicle, quietly do a little damage.
#if RETAIL_COMPATIBLE_CRC
if (obj->isKindOf(KINDOF_VEHICLE))
#else
// TheSuperHackers @bugfix Stubbjax 28/01/2026 Prevent dead units from repeatedly dealing damage.
if (obj->isKindOf(KINDOF_VEHICLE) && !obj->isEffectivelyDead())
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect this fix is not correct. I put a breakpoint into this branch and on the very first hit the Object is already dead, which means that this weapon now never fires once.

Image

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you clarify what you mean? You have described the fix as intended, which is to prevent crash damage from triggering if the object is effectively dead.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok how do we know the intent is to not apply damage once when dead technical crashes?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not. We can only say the new intent is to not have it deal any damage in order to improve gameplay.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I expect that a dead vehicle crashing into something can apply damage once. For example if a plane is shot and its rubble hits the ground, then it applies collision damage once. Otherwise only alive vehicles would cause crash damage, which may not be intuitive for players. This is also more in line with what the original code did (incorrectly).

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that the behaviour could be more intuitive, especially in the case of crashed aircraft. However, this change isn't intended to add intuitive behaviour - it's meant to fix a bug.

This is also more in line with what the original code did (incorrectly).

In what way? Retail behaviour does not result in damage to units from crashed aircraft (unless it's the collateral from hitting a building). In fact, nothing mobile with an AIUpdateInterface seems to be affected as far as I can tell.

NO_DAM.mp4

If such behaviour is desirable, then a weapon needs to be fired upon collision with the ground via a dedicated data-driven module where the radius and damage amount can be controlled. Alternatively, aircraft can be assigned a CrusherLevel where necessary as an easy (though limited) solution.

#endif
{
TheWeaponStore->createAndFireTempWeapon(getPhysicsBehaviorModuleData()->m_vehicleCrashesIntoNonBuildingWeaponTemplate, obj, obj->getPosition());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1385,7 +1385,12 @@ void PhysicsBehavior::onCollide( Object *other, const Coord3D *loc, const Coord3
else
{
// fall into a nonbuilding -- whatever. if we're a vehicle, quietly do a little damage.
#if RETAIL_COMPATIBLE_CRC
if (obj->isKindOf(KINDOF_VEHICLE))
#else
// TheSuperHackers @bugfix Stubbjax 28/01/2026 Prevent dead units from repeatedly dealing damage.
if (obj->isKindOf(KINDOF_VEHICLE) && !obj->isEffectivelyDead())
#endif
{
TheWeaponStore->createAndFireTempWeapon(getPhysicsBehaviorModuleData()->m_vehicleCrashesIntoNonBuildingWeaponTemplate, obj, obj->getPosition());
}
Expand Down
Loading