Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugins v3 #652

Merged
merged 14 commits into from
Nov 6, 2023
16 changes: 2 additions & 14 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 @@ -723,12 +717,6 @@
"helpText":"Returns whether or not a given path leads to a folder.",
"returnTypeString":"bool",
"argTypes":"string path"
},
{
"name":"NSPushUIPresence",
"helpText":"",
"returnTypeString":"void",
"argTypes":"struct presence"
}
}
]
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
global enum eDiscordGameState
{
LOADING = 0
MAINMENU
LOBBY
INGAME
}
catornot marked this conversation as resolved.
Show resolved Hide resolved

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 game_state
catornot marked this conversation as resolved.
Show resolved Hide resolved
}

global struct RequiredModInfo
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
untyped
globalize_all_functions

void function NorthstarCodeCallback_GenerateGameState() {

GameStateStruct gs

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

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

NSPushGameStateData(gs)
catornot marked this conversation as resolved.
Show resolved Hide resolved
return gs
}
catornot marked this conversation as resolved.
Show resolved Hide resolved
17 changes: 10 additions & 7 deletions Northstar.Client/mod/scripts/vscripts/presence/ui_presence.nut
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
untyped
globalize_all_functions

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

uis.isLoading = uiGlobal.isLoading
uis.isLobby = IsLobby()
uis.loadingLevel = uiGlobal.loadingLevel
uis.loadedLevel = uiGlobal.loadedLevel
NSPushUIPresence(uis)
return uis
}
catornot marked this conversation as resolved.
Show resolved Hide resolved
Loading