From 9a96d0bff56f1969c68bb52a2f33296095bdc67d Mon Sep 17 00:00:00 2001 From: BobTheBob <32057864+BobTheBob9@users.noreply.github.com> Date: Tue, 31 Aug 2021 23:14:58 +0100 Subject: move to new mod format --- .../scripts/vscripts/mp/_classic_mp_no_intro.gnut | 80 ++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 Northstar.CustomServers/mod/scripts/vscripts/mp/_classic_mp_no_intro.gnut (limited to 'Northstar.CustomServers/mod/scripts/vscripts/mp/_classic_mp_no_intro.gnut') 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 -- cgit v1.2.3