From 3910c6c0b6aea45e7ad3d1c5575bfd30a0ee808c Mon Sep 17 00:00:00 2001 From: Zanieon Date: Wed, 24 Jul 2024 23:52:13 -0300 Subject: [PATCH] Actually better implementation of Music playback --- mod/scripts/vscripts/gamemodes/_gamemode_pld.nut | 15 +-------------- .../vscripts/gamemodes/cl_gamemode_pld.nut | 6 ++++++ 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/mod/scripts/vscripts/gamemodes/_gamemode_pld.nut b/mod/scripts/vscripts/gamemodes/_gamemode_pld.nut index 7a37fd7..5459b24 100644 --- a/mod/scripts/vscripts/gamemodes/_gamemode_pld.nut +++ b/mod/scripts/vscripts/gamemodes/_gamemode_pld.nut @@ -51,8 +51,6 @@ struct { table< entity, PayloadPlayer > matchPlayers table< entity, array< entity > > checkPoints - array< entity > playerMusicStarted - array< void functionref() > payloadCallbacks vector nukeTitanSpawnSpot = < 0, 0, 0 > @@ -174,10 +172,7 @@ void function StartHarvesterAndPrepareNukeTitan_threaded() MessageToAll( eEventNotifications.TEMP_TitanGreenRoom ) foreach ( player in GetPlayerArray() ) - { Remote_CallFunction_NonReplay( player, "ServerCallback_PLD_PlayBattleMusic" ) - file.playerMusicStarted.append( player ) - } wait 5 @@ -222,12 +217,7 @@ void function TrackPlayerTimeForPushOrHalt( entity player ) while( !IsValid( file.theNukeTitan ) ) // Wait for the Nuke Titan to spawn in WaitFrame() - if( !file.playerMusicStarted.contains( player ) ) - { - file.playerMusicStarted.append( player ) - Remote_CallFunction_NonReplay( player, "ServerCallback_PLD_PlayBattleMusic" ) - } - + Remote_CallFunction_NonReplay( player, "ServerCallback_PLD_PlayBattleMusic" ) Remote_CallFunction_NonReplay( player, "ServerCallback_PLD_ShowTutorialHint", ePLDTutorials.Teams ) while( IsValidPlayer( player ) ) @@ -274,9 +264,6 @@ void function GamemodePLD_PlayerDisconnected( entity player ) { if ( player in file.matchPlayers ) delete file.matchPlayers[player] - - if( file.playerMusicStarted.contains( player ) ) - file.playerMusicStarted.removebyvalue( player ) } void function GamemodePLD_OnPlayerKilled( entity victim, entity attacker, var damageInfo ) diff --git a/mod/scripts/vscripts/gamemodes/cl_gamemode_pld.nut b/mod/scripts/vscripts/gamemodes/cl_gamemode_pld.nut index 8282522..ccd1063 100644 --- a/mod/scripts/vscripts/gamemodes/cl_gamemode_pld.nut +++ b/mod/scripts/vscripts/gamemodes/cl_gamemode_pld.nut @@ -14,6 +14,8 @@ struct { var harvesterRui var tutorialTip + + bool musicPlaying = false } file table< int, bool > tutorialShown @@ -427,8 +429,12 @@ void function PLD_AnnounceCheckpointReached( entity ent, var info ) void function ServerCallback_PLD_PlayBattleMusic() { + if ( file.musicPlaying ) + return + StopMusic() thread ForceLoopMusic_DEPRECATED( eMusicPieceID.GAMEMODE_1 ) + file.musicPlaying = true }