Skip to content
Open
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
5 changes: 5 additions & 0 deletions regamedll/dlls/weapons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ void EXT_FUNC __API_HOOK(AddMultiDamage)(entvars_t *pevInflictor, CBaseEntity *p
if (!pEntity)
return;

#ifdef REGAMEDLL_FIXES
if (flDamage <= 0.0f) // avoid zero or negative damage TakeDamage
Copy link
Member

Choose a reason for hiding this comment

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

This fix makes sense.
However, there is one detail I remember, some custom maps intentionally use negative damage values (e.g., env_laser with damage = -300) as a way to heal players.

The maps I recall include bhop_zerocheaters, deathrun_forest, deathrun_friends, but there are many more with different scenarios.

This is not a bug but rather a hidden feature that level designers sometimes rely on. With your change, such maps would stop working as intended, since TakeDamage would never be triggered.

So the fix could unintentionally break existing community content.
One possible approach could be to allow negative values (skip only flDamage == 0).

Copy link

Choose a reason for hiding this comment

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

I don't think flDamage == 0 should be skipped either, there is high chance that heavily customized servers might already use zero damage sources for things, to me it seems that the if damage was zero check should be done on the plugin developer's side to maintain current flexibility. It's always better the more things there are to hook into and modify than less.

return;
#endif

gMultiDamage.type |= bitsDamageType;

if (pEntity != gMultiDamage.hEntity)
Expand Down