From 737d877fe78c774235b9d1833f8aa194b6e6832a Mon Sep 17 00:00:00 2001 From: cat_or_not <41955154+catornot@users.noreply.github.com> Date: Sat, 17 Jun 2023 23:01:09 -0400 Subject: [PATCH 01/10] support plugins v3 --- .../mod/scripts/vscripts/presence/cl_presence.nut | 9 +++------ .../mod/scripts/vscripts/presence/ui_presence.nut | 7 +++---- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/Northstar.Client/mod/scripts/vscripts/presence/cl_presence.nut b/Northstar.Client/mod/scripts/vscripts/presence/cl_presence.nut index c8a8274a5..1b5d0c9f0 100644 --- a/Northstar.Client/mod/scripts/vscripts/presence/cl_presence.nut +++ b/Northstar.Client/mod/scripts/vscripts/presence/cl_presence.nut @@ -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 @@ -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) + + return gs } \ No newline at end of file diff --git a/Northstar.Client/mod/scripts/vscripts/presence/ui_presence.nut b/Northstar.Client/mod/scripts/vscripts/presence/ui_presence.nut index cdf1c9815..5617eef7b 100644 --- a/Northstar.Client/mod/scripts/vscripts/presence/ui_presence.nut +++ b/Northstar.Client/mod/scripts/vscripts/presence/ui_presence.nut @@ -1,12 +1,11 @@ untyped globalize_all_functions -void function NorthstarCodeCallback_GenerateUIPresence() { - UIPresenceStruct uis - +UIPresenceStruct function NorthstarCodeCallback_GenerateUIPresence( UIPresenceStruct uis ) { uis.isLoading = uiGlobal.isLoading uis.isLobby = IsLobby() uis.loadingLevel = uiGlobal.loadingLevel uis.loadedLevel = uiGlobal.loadedLevel - NSPushUIPresence(uis) + + return uis } \ No newline at end of file From b05e51921c4896e1a9e04a627ef089d4acbb2830 Mon Sep 17 00:00:00 2001 From: cat_or_not <41955154+catornot@users.noreply.github.com> Date: Sat, 17 Jun 2023 23:02:11 -0400 Subject: [PATCH 02/10] update native functions json --- .github/nativefuncs.json | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/.github/nativefuncs.json b/.github/nativefuncs.json index 751b48934..1a67384fc 100644 --- a/.github/nativefuncs.json +++ b/.github/nativefuncs.json @@ -325,12 +325,6 @@ "helpText":"Whether or not HTTP requests can be made to a private network address. You can enable this by starting the game with -allowlocalhttp.", "returnTypeString":"bool", "argTypes":"" - }, - { - "name":"NSPushGameStateData", - "helpText":"", - "returnTypeString":"void", - "argTypes":"struct gamestate" } ], "UI":[ @@ -579,12 +573,6 @@ "helpText":"Whether or not HTTP requests can be made to a private network address. You can enable this by starting the game with -allowlocalhttp.", "returnTypeString":"bool", "argTypes":"" - }, - { - "name":"NSPushUIPresence", - "helpText":"", - "returnTypeString":"void", - "argTypes":"struct presence" } ] } \ No newline at end of file From 72979781716933dd033cbf9bec7bff45aef5f291 Mon Sep 17 00:00:00 2001 From: cat_or_not <41955154+catornot@users.noreply.github.com> Date: Fri, 23 Jun 2023 19:50:46 -0400 Subject: [PATCH 03/10] update ui presence --- .../scripts/vscripts/cl_northstar_client_init.nut | 13 +++++++++---- .../mod/scripts/vscripts/presence/ui_presence.nut | 12 ++++++++---- 2 files changed, 17 insertions(+), 8 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 2a2ed3dbe..b189ab78f 100644 --- a/Northstar.Client/mod/scripts/vscripts/cl_northstar_client_init.nut +++ b/Northstar.Client/mod/scripts/vscripts/cl_northstar_client_init.nut @@ -1,3 +1,11 @@ +global enum eDiscordGameState +{ + LOADING = 0 + MAINMENU + LOBBY + INGAME +} + global struct GameStateStruct { string map @@ -15,10 +23,7 @@ global struct GameStateStruct { } global struct UIPresenceStruct { - bool isLoading - bool isLobby - string loadingLevel - string loadedLevel + int game_state } global struct RequiredModInfo diff --git a/Northstar.Client/mod/scripts/vscripts/presence/ui_presence.nut b/Northstar.Client/mod/scripts/vscripts/presence/ui_presence.nut index 5617eef7b..089b909eb 100644 --- a/Northstar.Client/mod/scripts/vscripts/presence/ui_presence.nut +++ b/Northstar.Client/mod/scripts/vscripts/presence/ui_presence.nut @@ -2,10 +2,14 @@ untyped globalize_all_functions UIPresenceStruct function NorthstarCodeCallback_GenerateUIPresence( UIPresenceStruct uis ) { - uis.isLoading = uiGlobal.isLoading - uis.isLobby = IsLobby() - uis.loadingLevel = uiGlobal.loadingLevel - uis.loadedLevel = uiGlobal.loadedLevel + if (uiGlobal.isLoading) + uis.game_state = eDiscordGameState.LOADING; + else if (uiGlobal.loadedLevel == "") + uis.game_state = eDiscordGameState.MAINMENU; + else if (IsLobby()) + uis.game_state = eDiscordGameState.LOBBY; + else + uis.game_state = eDiscordGameState.INGAME; return uis } \ No newline at end of file From 9b813981346e0dfdc6e6ee9813c79d29a7928815 Mon Sep 17 00:00:00 2001 From: cat_or_not <41955154+catornot@users.noreply.github.com> Date: Sat, 24 Jun 2023 20:35:55 -0400 Subject: [PATCH 04/10] fix missing lobby --- Northstar.Client/mod/scripts/vscripts/presence/ui_presence.nut | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Northstar.Client/mod/scripts/vscripts/presence/ui_presence.nut b/Northstar.Client/mod/scripts/vscripts/presence/ui_presence.nut index 089b909eb..6f604d7dc 100644 --- a/Northstar.Client/mod/scripts/vscripts/presence/ui_presence.nut +++ b/Northstar.Client/mod/scripts/vscripts/presence/ui_presence.nut @@ -6,7 +6,7 @@ UIPresenceStruct function NorthstarCodeCallback_GenerateUIPresence( UIPresenceSt uis.game_state = eDiscordGameState.LOADING; else if (uiGlobal.loadedLevel == "") uis.game_state = eDiscordGameState.MAINMENU; - else if (IsLobby()) + else if (IsLobby() || uiGlobal.loadedLevel == "mp_lobby") uis.game_state = eDiscordGameState.LOBBY; else uis.game_state = eDiscordGameState.INGAME; From ee800d5cd152624157aa38654f473a9773cd083b Mon Sep 17 00:00:00 2001 From: cat_or_not <41955154+catornot@users.noreply.github.com> Date: Sun, 27 Aug 2023 14:28:41 -0400 Subject: [PATCH 05/10] use DiscordRPC_ instead of NorthstarCodeCallback_ --- Northstar.Client/mod/scripts/vscripts/presence/cl_presence.nut | 2 +- Northstar.Client/mod/scripts/vscripts/presence/ui_presence.nut | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Northstar.Client/mod/scripts/vscripts/presence/cl_presence.nut b/Northstar.Client/mod/scripts/vscripts/presence/cl_presence.nut index 1b5d0c9f0..bd292df34 100644 --- a/Northstar.Client/mod/scripts/vscripts/presence/cl_presence.nut +++ b/Northstar.Client/mod/scripts/vscripts/presence/cl_presence.nut @@ -1,7 +1,7 @@ untyped globalize_all_functions -GameStateStruct function NorthstarCodeCallback_GenerateGameState( GameStateStruct gs ) { +GameStateStruct function DiscordRPC_GenerateGameState( GameStateStruct gs ) { int highestScore = 0 int secondHighest = 0 diff --git a/Northstar.Client/mod/scripts/vscripts/presence/ui_presence.nut b/Northstar.Client/mod/scripts/vscripts/presence/ui_presence.nut index 6f604d7dc..fd3ff9e46 100644 --- a/Northstar.Client/mod/scripts/vscripts/presence/ui_presence.nut +++ b/Northstar.Client/mod/scripts/vscripts/presence/ui_presence.nut @@ -1,7 +1,7 @@ untyped globalize_all_functions -UIPresenceStruct function NorthstarCodeCallback_GenerateUIPresence( UIPresenceStruct uis ) { +UIPresenceStruct function DiscordRPC_GenerateUIPresence( UIPresenceStruct uis ) { if (uiGlobal.isLoading) uis.game_state = eDiscordGameState.LOADING; else if (uiGlobal.loadedLevel == "") From 53ae6e73977af4ac480943e7581567ca706c3e01 Mon Sep 17 00:00:00 2001 From: cat_or_not <41955154+catornot@users.noreply.github.com> Date: Mon, 4 Sep 2023 14:13:16 -0400 Subject: [PATCH 06/10] Update Northstar.Client/mod/scripts/vscripts/presence/cl_presence.nut Co-authored-by: Jack <66967891+ASpoonPlaysGames@users.noreply.github.com> --- Northstar.Client/mod/scripts/vscripts/presence/cl_presence.nut | 1 - 1 file changed, 1 deletion(-) diff --git a/Northstar.Client/mod/scripts/vscripts/presence/cl_presence.nut b/Northstar.Client/mod/scripts/vscripts/presence/cl_presence.nut index bd292df34..a19315a34 100644 --- a/Northstar.Client/mod/scripts/vscripts/presence/cl_presence.nut +++ b/Northstar.Client/mod/scripts/vscripts/presence/cl_presence.nut @@ -37,6 +37,5 @@ GameStateStruct function DiscordRPC_GenerateGameState( GameStateStruct gs ) { gs.timeEnd = expect float(level.nv.roundEndTime - Time()) else gs.timeEnd = expect float(level.nv.gameEndTime - Time()) - return gs } \ No newline at end of file From 219f17077f921c6c047b4f1a0896dacfbf4a843c Mon Sep 17 00:00:00 2001 From: cat_or_not <41955154+catornot@users.noreply.github.com> Date: Mon, 4 Sep 2023 14:13:27 -0400 Subject: [PATCH 07/10] Update Northstar.Client/mod/scripts/vscripts/presence/ui_presence.nut Co-authored-by: Jack <66967891+ASpoonPlaysGames@users.noreply.github.com> --- .../mod/scripts/vscripts/presence/ui_presence.nut | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Northstar.Client/mod/scripts/vscripts/presence/ui_presence.nut b/Northstar.Client/mod/scripts/vscripts/presence/ui_presence.nut index fd3ff9e46..26f46670f 100644 --- a/Northstar.Client/mod/scripts/vscripts/presence/ui_presence.nut +++ b/Northstar.Client/mod/scripts/vscripts/presence/ui_presence.nut @@ -1,12 +1,13 @@ untyped globalize_all_functions -UIPresenceStruct function DiscordRPC_GenerateUIPresence( UIPresenceStruct uis ) { - if (uiGlobal.isLoading) +UIPresenceStruct function DiscordRPC_GenerateUIPresence( UIPresenceStruct uis ) +{ + if ( uiGlobal.isLoading ) uis.game_state = eDiscordGameState.LOADING; - else if (uiGlobal.loadedLevel == "") + else if ( uiGlobal.loadedLevel == "" ) uis.game_state = eDiscordGameState.MAINMENU; - else if (IsLobby() || uiGlobal.loadedLevel == "mp_lobby") + else if ( IsLobby() || uiGlobal.loadedLevel == "mp_lobby" ) uis.game_state = eDiscordGameState.LOBBY; else uis.game_state = eDiscordGameState.INGAME; From 633de5ed1b88028a1132d2d055d0109fb4eac328 Mon Sep 17 00:00:00 2001 From: cat_or_not <41955154+catornot@users.noreply.github.com> Date: Mon, 4 Sep 2023 14:13:34 -0400 Subject: [PATCH 08/10] Update Northstar.Client/mod/scripts/vscripts/presence/cl_presence.nut Co-authored-by: Jack <66967891+ASpoonPlaysGames@users.noreply.github.com> --- Northstar.Client/mod/scripts/vscripts/presence/cl_presence.nut | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Northstar.Client/mod/scripts/vscripts/presence/cl_presence.nut b/Northstar.Client/mod/scripts/vscripts/presence/cl_presence.nut index a19315a34..85ad10f21 100644 --- a/Northstar.Client/mod/scripts/vscripts/presence/cl_presence.nut +++ b/Northstar.Client/mod/scripts/vscripts/presence/cl_presence.nut @@ -1,7 +1,8 @@ untyped globalize_all_functions -GameStateStruct function DiscordRPC_GenerateGameState( GameStateStruct gs ) { +GameStateStruct function DiscordRPC_GenerateGameState( GameStateStruct gs ) +{ int highestScore = 0 int secondHighest = 0 From 0e3861360a133b72101ab8558e5409335a3e7ad6 Mon Sep 17 00:00:00 2001 From: cat_or_not <41955154+catornot@users.noreply.github.com> Date: Fri, 20 Oct 2023 19:50:54 -0400 Subject: [PATCH 09/10] add removed native func def --- .github/nativefuncs.json | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/nativefuncs.json b/.github/nativefuncs.json index b2a078d6c..8397232d3 100644 --- a/.github/nativefuncs.json +++ b/.github/nativefuncs.json @@ -717,6 +717,12 @@ "helpText":"Returns whether or not a given path leads to a folder.", "returnTypeString":"bool", "argTypes":"string path" - } + }, + { + "name":"NSGetMasterServerAuthResult", + "helpText":"", + "returnTypeString":"MasterServerAuthResult", + "argTypes":"" + } ] } \ No newline at end of file From e7cd848d58b52516478fd7056bb38bbb1e78d3e0 Mon Sep 17 00:00:00 2001 From: cat_or_not <41955154+catornot@users.noreply.github.com> Date: Sat, 21 Oct 2023 22:07:17 -0400 Subject: [PATCH 10/10] formatting --- .../mod/scripts/vscripts/cl_northstar_client_init.nut | 6 +++--- .../mod/scripts/vscripts/presence/cl_presence.nut | 2 +- .../mod/scripts/vscripts/presence/ui_presence.nut | 10 +++++----- 3 files changed, 9 insertions(+), 9 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 45cfc868f..765d29c32 100644 --- a/Northstar.Client/mod/scripts/vscripts/cl_northstar_client_init.nut +++ b/Northstar.Client/mod/scripts/vscripts/cl_northstar_client_init.nut @@ -1,7 +1,7 @@ global enum eDiscordGameState { - LOADING = 0 - MAINMENU + LOADING = 0 + MAINMENU LOBBY INGAME } @@ -23,7 +23,7 @@ global struct GameStateStruct { } global struct UIPresenceStruct { - int game_state + int gameState } global struct RequiredModInfo diff --git a/Northstar.Client/mod/scripts/vscripts/presence/cl_presence.nut b/Northstar.Client/mod/scripts/vscripts/presence/cl_presence.nut index 85ad10f21..f17216fbc 100644 --- a/Northstar.Client/mod/scripts/vscripts/presence/cl_presence.nut +++ b/Northstar.Client/mod/scripts/vscripts/presence/cl_presence.nut @@ -39,4 +39,4 @@ GameStateStruct function DiscordRPC_GenerateGameState( GameStateStruct gs ) else gs.timeEnd = expect float(level.nv.gameEndTime - Time()) return gs -} \ No newline at end of file +} diff --git a/Northstar.Client/mod/scripts/vscripts/presence/ui_presence.nut b/Northstar.Client/mod/scripts/vscripts/presence/ui_presence.nut index 26f46670f..ce5abe865 100644 --- a/Northstar.Client/mod/scripts/vscripts/presence/ui_presence.nut +++ b/Northstar.Client/mod/scripts/vscripts/presence/ui_presence.nut @@ -4,13 +4,13 @@ globalize_all_functions UIPresenceStruct function DiscordRPC_GenerateUIPresence( UIPresenceStruct uis ) { if ( uiGlobal.isLoading ) - uis.game_state = eDiscordGameState.LOADING; + uis.gameState = eDiscordGameState.LOADING; else if ( uiGlobal.loadedLevel == "" ) - uis.game_state = eDiscordGameState.MAINMENU; + uis.gameState = eDiscordGameState.MAINMENU; else if ( IsLobby() || uiGlobal.loadedLevel == "mp_lobby" ) - uis.game_state = eDiscordGameState.LOBBY; + uis.gameState = eDiscordGameState.LOBBY; else - uis.game_state = eDiscordGameState.INGAME; + uis.gameState = eDiscordGameState.INGAME; return uis -} \ No newline at end of file +}