aboutsummaryrefslogtreecommitdiff
path: root/Northstar.CustomServers/mod/scripts/vscripts/mp/_classic_mp_no_intro.gnut
diff options
context:
space:
mode:
Diffstat (limited to 'Northstar.CustomServers/mod/scripts/vscripts/mp/_classic_mp_no_intro.gnut')
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/mp/_classic_mp_no_intro.gnut80
1 files changed, 80 insertions, 0 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_classic_mp_no_intro.gnut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_classic_mp_no_intro.gnut
new file mode 100644
index 000000000..106f867b1
--- /dev/null
+++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_classic_mp_no_intro.gnut
@@ -0,0 +1,80 @@
+untyped
+
+global function ClassicMP_DefaultNoIntro_Setup
+global function ClassicMP_DefaultNoIntro_GetLength
+
+global const float NOINTRO_INTRO_PILOT_LENGTH = 10.0
+global const float TITAN_DROP_SPAWN_INTRO_LENGTH = 0.0 // this intro shouldn't have a countdown visually, so we have to set the length of this intro to 0
+global const float TITAN_DROP_SPAWN_INTRO_REAL_LENGTH = 2.0 // we wait roughly this long during the intro, even when it's technically over
+
+void function ClassicMP_DefaultNoIntro_Setup()
+{
+ AddCallback_OnClientConnected( ClassicMP_DefaultNoIntro_SpawnPlayer )
+ AddCallback_GameStateEnter( eGameState.Prematch, ClassicMP_DefaultNoIntro_Start )
+}
+
+float function ClassicMP_DefaultNoIntro_GetLength()
+{
+ if ( ShouldIntroSpawnAsTitan() )
+ return TITAN_DROP_SPAWN_INTRO_LENGTH
+ else
+ return NOINTRO_INTRO_PILOT_LENGTH
+
+ unreachable
+}
+
+void function ClassicMP_DefaultNoIntro_Start()
+{
+ ClassicMP_OnIntroStarted()
+
+ foreach ( entity player in GetPlayerArray() )
+ ClassicMP_DefaultNoIntro_SpawnPlayer( player )
+
+ if ( ShouldIntroSpawnAsTitan() )
+ wait TITAN_DROP_SPAWN_INTRO_REAL_LENGTH
+ else
+ {
+ wait NOINTRO_INTRO_PILOT_LENGTH
+
+ foreach ( entity player in GetPlayerArray() )
+ {
+ player.UnfreezeControlsOnServer()
+ RemoveCinematicFlag( player, CE_FLAG_CLASSIC_MP_SPAWNING )
+ TryGameModeAnnouncement( player )
+ }
+ }
+
+ ClassicMP_OnIntroFinished()
+}
+
+void function ClassicMP_DefaultNoIntro_SpawnPlayer( entity player )
+{
+ if ( GetGameState() != eGameState.Prematch )
+ return
+
+ if ( IsAlive( player ) )
+ player.Die()
+
+ if ( ShouldIntroSpawnAsTitan() )
+ thread ClassicMP_DefaultNoIntro_TitanSpawnPlayer( player )
+ else
+ thread ClassicMP_DefaultNoIntro_PilotSpawnPlayer( player )
+}
+
+
+// spawn as pilot for intro
+void function ClassicMP_DefaultNoIntro_PilotSpawnPlayer( entity player )
+{
+ RespawnAsPilot( player )
+ player.FreezeControlsOnServer()
+ AddCinematicFlag( player, CE_FLAG_CLASSIC_MP_SPAWNING )
+ ScreenFadeFromBlack( player, 0.5, 0.5 )
+}
+
+// spawn as titan for intro
+void function ClassicMP_DefaultNoIntro_TitanSpawnPlayer( entity player )
+{
+ // blocking call
+ RespawnAsTitan( player, false )
+ TryGameModeAnnouncement( player )
+} \ No newline at end of file