aboutsummaryrefslogtreecommitdiff
path: root/Northstar.CustomServers/mod/scripts/vscripts/rodeo
diff options
context:
space:
mode:
Diffstat (limited to 'Northstar.CustomServers/mod/scripts/vscripts/rodeo')
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/rodeo/_rodeo_titan.gnut17
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 9f05a0cd..0984eaa8 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
@@ -89,6 +90,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
@@ -532,6 +534,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()
@@ -1766,6 +1774,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 )
@@ -1776,6 +1786,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 )
@@ -2453,4 +2468,4 @@ bool function ClientCommand_TryNukeGrenade( entity player, array<string> args )
return true
}
-#endif \ No newline at end of file
+#endif