diff options
Diffstat (limited to 'Northstar.CustomServers/mod/scripts/vscripts/rodeo')
-rw-r--r-- | Northstar.CustomServers/mod/scripts/vscripts/rodeo/_rodeo_titan.gnut | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/rodeo/_rodeo_titan.gnut b/Northstar.CustomServers/mod/scripts/vscripts/rodeo/_rodeo_titan.gnut index 78cfdb27..153be7cd 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/rodeo/_rodeo_titan.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/rodeo/_rodeo_titan.gnut @@ -27,6 +27,7 @@ global function Rodeo_PilotPicksUpBattery_Silent global function AddOnRodeoStartedCallback global function AddOnRodeoEndedCallback +global function AddBatteryHealCallback global function PilotBattery_SetMaxCount global function ThrowRiderOff @@ -92,6 +93,7 @@ struct { array<void functionref(entity,entity)> onRodeoEndedCallbacks array<void functionref(entity,entity)> onRodeoStartedCallbacks + array<void functionref(entity,entity,int,int)> batteryHealCallbacks table<entity, AntiRodeoPlayerData> antiRodeoPlayerData @@ -535,6 +537,12 @@ void function AddOnRodeoEndedCallback( void functionref(entity,entity) callbackF file.onRodeoEndedCallbacks.append( callbackFunc ) } +void function AddBatteryHealCallback( void functionref(entity,entity,int,int) callbackFunc ) +{ + Assert (!( file.batteryHealCallbacks.contains( callbackFunc ) )) + file.batteryHealCallbacks.append( callbackFunc ) +} + function PlayerBeginsTitanRodeo( entity player, RodeoPackageStruct rodeoPackage, entity rodeoTitan ) { entity soul = rodeoTitan.GetTitanSoul() @@ -1769,6 +1777,8 @@ void function Rodeo_ApplyBatteryToTitan( entity battery, entity titan ) int addHealth = int( healingAmount * frac ) int totalHealth = minint( titan.GetMaxHealth(), titan.GetHealth() + addHealth ) + if( titan.GetHealth() + addHealth > titan.GetMaxHealth() ) + addHealth = titan.GetMaxHealth() - titan.GetHealth() if ( soul.IsDoomed() && batteryIsAmped ) { UndoomTitan( titan, 1 ) @@ -1779,6 +1789,11 @@ void function Rodeo_ApplyBatteryToTitan( entity battery, entity titan ) titan.SetHealth( totalHealth ) soul.SetShieldHealth( soul.GetShieldHealthMax() ) } + + foreach ( callbackFunc in file.batteryHealCallbacks ) + { + callbackFunc( battery, titan, shieldDifference, addHealth ) + } } if ( battery != null ) @@ -2456,4 +2471,4 @@ bool function ClientCommand_TryNukeGrenade( entity player, array<string> args ) return true } -#endif
\ No newline at end of file +#endif |