diff options
author | RoyalBlue1 <realEmail@veryRealURL.com> | 2022-10-23 20:23:40 +0200 |
---|---|---|
committer | RoyalBlue1 <realEmail@veryRealURL.com> | 2022-10-23 20:23:40 +0200 |
commit | 3e83c53b44ea0cd04fa6cfcd645ca4569e19e808 (patch) | |
tree | a09a03cf7d346bf9fd832f9efc5c9f928b40af3d /Northstar.CustomServers/mod | |
parent | a15ff4c0ab513d478cdee2cdf3a1de661701e183 (diff) | |
download | NorthstarMods-3e83c53b44ea0cd04fa6cfcd645ca4569e19e808.tar.gz NorthstarMods-3e83c53b44ea0cd04fa6cfcd645ca4569e19e808.zip |
Set end game awards as epilogue
Diffstat (limited to 'Northstar.CustomServers/mod')
-rw-r--r-- | Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut | 24 | ||||
-rw-r--r-- | Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut | 17 |
2 files changed, 22 insertions, 19 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut index a07ffcf4..4af82c8b 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut @@ -129,7 +129,7 @@ void function GamemodeFD_Init() AddCallback_OnRoundEndCleanup( FD_NPCCleanup ) AddCallback_OnClientConnected( GamemodeFD_InitPlayer ) AddCallback_OnPlayerGetsNewPilotLoadout( FD_OnPlayerGetsNewPilotLoadout ) - SetCallback_RunPostmatch(gameWonMedals) + ClassicMP_SetEpilogue(FD_SetupEpilogue) //Damage Callbacks AddDamageByCallback( "player", FD_DamageByPlayerCallback) @@ -876,13 +876,26 @@ void function SetWaveStateReady() SetGlobalNetInt( "FD_waveState", WAVE_STATE_IN_PROGRESS ) } -void function gameWonMedals() +void function FD_SetupEpilogue() +{ + AddCallback_GameStateEnter( eGameState.Epilogue, FD_Epilogue ) +} + +void function FD_Epilogue() +{ + thread FD_Epilogue_threaded() +} + +void function FD_Epilogue_threaded() { table<string,entity> awardOwners table<string,float> awardValues - + wait 5 foreach(entity player in GetPlayerArray() ) { + player.FreezeControlsOnServer() + ScreenFadeToBlackForever( player, 6.0 ) + foreach( string ref in GetFDStatRefs() ) { if( !( ref in awardOwners ) ) @@ -927,6 +940,7 @@ void function gameWonMedals() } Remote_CallFunction_NonReplay( player, "ServerCallback_ShowGameStats", Time() + 25 )//TODO set correct endTime } + /* //debugging prints foreach( entity player, table< string, float > data in file.playerAwardStats) { printt("Stats for", player) @@ -939,7 +953,9 @@ void function gameWonMedals() { printt( player, ref, awardValues[ref] ) } - wait 25 + */ + wait 20 + SetGameState(eGameState.Postmatch) } void function IncrementPlayerstat_TurretRevives( entity player ) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut index 0732e131..6cde4655 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut @@ -24,8 +24,6 @@ global function ShouldRunEvac global function GiveTitanToPlayer global function GetTimeLimit_ForGameMode -global function SetCallback_RunPostmatch - struct { // used for togglable parts of gamestate bool usePickLoadoutScreen @@ -55,7 +53,6 @@ struct { float roundWinningKillReplayHealthFrac array<void functionref()> roundEndCleanupCallbacks - void functionref() postMatchCallback } file void function PIN_GameStart() @@ -84,8 +81,6 @@ void function PIN_GameStart() AddDeathCallback( "npc_titan", OnTitanKilled ) RegisterSignal( "CleanUpEntitiesForRoundEnd" ) - - } void function SetGameState( int newState ) @@ -435,7 +430,7 @@ void function GameStateEnter_SwitchingSides_Threaded() entity replayAttacker = file.roundWinningKillReplayAttacker bool doReplay = Replay_IsEnabled() && IsRoundWinningKillReplayEnabled() && IsValid( replayAttacker ) && !IsRoundBased() // for roundbased modes, we've already done the replay - && Time() - file.roundWinningKillReplayTime <= SWITCHING_SIDES_DELAY + && Time() - file.roundWinningKillReplayTime <= SWITCHING_SIDES_DELAY float replayLength = SWITCHING_SIDES_DELAY_REPLAY // extra delay if no replay if ( doReplay ) @@ -529,17 +524,9 @@ void function GameStateEnter_Postmatch() thread GameStateEnter_Postmatch_Threaded() } -void function SetCallback_RunPostmatch(void functionref() callback) -{ - file.postMatchCallback = callback -} - void function GameStateEnter_Postmatch_Threaded() { - if( file.postMatchCallback == null) - wait GAME_POSTMATCH_LENGTH - else - waitthread file.postMatchCallback() + wait GAME_POSTMATCH_LENGTH GameRules_EndMatch() } |