aboutsummaryrefslogtreecommitdiff
path: root/Northstar.CustomServers/mod/scripts/vscripts/evac/_evac.gnut
diff options
context:
space:
mode:
authorBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2022-03-03 20:54:59 +0000
committerBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2022-03-03 20:54:59 +0000
commit81809dfba9a8329f07d68d1fd66133161234effa (patch)
tree94c6571b4be52dbd03435ffee478a41e8c062922 /Northstar.CustomServers/mod/scripts/vscripts/evac/_evac.gnut
parentfd0c66f5c84b7b6c349c3362c3e6df555c393aa5 (diff)
downloadNorthstarMods-81809dfba9a8329f07d68d1fd66133161234effa.tar.gz
NorthstarMods-81809dfba9a8329f07d68d1fd66133161234effa.zip
spectator refactor and private match spectator support
Diffstat (limited to 'Northstar.CustomServers/mod/scripts/vscripts/evac/_evac.gnut')
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/evac/_evac.gnut31
1 files changed, 27 insertions, 4 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/evac/_evac.gnut b/Northstar.CustomServers/mod/scripts/vscripts/evac/_evac.gnut
index 9fe95445f..bce8b4c7f 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/evac/_evac.gnut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/evac/_evac.gnut
@@ -63,6 +63,8 @@ struct {
array<entity> evacNodes
entity spaceNode
+ // this only supports 1 evac at once atm, is this ideal?
+ entity currentEvacNode
entity evacDropship
entity evacIcon
} file
@@ -71,6 +73,7 @@ void function Evac_Init()
{
EvacShared_Init()
RegisterSignal( "EvacShipLeaves" )
+ RegisterSignal( "EvacOver" )
}
void function AddEvacNode( entity evacNode )
@@ -116,7 +119,23 @@ void function EvacEpilogue()
}
}
-void function SetRespawnAndWait(bool mode)
+void function EvacSpectatorFunc( entity player )
+{
+ svGlobal.levelEnt.EndSignal( "GameStateChanged" )
+ file.evacDropship.EndSignal( "OnDestroy" )
+
+ entity cam = GetEnt( expect string( file.currentEvacNode.kv.target ) )
+ if ( !IsValid( cam ) )
+ return
+
+ player.SetObserverModeStaticPosition( cam.GetOrigin() )
+ player.SetObserverModeStaticAngles( cam.GetAngles() )
+ player.StartObserverMode( OBS_MODE_STATIC )
+
+ file.evacDropship.WaitSignal( "EvacOver" )
+}
+
+void function SetRespawnAndWait( bool mode )
{
wait GAME_EPILOGUE_PLAYER_RESPAWN_LEEWAY
SetRespawnsEnabled( mode )
@@ -180,9 +199,11 @@ void function Evac( int evacTeam, float initialWait, float arrivalTime, float wa
if ( !IsValid( file.spaceNode ) )
file.spaceNode = GetEnt( "spaceNode" )
- entity evacNode
+ entity evacNode = customEvacNode
if ( !IsValid( customEvacNode ) )
evacNode = file.evacNodes.getrandom()
+
+ file.currentEvacNode = evacNode
// setup client evac position
file.evacIcon = CreateEntity( "info_target" )
@@ -236,6 +257,7 @@ void function Evac( int evacTeam, float initialWait, float arrivalTime, float wa
})
// flyin
+ Spectator_SetCustomSpectatorFunc( EvacSpectatorFunc )
thread PlayAnim( dropship, "cd_dropship_rescue_side_start", evacNode )
// calculate time until idle start
@@ -247,7 +269,7 @@ void function Evac( int evacTeam, float initialWait, float arrivalTime, float wa
// eta until leave
SetTeamActiveObjective( evacTeam, "EG_DropshipExtract2", Time() + EVAC_WAIT_TIME, file.evacIcon )
- SetTeamActiveObjective( GetOtherTeam( evacTeam ), "EG_StopExtract2", Time() + EVAC_WAIT_TIME, file.evacIcon )
+ SetTeamActiveObjective( GetOtherTeam( evacTeam ), "EG_StopExtract2", Time() + EVAC_WAIT_TIME, file.evacIcon )
// setup evac trigger
entity trigger = CreateEntity( "trigger_cylinder" )
@@ -308,6 +330,7 @@ void function Evac( int evacTeam, float initialWait, float arrivalTime, float wa
dropship.SetOrigin( file.spaceNode.GetOrigin() )
dropship.SetAngles( file.spaceNode.GetAngles() )
dropship.SetInvulnerable()
+ dropship.Signal( "EvacOver" )
thread PlayAnim( dropship, "ds_space_flyby_dropshipA", file.spaceNode )
foreach( entity player in GetPlayerArray() )
@@ -324,7 +347,7 @@ void function Evac( int evacTeam, float initialWait, float arrivalTime, float wa
SetPlayerActiveObjective( player, "EG_DropshipExtractSuccessfulEscape" )
// skybox
- player.SetSkyCamera( GetEnt( "skybox_cam_intro" ) )
+ player.SetSkyCamera( GetEnt( SKYBOXSPACE ) )
Remote_CallFunction_NonReplay( player, "ServerCallback_DisableHudForEvac" )
Remote_CallFunction_NonReplay( player, "ServerCallback_SetClassicSkyScale", dropship.GetEncodedEHandle(), 0.7 )
Remote_CallFunction_NonReplay( player, "ServerCallback_SetMapSettings", 4.0, false, 0.4, 0.125 )