aboutsummaryrefslogtreecommitdiff
path: root/Northstar.Custom
diff options
context:
space:
mode:
authorDBmaoha <56738369+DBmaoha@users.noreply.github.com>2023-02-28 05:58:48 +0800
committerGitHub <noreply@github.com>2023-02-27 22:58:48 +0100
commitafea3530d872f6b50fe6be5a04bbe54c1551aa31 (patch)
treef9ae1ec3c2d5c22ab37392beb30fcec9cec0e781 /Northstar.Custom
parent554761ab629418048e367c7ba1504acd87b5b6e1 (diff)
downloadNorthstarMods-1.12.4.tar.gz
NorthstarMods-1.12.4.zip
* turrets are enabled by default, with some formatting * update indentation * add commentaries for turret highlight
Diffstat (limited to 'Northstar.Custom')
-rw-r--r--Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_fw.nut23
1 files changed, 11 insertions, 12 deletions
diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_fw.nut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_fw.nut
index 7a5b0ee5..b025ff0a 100644
--- a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_fw.nut
+++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_fw.nut
@@ -125,7 +125,7 @@ void function GamemodeFW_Init()
AddCallback_GameStateEnter( eGameState.Playing, OnFWGamePlaying )
AddSpawnCallback( "item_powerup", FWAddPowerUpIcon )
- AddSpawnCallback( "npc_turret_mega", FWTurretHighlight )
+ AddSpawnCallback( "npc_turret_mega", OnFWTurretSpawned )
AddCallback_OnClientConnected( OnFWPlayerConnected )
AddCallback_PlayerClassChanged( OnFWPlayerClassChanged )
@@ -582,9 +582,6 @@ void function LoadEntities()
// create turret, spawn with no team and set it after game starts
entity turret = CreateNPC( "npc_turret_mega", TEAM_UNASSIGNED, info_target.GetOrigin(), info_target.GetAngles() )
SetSpawnOption_AISettings( turret, "npc_turret_mega_fortwar" )
- SetDefaultMPEnemyHighlight( turret ) // for sonar highlights to work
- Highlight_SetFriendlyHighlight( turret, "fw_friendly" )
- AddEntityCallback_OnDamaged( turret, OnMegaTurretDamaged )
DispatchSpawn( turret )
turretsite.turret = turret
@@ -1384,19 +1381,23 @@ void function FWAreaThreatLevelThink_Threaded()
///// TURRET FUNCTIONS /////
////////////////////////////
-void function FWTurretHighlight( entity turret )
+void function OnFWTurretSpawned( entity turret )
{
- thread FWTurretHighlightThink( turret )
+ turret.EnableTurret() // always enabled
+ SetDefaultMPEnemyHighlight( turret ) // for sonar highlights to work
+ AddEntityCallback_OnDamaged( turret, OnMegaTurretDamaged )
+ thread FWTurretHighlightThink( turret )
}
// this will clear turret's highlight upon their death, for notifying players to fix them
void function FWTurretHighlightThink( entity turret )
{
- turret.EndSignal( "OnDestroy" )
- Highlight_SetFriendlyHighlight( turret, "fw_friendly" )
+ turret.EndSignal( "OnDestroy" )
+ WaitFrame() // wait a frame for other turret spawn options to set up
+ Highlight_SetFriendlyHighlight( turret, "fw_friendly" ) // initialize the highlight, they will show upon player's next respawn
- turret.WaitSignal( "OnDeath" )
- Highlight_ClearFriendlyHighlight( turret )
+ turret.WaitSignal( "OnDeath" )
+ Highlight_ClearFriendlyHighlight( turret )
}
// for battery_port, replace the turret with new one
@@ -1407,8 +1408,6 @@ entity function FW_ReplaceMegaTurret( entity perviousTurret )
entity turret = CreateNPC( "npc_turret_mega", perviousTurret.GetTeam(), perviousTurret.GetOrigin(), perviousTurret.GetAngles() )
SetSpawnOption_AISettings( turret, "npc_turret_mega_fortwar" )
- SetDefaultMPEnemyHighlight( turret ) // for sonar highlights to work
- AddEntityCallback_OnDamaged( turret, OnMegaTurretDamaged )
DispatchSpawn( turret )
// apply settings to new turret, must up on date