halflife-unified-sdk icon indicating copy to clipboard operation
halflife-unified-sdk copied to clipboard

Rework damage handling

Open SamVanheer opened this issue 1 year ago • 0 comments

Rework damage handling to eliminate the use of global variables and fix bugs.

Pass parameters to TakeDamage using a structure containing relevant information.

This structure can also be used to pass information to TraceAttack and Killed.

g_vecAttackDir is set in TakeDamage but is used in TraceAttack which is called before TakeDamage.

Pass the correct attacker in func_tank entities. Note that the Gene Worm expects the attacker to be the tank itself (inflictor), not the attacker so that logic needs changing to function correctly.

There may be other entities that expect the attacker to actually be in the inflictor so this needs extensive testing.

Redesigning the multi-damage functionality to store its results in a structure based to TraceAttack can help eliminate edge cases resulting for leftover global state.

SamVanheer avatar Jun 26 '23 15:06 SamVanheer