diff options
author | zxcPandora <81985226+zxcPandora@users.noreply.github.com> | 2023-02-07 07:13:36 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-07 00:13:36 +0100 |
commit | c8e4d7e79d679747a5f4b3440a72049985d9e7ab (patch) | |
tree | 1131fe645ddccbe6d29a23c03e60590aebcde9f2 /Northstar.CustomServers/mod | |
parent | e8a2e28b59c398821dc0ffb802ec26c385ed5172 (diff) | |
download | NorthstarMods-c8e4d7e79d679747a5f4b3440a72049985d9e7ab.tar.gz NorthstarMods-c8e4d7e79d679747a5f4b3440a72049985d9e7ab.zip |
[FD]New features and fix bug (#548)
* Allow player pick up turret
Allow player pick up turret
* Register Signal
Register Signal
* Update for match vanilla
Update for match vanilla
* Update _ai_turret.gnut
* bug fix
valid player check
* player score event
player score event
* Valid player check
Valid player check
* Update _gamemode_fd.nut
* Update _gamemode_fd.nut
* valid check
* sniper titan enemy check
sniper titan enemy check
* Do a crash protect when wait delay
* change harvester check way to vanilla
* remove temporary fix
* clear invalid turret
* check the player during the animation
* protect dropship from enemy ai before all player dropped
Diffstat (limited to 'Northstar.CustomServers/mod')
6 files changed, 232 insertions, 32 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/ai/_ai_sniper_titans.gnut b/Northstar.CustomServers/mod/scripts/vscripts/ai/_ai_sniper_titans.gnut index c09154f4..b1ff4fa2 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/ai/_ai_sniper_titans.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/ai/_ai_sniper_titans.gnut @@ -179,6 +179,7 @@ function SniperTitanAttack( entity titan, entity target ) return } ) + titan.SetEnemy( target ) } diff --git a/Northstar.CustomServers/mod/scripts/vscripts/ai/_ai_turret.gnut b/Northstar.CustomServers/mod/scripts/vscripts/ai/_ai_turret.gnut index 90f0b4b2..08d76f7d 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/ai/_ai_turret.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/ai/_ai_turret.gnut @@ -3,12 +3,14 @@ global function AiTurret_Init global function GetMegaTurretLinkedToPanel global function MegaTurretUsabilityFunc global function SetUsePromptForPanel +global function IsTurretActive +global function TurretRefundThink global function RevivableTurret_DamageCallback global function RevivableTurret_Revive void function AiTurret_Init() { - + RegisterSignal( "TurretOffline" ) } entity function GetMegaTurretLinkedToPanel( entity panel ) @@ -26,13 +28,63 @@ void function SetUsePromptForPanel( var panel, var turret ) } +bool function IsTurretActive( entity turret ) +{ + // ----- Turret State ----- // + // TURRET_SEARCHING , TURRET_INACTIVE , TURRET_ACTIVE , TURRET_DEPLOYING , TURRET_RETIRING , TURRET_DEAD // + + bool turretsActive = turret.GetTurretState() == TURRET_DEPLOYING + turretsActive = turretsActive || turret.GetTurretState() == TURRET_SEARCHING + turretsActive = turretsActive || turret.GetTurretState() == TURRET_ACTIVE + return turretsActive +} + +void function TurretRefundThink( entity turret ) +{ + turret.EndSignal( "OnDestroy" ) + turret.EndSignal( "OnDeath" ) + turret.EndSignal( "CancelRefund" ) + turret.EndSignal( "TurretOffline" ) + + while( turret.e.burnReward == "" || !IsTurretActive( turret ) ){ + WaitFrame() + } + turret.SetUsable() + turret.SetUsableByGroup( "owner pilot" ) + turret.SetUsePrompts( "#REFUND_HOLD_USE", "#REFUND_PRESS_USE" ) + + entity player = expect entity( turret.WaitSignal( "OnPlayerUse" ).player ) + + if ( turret.e.burnReward == "" ) + return + + BurnMeter_GiveRewardDirect( player, turret.e.burnReward ) + entity weapon = player.GetOffhandWeapon( OFFHAND_INVENTORY ) + + // Defensive: meaning the boost didn't make it to the inventory for some reason + if ( weapon == null ) + return + + weapon.w.savedKillCount = int( turret.kv.killCount ) + turret.DisableTurret() + turret.Signal( "StopTurretLaser" ) + weapon.e.fd_roundDeployed = turret.e.fd_roundDeployed + + EmitSoundAtPosition( TEAM_UNASSIGNED, turret.GetOrigin(), "Emplacement_Move_Dissolve" ) + turret.Signal( "BoostRefunded" ) + turret.UnsetUsable() + turret.SetInvulnerable() + turret.Dissolve( ENTITY_DISSOLVE_CORE, Vector( 0, 0, 0 ), 100 ) +} + void function RevivableTurret_DamageCallback( entity turret, var damageInfo ) { if( turret.GetHealth() <= DamageInfo_GetDamage( damageInfo ) ) { + turret.Signal( "TurretOffline" ) turret.SetHealth( 1 ) turret.SetUsable() - turret.SetUsableByGroup( "pilot" ) + turret.SetUsableByGroup( "friendlies pilot" ) turret.SetUsePrompts( "#TURRET_WAKEUP_HOLD_USE", "#TURRET_WAKEUP_PRESS_USE" ) turret.useFunction = RevivableTurret_UseFunction thread RevivableTurret_Kill( turret ) @@ -48,6 +100,7 @@ function RevivableTurret_UseFunction( player , turret ) if( ent != owner ) { int ownerEHandle = owner.GetEncodedEHandle() + AddPlayerScore( ent, "FDRepairTurret" ) MessageToTeam( TEAM_MILITIA,eEventNotifications.FD_TurretRepair, null, ent, ownerEHandle ) } thread RevivableTurret_Revive( tur ) @@ -57,6 +110,7 @@ function RevivableTurret_UseFunction( player , turret ) void function RevivableTurret_Revive( entity turret ) { + turret.UnsetUsable() turret.SetHealth( turret.GetMaxHealth() ) turret.ClearInvulnerable() turret.Anim_ScriptedPlay( "deploy" ) @@ -64,6 +118,7 @@ void function RevivableTurret_Revive( entity turret ) turret.EnableTurret() turret.DisableNPCFlag( NPC_IGNORE_ALL ) turret.SetNoTarget( false ) + thread TurretRefundThink( turret ) } void function RevivableTurret_Kill( entity turret ) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/ai/_ai_turret_sentry.gnut b/Northstar.CustomServers/mod/scripts/vscripts/ai/_ai_turret_sentry.gnut index e34b3082..5d0cff0a 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/ai/_ai_turret_sentry.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/ai/_ai_turret_sentry.gnut @@ -8,13 +8,14 @@ const SENTRY_TURRET_AIM_FX_BLUE = $"P_wpn_lasercannon_aim_short_blue" void function AiTurretSentry_Init() { PrecacheParticleSystem( DEAD_SENTRY_TURRET_FX ) - //PrecacheParticleSystem( SENTRY_TURRET_AIM_FX_RED ) - //PrecacheParticleSystem( SENTRY_TURRET_AIM_FX_BLUE ) + PrecacheParticleSystem( SENTRY_TURRET_AIM_FX_RED ) + PrecacheParticleSystem( SENTRY_TURRET_AIM_FX_BLUE ) //PrecacheParticleSystem( SENTRY_TURRET_AIM_FX2 ) AddSpawnCallback( "npc_turret_sentry", LightTurretSpawnFunction ) AddDeathCallback( "npc_turret_sentry", LightTurretDeathFX ) + RegisterSignal( "StopTurretLaser" ) //RegisterSignal( "TurretDisabled" ) //RegisterSignal( "HandleTargetDeath" ) //RegisterSignal( "OnPlayerDisconnectResetTurret" ) @@ -55,6 +56,7 @@ void function LightTurretSpawnFunction( entity turret ) void function SentryTurretAimLaser( entity turret ) { + EndSignal( turret, "StopTurretLaser" ) entity fx1 = PlayLoopFXOnEntity( SENTRY_TURRET_AIM_FX_RED, turret, "camera_glow", null, null, ENTITY_VISIBLE_TO_ENEMY ) entity fx2 = PlayLoopFXOnEntity( SENTRY_TURRET_AIM_FX_BLUE, turret, "camera_glow", null, null, ENTITY_VISIBLE_TO_FRIENDLY ) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut index 2ea75d0a..a730eb90 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut @@ -3,6 +3,7 @@ untyped global function GamemodeFD_Init global function RateSpawnpoints_FD global function startHarvester +global function IsHarvesterAlive global function GetTargetNameForID global function DisableTitanSelection @@ -136,6 +137,7 @@ void function GamemodeFD_Init() AddCallback_GameStateEnter( eGameState.Playing, startMainGameLoop ) AddCallback_OnRoundEndCleanup( FD_NPCCleanup ) AddCallback_OnClientConnected( GamemodeFD_InitPlayer ) + AddCallback_OnClientDisconnected( OnPlayerDisconnectedOrDestroyed ) AddCallback_OnPlayerGetsNewPilotLoadout( FD_OnPlayerGetsNewPilotLoadout ) ClassicMP_SetEpilogue( FD_SetupEpilogue ) @@ -171,6 +173,13 @@ void function GamemodeFD_Init() AddBatteryHealCallback( FD_BatteryHealTeammate ) AddSmokeHealCallback( FD_SmokeHealTeammate ) SetUsedCoreCallback( FD_UsedCoreCallback ) + + //todo:are pointValueOverride exist? + //Score Event + AddArcTrapTriggeredCallback( FD_OnArcTrapTriggered ) + AddArcWaveDamageCallback( FD_OnArcWaveDamage ) + AddOnTetherCallback( FD_OnTetherTrapTriggered ) + AddSonarStartCallback( FD_OnSonarStart ) } // this might need updating when we do dropship things @@ -335,6 +344,17 @@ void function GamemodeFD_InitPlayer( entity player ) void function TrackDeployedArcTrapThisRound( entity player ) { player.EndSignal( "OnDestroy" ) + + OnThreadEnd( + function() : ( player ) + { + if ( IsValid( player ) ) + OnPlayerDisconnectedOrDestroyed( player ) + else + ClearInValidTurret() + } + ) + while( IsValid( player ) ) { entity ArcTrap = expect entity ( player.WaitSignal( "DeployArcTrap" ).projectile ) @@ -345,6 +365,18 @@ void function TrackDeployedArcTrapThisRound( entity player ) void function TryDisableTitanSelectionForPlayerAfterDelay( entity player, float waitAmount ) { + player.EndSignal( "OnDestroy" )//Do a crash protect when wait delay + + OnThreadEnd( + function() : ( player ) + { + if( IsValid( player ) ) + { + DisableTitanSelectionForPlayer( player ) + } + } + ) + wait waitAmount if ( file.playersHaveTitans ) DisableTitanSelectionForPlayer( player ) @@ -372,9 +404,9 @@ void function OnTickDeath( entity victim, var damageInfo ) void function OnNpcDeath( entity victim, entity attacker, var damageInfo ) { - if( attacker.GetClassName() == "npc_turret_sentry" ) + if( attacker.GetClassName() == "npc_turret_sentry" && IsValidPlayer( attacker.GetBossPlayer() ) ) { - file.playerAwardStats[attacker.GetBossPlayer()]["turretKills"]++ + file.playerAwardStats[ attacker.GetBossPlayer() ]["turretKills"]++ } if( victim.IsTitan() && attacker in file.players ) file.playerAwardStats[attacker]["titanKills"]++ @@ -461,6 +493,7 @@ bool function useShieldBoost( entity player, array<string> args ) { fd_harvester.harvester.SetShieldHealth( fd_harvester.harvester.GetShieldHealthMax() ) SetGlobalNetTime( "FD_harvesterInvulTime", Time() + 5 ) + AddPlayerScore( player, "FDShieldHarvester" ) MessageToTeam( TEAM_MILITIA,eEventNotifications.FD_PlayerBoostedHarvesterShield, null, player ) player.SetPlayerNetInt( "numHarvesterShieldBoost", player.GetPlayerNetInt( "numHarvesterShieldBoost" ) - 1 ) file.playerAwardStats[player]["harvesterHeals"]++ @@ -679,7 +712,7 @@ bool function runWave( int waveIndex, bool shouldDoBuyTime ) file.players[player].diedThisRound = false file.players[player].scoreThisRound = 0 file.players[player].moneyThisRound = GetPlayerMoney( player ) - file.players[ player ].deployedEntityThisRound = [] + file.players[ player ].deployedEntityThisRound.clear() } array<int> enemys = getHighestEnemyAmountsForWave( waveIndex ) @@ -728,7 +761,7 @@ bool function runWave( int waveIndex, bool shouldDoBuyTime ) thread SetWaveStateReady() executeWave() SetGlobalNetInt( "FD_waveState", WAVE_STATE_COMPLETE ) - if( !IsAlive( fd_harvester.harvester ) ) + if( !IsHarvesterAlive( fd_harvester.harvester ) ) { float totalDamage = 0.0 array<float> highestDamage = [ 0.0, 0.0, 0.0 ] @@ -785,7 +818,7 @@ bool function runWave( int waveIndex, bool shouldDoBuyTime ) SetGlobalNetBool( "FD_waveActive", false ) MessageToTeam( TEAM_MILITIA, eEventNotifications.FD_AnnounceWaveEnd ) - if ( isFinalWave() && IsAlive( fd_harvester.harvester ) ) + if ( isFinalWave() && IsHarvesterAlive( fd_harvester.harvester ) ) { //Game won code MessageToTeam( TEAM_MILITIA, eEventNotifications.FD_AnnounceWaveEnd ) @@ -977,6 +1010,7 @@ void function FD_BatteryHealTeammate( entity battery, entity titan, int shieldRe return if( IsValid( BatteryParent ) && BatteryParent in file.players ){ + AddPlayerScore( BatteryParent, "FDTeamHeal" ) currentHeal = shieldRestoreAmount + healthRestoreAmount currentHealScore = currentHeal / 100 file.playerAwardStats[BatteryParent]["heals"] += float( currentHeal ) @@ -985,6 +1019,42 @@ void function FD_BatteryHealTeammate( entity battery, entity titan, int shieldRe } } +void function FD_OnArcTrapTriggered( entity victim, var damageInfo ) +{ + entity owner = DamageInfo_GetAttacker( damageInfo ) + + if( !IsValidPlayer( owner ) ) + return + + AddPlayerScore( owner, "FDArcTrapTriggered" ) +} + +void function FD_OnArcWaveDamage( entity ent, var damageInfo ) +{ + entity attacker = DamageInfo_GetAttacker( damageInfo ) + + if( !IsValidPlayer( attacker ) ) + return + + AddPlayerScore( attacker, "FDArcWave" ) +} + +void function FD_OnTetherTrapTriggered( entity owner, entity endEnt ) +{ + if( !IsValidPlayer( owner ) ) + return + + AddPlayerScore( owner, "FDTetherTriggered" ) +} + +void function FD_OnSonarStart( entity ent, vector position, int sonarTeam, entity sonarOwner ) +{ + if( !IsValidPlayer( sonarOwner ) ) + return + + AddPlayerScore( sonarOwner, "FDSonarPulse" )//should only triggered once during sonar time? +} + void function FD_SetupEpilogue() { AddCallback_GameStateEnter( eGameState.Epilogue, FD_Epilogue ) @@ -1049,6 +1119,9 @@ void function FD_Epilogue_threaded() foreach( entity player in GetPlayerArray() ) { + if( !IsValid( player ) ) + continue + int i = 0 myIndex = player.GetPlayerIndex() @@ -1059,10 +1132,16 @@ void function FD_Epilogue_threaded() foreach( entity medalPlayer, string ref in awardResults ) { + if( !IsValid( medalPlayer ) ) + continue + if( i == numPlayers ) - break; + break int targetIndex = medalPlayer.GetPlayerIndex() + if( targetIndex >= 4 ) + continue + string name = medalPlayer.GetPlayerName() string xuid = medalPlayer.GetUID() int awardId = GetFDStatData( ref ).index @@ -1184,7 +1263,9 @@ void function OnHarvesterDamaged( entity harvester, var damageInfo ) if( newHealth <= 0 ) { EmitSoundAtPosition( TEAM_UNASSIGNED, fd_harvester.harvester.GetOrigin(), "coop_generator_destroyed" ) - newHealth = 0 + newHealth = 1 + harvester.SetInvulnerable() + DamageInfo_SetDamage( damageInfo, 0.0 ) PlayFactionDialogueToTeam( "fd_baseDeath", TEAM_MILITIA ) fd_harvester.rings.Anim_Stop() } @@ -1218,6 +1299,8 @@ void function FD_NPCCleanup() if ( IsValid( npc ) ) npc.Destroy() } + if( IsValid( fd_harvester.harvester ) ) + fd_harvester.harvester.Destroy()//Destroy harvester after match over } void function HarvesterThink() @@ -1237,7 +1320,7 @@ void function HarvesterThink() bool isRegening = false // stops the regenning sound to keep stacking on top of each other - while ( IsAlive( harvester ) ) + while ( IsHarvesterAlive( harvester ) ) { float currentTime = Time() float deltaTime = currentTime -lastTime @@ -1317,7 +1400,7 @@ void function startHarvester() void function HarvesterAlarm() { - while( IsAlive( fd_harvester.harvester ) ) + while( IsHarvesterAlive( fd_harvester.harvester ) ) { if( fd_harvester.harvester.GetShieldHealth() == 0 ) { @@ -1436,6 +1519,18 @@ void function FD_createHarvester() thread CreateHarvesterHintTrigger( fd_harvester.harvester ) } +bool function IsHarvesterAlive( entity harvester ) +{ + if ( harvester == null ) + return false + if ( !harvester.IsValidInternal() ) + return false + if( !harvester.IsEntAlive() ) + return false + + return harvester.GetHealth() > 1 +} + void function CreateHarvesterHintTrigger( entity harvester ) { entity trig = CreateEntity( "trigger_cylinder" ) @@ -1734,6 +1829,7 @@ void function AddTurretSentry( entity turret ) entity player = turret.GetBossPlayer() file.players[ player ].deployedEntityThisRound.append( turret ) AddEntityDestroyedCallback( turret, FD_OnEntityDestroyed ) + thread TurretRefundThink( turret ) } function FD_OnEntityDestroyed( ent ) @@ -1742,10 +1838,41 @@ function FD_OnEntityDestroyed( ent ) Assert( ent.IsValidInternal() ) entity player = IsTurret( ent ) ? ent.GetBossPlayer() : ent.GetOwner() + + if( !IsValid( player ) ) + return + if( file.players[ player ].deployedEntityThisRound.contains( ent ) ) file.players[ player ].deployedEntityThisRound.fastremovebyvalue( ent ) } +void function OnPlayerDisconnectedOrDestroyed( entity player ) +{ + if( !IsValid( player ) ) + { + ClearInValidTurret() + return + } + + foreach ( entity npc in GetEntArrayByClass_Expensive( "C_AI_BaseNPC" ) ) + { + entity BossPlayer = npc.GetBossPlayer() + if ( IsValidPlayer( BossPlayer ) && IsValid( npc ) && player == BossPlayer ) + npc.Destroy() + } + file.players[ player ].deployedEntityThisRound.clear() +} + +void function ClearInValidTurret() +{ + foreach( entity turret in GetNPCArrayByClass( "npc_turret_sentry" ) ) + { + entity BossPlayer = turret.GetBossPlayer() + if ( !IsValidPlayer( BossPlayer ) && IsValid( turret ) ) + turret.Destroy() + } +} + void function DisableTitanSelection() { foreach ( entity player in GetPlayerArray() ) @@ -1764,7 +1891,11 @@ void function EnableTitanSelection() void function EnableTitanSelectionForPlayer( entity player ) { - int enumCount = PersistenceGetEnumCount( "titanClasses" ) + int enumCount = PersistenceGetEnumCount( "titanClasses" ) + + if( !IsValid( player ) ) + return + for ( int i = 0; i < enumCount; i++ ) { string enumName = PersistenceGetEnumItemNameForIndex( "titanClasses", i ) @@ -1776,7 +1907,11 @@ void function EnableTitanSelectionForPlayer( entity player ) void function DisableTitanSelectionForPlayer( entity player ) { - int enumCount = PersistenceGetEnumCount( "titanClasses" ) + int enumCount = PersistenceGetEnumCount( "titanClasses" ) + + if( !IsValid( player ) ) + return + for ( int i = 0; i < enumCount; i++ ) { string enumName = PersistenceGetEnumItemNameForIndex( "titanClasses", i ) @@ -1801,6 +1936,8 @@ void function FD_DropshipSpawnDropship() DispatchSpawn( file.dropship ) file.dropship.SetModel( $"models/vehicle/crow_dropship/crow_dropship_hero.mdl" ) + file.dropship.SetInvulnerable() + file.dropship.SetNoTarget( true ) thread PlayAnim(file.dropship, FD_DropshipGetAnimation()) @@ -1830,10 +1967,15 @@ void function FD_DropshipDropPlayer(entity player,int playerDropshipIndex) jumpSequence.viewConeFunction = ViewConeFree thread FirstPersonSequence( jumpSequence, player, file.dropship ) - WaittillAnimDone( player ) - player.ClearParent() - ClearPlayerAnimViewEntity( player ) - player.ClearInvulnerable() + + //check the player + if( IsValid( player ) ) + { + WaittillAnimDone( player ) + player.ClearParent() + ClearPlayerAnimViewEntity( player ) + player.ClearInvulnerable() + } } void function FD_DropshipSetAnimationOverride(string animation) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd_events.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd_events.nut index 16260fd5..e73b73c5 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd_events.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd_events.nut @@ -89,7 +89,7 @@ void function executeWave() { print( "executeWave Start" ) thread runEvents( 0 ) - while( IsAlive( fd_harvester.harvester ) && ( !allEventsExecuted( GetGlobalNetInt( "FD_currentWave" ) ) ) ) + while( IsHarvesterAlive( fd_harvester.harvester ) && ( !allEventsExecuted( GetGlobalNetInt( "FD_currentWave" ) ) ) ) WaitFrame() wait 5 //incase droppod is last event so all npc are spawned waitUntilLessThanAmountAlive( 0 ) @@ -122,7 +122,7 @@ void function runEvents( int firstExecuteIndex ) print( "not on this call" ) return } - if( !IsAlive(fd_harvester.harvester ) ) + if( !IsHarvesterAlive(fd_harvester.harvester ) ) { print( "harvesterDead" ) return @@ -654,7 +654,7 @@ void function spawnDrones( SmokeEvent smokeEvent, SpawnEvent spawnEvent, FlowCon void function waitForDeathOfEntitys( SmokeEvent smokeEvent, SpawnEvent spawnEvent, FlowControlEvent flowControlEvent, SoundEvent soundEvent ) { - while( IsAlive( fd_harvester.harvester ) ) + while( IsHarvesterAlive( fd_harvester.harvester ) ) { bool anyoneAlive = false foreach( string key in flowControlEvent.waitGlobalDataKey ) @@ -671,7 +671,7 @@ void function waitForDeathOfEntitys( SmokeEvent smokeEvent, SpawnEvent spawnEven void function waitForLessThanAliveTyped( SmokeEvent smokeEvent, SpawnEvent spawnEvent, FlowControlEvent flowControlEvent, SoundEvent soundEvent ) { - while( IsAlive( fd_harvester.harvester ) ) + while( IsHarvesterAlive( fd_harvester.harvester ) ) { int amount foreach( entity npc in spawnedNPCs ) @@ -711,7 +711,7 @@ void function waitForTime( SmokeEvent smokeEvent, SpawnEvent spawnEvent, FlowCon float waitUntil = Time() + flowControlEvent.waitTime while( Time() < waitUntil ) { - if( !IsAlive( fd_harvester.harvester ) ) + if( !IsHarvesterAlive( fd_harvester.harvester ) ) return WaitFrame() } @@ -1219,7 +1219,7 @@ void function waitUntilLessThanAmountAlive( int amount ) } aliveNPCs = spawnedNPCs.len() - deduct - if( !IsAlive( fd_harvester.harvester ) ) + if( !IsHarvesterAlive( fd_harvester.harvester ) ) return } } @@ -1268,7 +1268,7 @@ void function waitUntilLessThanAmountAliveWeighted( int amount, int humanWeight else aliveNPCsWeighted += humanWeight } - if( !IsAlive( fd_harvester.harvester ) ) + if( !IsHarvesterAlive( fd_harvester.harvester ) ) return } } @@ -1313,7 +1313,7 @@ void function waitUntilLessThanAmountAlive_expensive( int amount ) } } aliveTitans = GetNPCArray().len() - deduct - if( !IsAlive( fd_harvester.harvester ) ) + if( !IsHarvesterAlive( fd_harvester.harvester ) ) return } } diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd_nav.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd_nav.nut index cf7827f7..1948ac6b 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd_nav.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd_nav.nut @@ -30,7 +30,7 @@ void function singleNav_thread( entity npc, string routeName, int nodesToSkip= 0 int skippedNodes = 0 foreach(entity node in routeArray) { - if(!IsAlive(fd_harvester.harvester)) + if(!IsHarvesterAlive(fd_harvester.harvester)) return if(skippedNodes < nodesToSkip) { @@ -78,7 +78,7 @@ void function singleNav_thread( entity npc, string routeName, int nodesToSkip= 0 while ( targetNode != null ) { - if( !IsAlive( fd_harvester.harvester ) ) + if( !IsHarvesterAlive( fd_harvester.harvester ) ) return npc.AssaultPoint( targetNode.GetOrigin() ) npc.AssaultSetGoalRadius( nextDistance ) @@ -104,7 +104,7 @@ void function SquadNav_Thread( array<entity> npcs, string routeName, int nodesTo int nodeIndex = 0 foreach(entity node in routeArray) { - if(!IsAlive(fd_harvester.harvester)) + if(!IsHarvesterAlive(fd_harvester.harvester)) return if(nodeIndex++ < nodesToSkip) continue @@ -144,7 +144,7 @@ void function SquadNav_Thread( array<entity> npcs, string routeName, int nodesTo while ( targetNode != null ) { - if( !IsAlive( fd_harvester.harvester ) ) + if( !IsHarvesterAlive( fd_harvester.harvester ) ) return SquadAssaultOrigin( npcs, targetNode.GetOrigin(), nextDistance ) @@ -199,7 +199,7 @@ void function droneNav_thread( entity npc, string routeName,int nodesToSkip= 0,f while ( targetNode != null ) { - if( !IsAlive( fd_harvester.harvester ) ) + if( !IsHarvesterAlive( fd_harvester.harvester ) ) return npc.AssaultPoint( targetNode.GetOrigin() + <0, 0, 300> ) npc.AssaultSetGoalRadius( nextDistance ) |