From b3693a35f8b856279c6844ad92f9ab61f9fc352a Mon Sep 17 00:00:00 2001 From: Dinorush <62536724+Dinorush@users.noreply.github.com> Date: Thu, 14 Apr 2022 23:00:19 -0400 Subject: Add core meter gain exceptions (#284) --- .../mod/scripts/vscripts/mp/_codecallbacks.gnut | 38 +++++++++++++++++----- 1 file changed, 29 insertions(+), 9 deletions(-) (limited to 'Northstar.CustomServers/mod/scripts') diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_codecallbacks.gnut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_codecallbacks.gnut index 2e565142..425a8b8b 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_codecallbacks.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_codecallbacks.gnut @@ -6,6 +6,9 @@ global function CodeCallback_DamagePlayerOrNPC global function GameModeRulesShouldGiveTimerCredit global function SetGameModeRulesShouldGiveTimerCredit global function SetGameModeRulesEarnMeterOnDamage +global function GameModeRulesRegisterTimerCreditExceptions +global function GameModeRulesRegisterTimerCreditException +global function GameModeRulesGetTimerCreditExceptions global function GetDamageOrigin global function CodeCallBack_ShouldTriggerSniperCam global function CodeCallback_ForceAIMissPlayer @@ -31,6 +34,13 @@ struct float titanMeterGainScale = 0.0001 bool functionref( entity, entity, var ) ShouldGiveTimerCreditGameModeRules void functionref( entity, entity, TitanDamage, float ) earnMeterOnDamageGameModeRulesCallback + array gameModeRulesTimerCreditExceptions = [ + eDamageSourceId.mp_titancore_flame_wave, + eDamageSourceId.mp_titancore_flame_wave_secondary, + eDamageSourceId.mp_titancore_salvo_core, + damagedef_titan_fall, + damagedef_nuclear_core + ] table playerAccumulatedDamageData } file @@ -582,15 +592,8 @@ bool function ShouldGiveTimerCredit_Default( entity player, entity victim, var d return false int damageSourceID = DamageInfo_GetDamageSourceIdentifier( damageInfo ) - switch ( damageSourceID ) - { - case eDamageSourceId.mp_titancore_flame_wave: - case eDamageSourceId.mp_titancore_flame_wave_secondary: - case eDamageSourceId.mp_titancore_salvo_core: - case damagedef_titan_fall: - case damagedef_nuclear_core: - return false - } + if ( file.gameModeRulesTimerCreditExceptions.contains( damageSourceID ) ) + return false return true } @@ -605,6 +608,23 @@ void function SetGameModeRulesShouldGiveTimerCredit( bool functionref( entity, e file.ShouldGiveTimerCreditGameModeRules = rules } +void function GameModeRulesRegisterTimerCreditExceptions( array ids ) +{ + foreach( id in ids ) + GameModeRulesRegisterTimerCreditException( id ) +} + +void function GameModeRulesRegisterTimerCreditException( int id ) +{ + if ( !file.gameModeRulesTimerCreditExceptions.contains( id ) ) + file.gameModeRulesTimerCreditExceptions.append( id ) +} + +array function GameModeRulesGetTimerCreditExceptions() +{ + return file.gameModeRulesTimerCreditExceptions +} + function TitanDamageFlinch( entity ent, damageInfo ) { if ( DamageInfo_GetCustomDamageType( damageInfo ) & DF_DOOMED_HEALTH_LOSS ) -- cgit v1.2.3