Skip to content

Commit

Permalink
Presence update for plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Zanieon committed Sep 7, 2024
1 parent b8b0f29 commit 0730e37
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ global struct GameStateStruct {
int otherHighestScore
int maxScore
float timeEnd
int serverGameState
int fd_waveNumber
int fd_totalWaves
}

global struct UIPresenceStruct {
Expand Down
15 changes: 14 additions & 1 deletion Northstar.Client/mod/scripts/vscripts/presence/cl_presence.nut
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,27 @@ GameStateStruct function DiscordRPC_GenerateGameState( GameStateStruct gs )
gs.mapDisplayname = Localize(GetMapDisplayName(GetMapName()))

gs.playlist = GetCurrentPlaylistName()
gs.playlistDisplayname = Localize(GetCurrentPlaylistVarString("name", GetCurrentPlaylistName()))
gs.playlistDisplayname = Localize( GetCurrentPlaylistVarString( "name", GetCurrentPlaylistName() ) )

gs.currentPlayers = GetPlayerArray().len()
gs.maxPlayers = GetCurrentPlaylistVarInt( "maxPlayers", -1 )

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()
gs.otherHighestScore = gs.ownScore == highestScore ? secondHighest : highestScore

gs.maxScore = IsRoundBased() ? GetCurrentPlaylistVarInt( "roundscorelimit", 0 ) : GetCurrentPlaylistVarInt( "scorelimit", 0 )
Expand Down

0 comments on commit 0730e37

Please sign in to comment.