Skip to content

Commit

Permalink
Merge branch 'main' into match_goals_tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
Zanieon authored Nov 7, 2023
2 parents 7019452 + c0e8a90 commit 04b6ebf
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 32 deletions.
14 changes: 1 addition & 13 deletions .github/nativefuncs.json
Original file line number Diff line number Diff line change
Expand Up @@ -421,13 +421,7 @@
"helpText":"Returns whether or not a given path leads to a folder.",
"returnTypeString":"bool",
"argTypes":"string path"
},
{
"name":"NSPushGameStateData",
"helpText":"",
"returnTypeString":"void",
"argTypes":"struct gamestate"
}
}
],
"UI":[
{
Expand Down Expand Up @@ -724,12 +718,6 @@
"returnTypeString":"bool",
"argTypes":"string path"
},
{
"name":"NSPushUIPresence",
"helpText":"",
"returnTypeString":"void",
"argTypes":"struct presence"
},
{
"name":"NSGetMasterServerAuthResult",
"helpText":"",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
global enum eDiscordGameState
{
LOADING = 0
MAINMENU
LOBBY
INGAME
}

global struct GameStateStruct {

string map
Expand All @@ -15,10 +23,7 @@ global struct GameStateStruct {
}

global struct UIPresenceStruct {
bool isLoading
bool isLobby
string loadingLevel
string loadedLevel
int gameState
}

global struct RequiredModInfo
Expand Down
11 changes: 4 additions & 7 deletions Northstar.Client/mod/scripts/vscripts/presence/cl_presence.nut
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
untyped
globalize_all_functions

void function NorthstarCodeCallback_GenerateGameState() {

GameStateStruct gs

GameStateStruct function DiscordRPC_GenerateGameState( GameStateStruct gs )
{
int highestScore = 0
int secondHighest = 0

Expand Down Expand Up @@ -40,6 +38,5 @@ void function NorthstarCodeCallback_GenerateGameState() {
gs.timeEnd = expect float(level.nv.roundEndTime - Time())
else
gs.timeEnd = expect float(level.nv.gameEndTime - Time())

NSPushGameStateData(gs)
}
return gs
}
20 changes: 12 additions & 8 deletions Northstar.Client/mod/scripts/vscripts/presence/ui_presence.nut
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
untyped
globalize_all_functions

void function NorthstarCodeCallback_GenerateUIPresence() {
UIPresenceStruct uis
UIPresenceStruct function DiscordRPC_GenerateUIPresence( UIPresenceStruct uis )
{
if ( uiGlobal.isLoading )
uis.gameState = eDiscordGameState.LOADING;
else if ( uiGlobal.loadedLevel == "" )
uis.gameState = eDiscordGameState.MAINMENU;
else if ( IsLobby() || uiGlobal.loadedLevel == "mp_lobby" )
uis.gameState = eDiscordGameState.LOBBY;
else
uis.gameState = eDiscordGameState.INGAME;

uis.isLoading = uiGlobal.isLoading
uis.isLobby = IsLobby()
uis.loadingLevel = uiGlobal.loadingLevel
uis.loadedLevel = uiGlobal.loadedLevel
NSPushUIPresence(uis)
}
return uis
}

0 comments on commit 04b6ebf

Please sign in to comment.