diff options
Diffstat (limited to 'Northstar.CustomServers/mod/scripts/vscripts/titan')
4 files changed, 46 insertions, 4 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/titan/_replacement_titans.gnut b/Northstar.CustomServers/mod/scripts/vscripts/titan/_replacement_titans.gnut index c9d986bc..57361362 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/titan/_replacement_titans.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/titan/_replacement_titans.gnut @@ -21,7 +21,6 @@ global function ReplacementTitan global function TryAnnounceTitanfallWarningToEnemyTeam global function GetTitanForPlayer - global function ShouldSetTitanRespawnTimer global function PauseTitanTimers @@ -33,6 +32,7 @@ global function SetReplacementTitanGamemodeRules global function SetRequestTitanGamemodeRules global function CreateTitanForPlayerAndHotdrop +global function SetRequestTitanAllowedCallback struct { array<int> ETATimeThresholds = [ 120, 60, 30, 15 ] @@ -53,6 +53,8 @@ struct { bool functionref( entity ) ReplacementTitanGamemodeRules bool functionref( entity, vector ) RequestTitanGamemodeRules + bool functionref( entity player, array< string > args ) RequestTitanAllowedCallback + } file const nagInterval = 40 @@ -87,6 +89,10 @@ function ReplacementTitans_Init() FlagInit( "LevelHasRoof" ) } +void function SetRequestTitanAllowedCallback( bool functionref( entity player, array<string> args ) RequestTitanAllowedCallback ) +{ + file.RequestTitanAllowedCallback = RequestTitanAllowedCallback +} void function ReplacementTitan_InitPlayer( entity player ) { @@ -424,6 +430,7 @@ function TryETATitanReadyAnnouncement( entity player ) TryReplacementTitanReadyAnnouncement( player ) return } + //This entire loop is probably too complicated now for what it's doing. Simplify next game! //Loop might be pretty hard to read, a particular iteration of the loop is written in comments below @@ -524,6 +531,9 @@ function req() bool function ClientCommand_RequestTitan( entity player, array<string> args ) { + if( file.RequestTitanAllowedCallback != null && !file.RequestTitanAllowedCallback( player, args ) ) + return true + ReplacementTitan( player ) //Separate function because other functions will call ReplacementTitan return true } @@ -877,6 +887,20 @@ void function CreateTitanForPlayerAndHotdrop( entity player, Point spawnPoint, T player.Signal( "titan_impact" ) thread TitanNPC_WaitForBubbleShield_StartAutoTitanBehavior( titan ) + thread PlayerEarnMeter_ReplacementTitanThink( player, titan ) +} + +void function PlayerEarnMeter_ReplacementTitanThink( entity player, entity titan ) +{ + player.EndSignal( "OnDestroy" ) + OnThreadEnd( + function(): ( player ) + { + if( IsValid( player ) ) + PlayerEarnMeter_Reset( player ) + } + ) + titan.WaitSignal( "OnDestroy" ) } void function CleanupTitanFallDisablingEntity( entity titanFallDisablingEntity, entity titan ) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/titan/_replacement_titans_drop.gnut b/Northstar.CustomServers/mod/scripts/vscripts/titan/_replacement_titans_drop.gnut index 933e9988..6972d5ff 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/titan/_replacement_titans_drop.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/titan/_replacement_titans_drop.gnut @@ -4,6 +4,7 @@ global function HullTraceDropPoint global function DebugTitanfall global function TitanFindDropNodes global function TitanHulldropSpawnpoint +global function SetRecalculateTitanReplacementPointCallback global const TITANDROP_LOS_DIST = 2000 // 2D distance at which we do the line of sight check to see where the player wants to call in the titan global const TITANDROP_MIN_FOV = 10 @@ -19,8 +20,15 @@ global const TITANDROP_FALLBACK_DIST = 150 // if the ground search hits, we go t struct { int replacementSpawnpointsID + Point functionref(Point originalPoint, entity player) recalculateTitanReplacementPointCallback } file + +void function SetRecalculateTitanReplacementPointCallback(Point functionref(Point originalPoint, entity player) recalculateTitanReplacementPointCallback) +{ + file.recalculateTitanReplacementPointCallback = recalculateTitanReplacementPointCallback +} + void function ReplacementTitansDrop_Init() { AddSpawnCallback( "info_spawnpoint_titan", AddDroppoint ) @@ -117,7 +125,10 @@ Point function GetTitanReplacementPoint( entity player, bool forDebugging = fals vector playerEyeAngles = player.EyeAngles() vector playerOrg = player.GetOrigin() - return CalculateTitanReplacementPoint( playerOrg, playerEyePos, playerEyeAngles, forDebugging ) + Point tempPoint = CalculateTitanReplacementPoint( playerOrg, playerEyePos, playerEyeAngles, forDebugging) + if( file.recalculateTitanReplacementPointCallback != null ) + tempPoint = file.recalculateTitanReplacementPointCallback( tempPoint, player ) + return tempPoint } Point function CalculateTitanReplacementPoint( vector playerOrg, vector playerEyePos, vector playerEyeAngles, bool forDebugging = false ) @@ -165,6 +176,7 @@ Point function CalculateTitanReplacementPoint( vector playerOrg, vector playerEy Point point point.origin = dropPoint point.angles = yawAngles + return point } } @@ -215,7 +227,8 @@ Point function CalculateTitanReplacementPoint( vector playerOrg, vector playerEy Point point point.origin = nodeOrigin point.angles = Vector( 0, yaw, 0 ) - return point + + return point } vector function GetPathNodeSearchPosWithLookPos( vector playerOrg, vector playerEyePos, vector playerEyeForward, vector playerLookPos, bool debug ) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/titan/_titan_health.gnut b/Northstar.CustomServers/mod/scripts/vscripts/titan/_titan_health.gnut index d600cb03..396d5624 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/titan/_titan_health.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/titan/_titan_health.gnut @@ -1010,7 +1010,7 @@ void function AddCreditToTitanCoreBuilder( entity titan, float credit ) if ( IsValid( bossPlayer ) && !coreWasAvailable && IsCoreChargeAvailable( bossPlayer, soul ) ) { - AddPlayerScore( bossPlayer, "TitanCoreEarned" ) + AddPlayerScore( bossPlayer, "TitanCoreEarned", bossPlayer ) // this will show the "Core Earned" callsign event #if MP UpdateTitanCoreEarnedStat( bossPlayer, titan ) PIN_PlayerAbilityReady( bossPlayer, "core" ) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/titan/class_titan.gnut b/Northstar.CustomServers/mod/scripts/vscripts/titan/class_titan.gnut index 5f72385e..d0a2d5e4 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/titan/class_titan.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/titan/class_titan.gnut @@ -68,6 +68,11 @@ bool function ClientCommand_TitanEject( entity player, array<string> args ) if ( !PlayerCanEject( player ) ) return true + // check array length before accessing index to avoid oob access + // prevents crashing a server by just calling `TitanEject` without arguments + if( args.len() < 1 ) + return true + int ejectPressCount = args[ 0 ].tointeger() if ( ejectPressCount < 3 ) return true |