Skip to content

Commit

Permalink
Actually better implementation of Music playback
Browse files Browse the repository at this point in the history
  • Loading branch information
Zanieon committed Jul 25, 2024
1 parent bcbcd6c commit 3910c6c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
15 changes: 1 addition & 14 deletions mod/scripts/vscripts/gamemodes/_gamemode_pld.nut
Original file line number Diff line number Diff line change
Expand Up @@ -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 >
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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 ) )
Expand Down Expand Up @@ -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 )
Expand Down
6 changes: 6 additions & 0 deletions mod/scripts/vscripts/gamemodes/cl_gamemode_pld.nut
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ struct {

var harvesterRui
var tutorialTip

bool musicPlaying = false
} file

table< int, bool > tutorialShown
Expand Down Expand Up @@ -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
}


Expand Down

0 comments on commit 3910c6c

Please sign in to comment.