diff options
author | William Miller <william-millennium@hotmail.com> | 2024-09-07 17:31:16 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-07 22:31:16 +0200 |
commit | 62b92155adc962fce83206c5de9aa210023e14da (patch) | |
tree | 57e365e6552f35a1fc5799d9779aea3e27d60545 | |
parent | 6b839def7fa1aff2519dccb7cf7d9dcee661a6ef (diff) | |
download | NorthstarMods-62b92155adc962fce83206c5de9aa210023e14da.tar.gz NorthstarMods-62b92155adc962fce83206c5de9aa210023e14da.zip |
Expose more game state information to DiscordRPC (#869)v1.28.0-rc3
When playing Frontier Defense it will show when the player is in a Wave Break or which Wave they are currently through
Whenever the server is NOT at the Playing gamestate, the plugin will report the respective states instead such as Selecting Titan screen, Prematch, Epilogue, Postmatch, etc...
-rw-r--r-- | Northstar.Client/mod/scripts/vscripts/cl_northstar_client_init.nut | 3 | ||||
-rw-r--r-- | Northstar.Client/mod/scripts/vscripts/presence/cl_presence.nut | 13 |
2 files changed, 16 insertions, 0 deletions
diff --git a/Northstar.Client/mod/scripts/vscripts/cl_northstar_client_init.nut b/Northstar.Client/mod/scripts/vscripts/cl_northstar_client_init.nut index 3560fd56..9e683a86 100644 --- a/Northstar.Client/mod/scripts/vscripts/cl_northstar_client_init.nut +++ b/Northstar.Client/mod/scripts/vscripts/cl_northstar_client_init.nut @@ -20,6 +20,9 @@ global struct GameStateStruct { int otherHighestScore int maxScore float timeEnd + int serverGameState + int fd_waveNumber + int fd_totalWaves } global struct UIPresenceStruct { diff --git a/Northstar.Client/mod/scripts/vscripts/presence/cl_presence.nut b/Northstar.Client/mod/scripts/vscripts/presence/cl_presence.nut index f17216fb..142c94ba 100644 --- a/Northstar.Client/mod/scripts/vscripts/presence/cl_presence.nut +++ b/Northstar.Client/mod/scripts/vscripts/presence/cl_presence.nut @@ -30,6 +30,19 @@ GameStateStruct function DiscordRPC_GenerateGameState( GameStateStruct gs ) if ( IsValid( GetLocalClientPlayer() ) ) gs.ownScore = GameRules_GetTeamScore( GetLocalClientPlayer().GetTeam() ) + if ( GameRules_GetGameMode() == FD ) + { + gs.playlist = "fd" // So it returns only one thing to the plugin side instead of the 5 separate difficulties FD have + if ( GetGlobalNetInt( "FD_waveState" ) == WAVE_STATE_INCOMING || GetGlobalNetInt( "FD_waveState" ) == WAVE_STATE_IN_PROGRESS ) + { + gs.fd_waveNumber = GetGlobalNetInt( "FD_currentWave" ) + 1 + gs.fd_totalWaves = GetGlobalNetInt( "FD_totalWaves" ) + } + else + gs.fd_waveNumber = -1 // Tells plugin it's on Wave Break + } + + gs.serverGameState = GetGameState() == -1 ? 0 : GetGameState() gs.otherHighestScore = gs.ownScore == highestScore ? secondHighest : highestScore gs.maxScore = IsRoundBased() ? GetCurrentPlaylistVarInt( "roundscorelimit", 0 ) : GetCurrentPlaylistVarInt( "scorelimit", 0 ) |