aboutsummaryrefslogtreecommitdiff
path: root/Northstar.CustomServers/mod/scripts/vscripts/mp
diff options
context:
space:
mode:
authorDinorush <62536724+Dinorush@users.noreply.github.com>2023-03-09 16:57:13 -0500
committerGitHub <noreply@github.com>2023-03-09 22:57:13 +0100
commitb54e03852d3afa75b50abbc5eb0569c89dfc2783 (patch)
treec147bb5ecdbc1e2fac11d93857c534e35a929c8c /Northstar.CustomServers/mod/scripts/vscripts/mp
parente1215c96997a0f348285055998254ba064787af5 (diff)
downloadNorthstarMods-b54e03852d3afa75b50abbc5eb0569c89dfc2783.tar.gz
NorthstarMods-b54e03852d3afa75b50abbc5eb0569c89dfc2783.zip
Add support for entity final damage callbacks (#578)
* Add support for entity final damage callbacks * Add final damage callback for non-Players/NPCs * Remove accidental duplicate code * Remove other unnecessary (duplicated) code * Implement uniboi suggestion
Diffstat (limited to 'Northstar.CustomServers/mod/scripts/vscripts/mp')
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/mp/_codecallbacks.gnut14
1 files changed, 14 insertions, 0 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_codecallbacks.gnut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_codecallbacks.gnut
index 425a8b8b..ff281d6e 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_codecallbacks.gnut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_codecallbacks.gnut
@@ -283,12 +283,26 @@ void function CodeCallback_DamagePlayerOrNPC( entity ent, var damageInfo )
return
RunClassDamageFinalCallbacks( ent, damageInfo )
+
#if VERBOSE_DAMAGE_PRINTOUTS
printt( " after class damage final callbacks:", DamageInfo_GetDamage( damageInfo ) )
#endif
if ( DamageInfo_GetDamage( damageInfo ) == 0 )
return
+ // Added via AddEntityCallback_OnFinalDamaged
+ foreach ( callbackFunc in ent.e.entFinalDamageCallbacks )
+ {
+ callbackFunc( ent, damageInfo )
+ }
+
+ #if VERBOSE_DAMAGE_PRINTOUTS
+ printt( " afterAddEntityCallback_OnFinalDamaged callbacks:", DamageInfo_GetDamage( damageInfo ) )
+ #endif
+
+ if ( DamageInfo_GetDamage( damageInfo ) == 0 )
+ return
+
if ( DamageInfo_GetCustomDamageType( damageInfo ) & DF_DOOMED_HEALTH_LOSS )
DamageInfo_AddDamageFlags( damageInfo, DAMAGEFLAG_NOPAIN )