aboutsummaryrefslogtreecommitdiff
path: root/Northstar.CustomServers
diff options
context:
space:
mode:
authorRoyalBlue1 <malte.hoermeyer@web.de>2022-07-17 03:25:09 +0200
committerRoyalBlue1 <malte.hoermeyer@web.de>2022-07-17 03:25:09 +0200
commitee1644422ea43574aa1b151b75b482a623fe9410 (patch)
treed3a424402f1a97497627b46e16c8c6f0e5fd0655 /Northstar.CustomServers
parent69976de61288fc2a83d531c1ccfd90801f884998 (diff)
downloadNorthstarMods-ee1644422ea43574aa1b151b75b482a623fe9410.tar.gz
NorthstarMods-ee1644422ea43574aa1b151b75b482a623fe9410.zip
Add Revive to Turrets
Diffstat (limited to 'Northstar.CustomServers')
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/ai/_ai_turret.gnut47
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut1
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd_events.nut3
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd_nav.nut8
4 files changed, 59 insertions, 0 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/ai/_ai_turret.gnut b/Northstar.CustomServers/mod/scripts/vscripts/ai/_ai_turret.gnut
index 73813385..9d3aabbc 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/ai/_ai_turret.gnut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/ai/_ai_turret.gnut
@@ -1,7 +1,10 @@
+untyped
global function AiTurret_Init
global function GetMegaTurretLinkedToPanel
global function MegaTurretUsabilityFunc
global function SetUsePromptForPanel
+global function RevivableTurret_DamageCallback
+global function RevivableTurret_Revive
void function AiTurret_Init()
{
@@ -21,4 +24,48 @@ string function MegaTurretUsabilityFunc( var turret, var panel )
void function SetUsePromptForPanel( var panel, var turret )
{
+}
+
+void function RevivableTurret_DamageCallback(entity turret,var damageInfo)
+{
+ if(turret.GetHealth()<DamageInfo_GetDamage(damageInfo))
+ {
+ turret.SetHealth(1)
+ turret.SetUsable()
+ turret.SetUsableByGroup("pilot")
+ turret.SetUsePrompts("#TURRET_WAKEUP_HOLD_USE","#TURRET_WAKEUP_PRESS_USE")
+ turret.useFunction = RevivableTurret_UseFunction
+ thread RevivableTurret_Kill(turret)
+ DamageInfo_SetDamage(damageInfo,0.0)
+ }
+}
+
+function RevivableTurret_UseFunction(player,turret)
+{
+ entity tur = expect entity(turret)
+ thread RevivableTurret_Revive(tur)
+ return true
+}
+
+
+void function RevivableTurret_Revive(entity turret)
+{
+ turret.SetHealth(turret.GetMaxHealth())
+ turret.ClearInvulnerable()
+ turret.Anim_ScriptedPlay( "deploy" )
+ wait 1.0
+ turret.EnableTurret()
+ turret.DisableNPCFlag( NPC_IGNORE_ALL )
+ turret.SetNoTarget( false )
+}
+
+void function RevivableTurret_Kill(entity turret)
+{
+ turret.EnableNPCFlag( NPC_IGNORE_ALL )
+ turret.SetNoTarget( true )
+ turret.SetInvulnerable()
+ turret.Anim_ScriptedPlay( "undeploy" )
+ wait 1
+ turret.SetNoTarget( true )
+ turret.DisableTurret()
} \ No newline at end of file
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut
index aefb556b..068a41f0 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut
@@ -76,6 +76,7 @@ void function GamemodeFD_Init()
AddDamageCallback( "player", DamageScaleByDifficulty )
AddDamageCallback( "npc_titan", DamageScaleByDifficulty )
AddDamageCallback( "npc_turret_sentry", DamageScaleByDifficulty )
+ AddDamageCallback( "npc_turret_sentry",RevivableTurret_DamageCallback)
//Spawn Callbacks
AddSpawnCallback( "npc_titan", HealthScaleByDifficulty )
AddSpawnCallback( "npc_super_spectre", HealthScaleByDifficulty )
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 45e3b296..e5fda467 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd_events.nut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd_events.nut
@@ -84,6 +84,9 @@ void function executeWave()
wait 5 //incase droppod is last event so all npc are spawned
waitUntilLessThanAmountAlive(0)
waitUntilLessThanAmountAlive_expensive(0)
+
+ foreach(entity ent in GetEntArrayByClass_Expensive("npc_turret_sentry"))
+ RevivableTurret_Revive(ent)
}
bool function allEventsExecuted(int waveIndex)
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 9fa04151..06753f78 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd_nav.nut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd_nav.nut
@@ -2,6 +2,7 @@ global function singleNav_thread
global function SquadNav_Thread
global function droneNav_thread
global function getRoute
+global function Dev_MarkRoute
@@ -259,4 +260,11 @@ array<entity> function getRoute(string routeName)
currentNode = currentNode[0].GetLinkEntArray()
}
return ret
+}
+
+void function Dev_MarkRoute(string routename){
+ foreach(entity e in getRoute(routename))
+ {
+ DebugDrawSphere(e.GetOrigin(),30.0,255,0,255,false,40)
+ }
} \ No newline at end of file