From db2434b524c284913c91556c75ff1ebd4226c96e Mon Sep 17 00:00:00 2001 From: Emma Miler Date: Tue, 11 Apr 2023 20:49:35 +0200 Subject: New presence code for plugins v2 (#532) * test * Update cl_presence.nut * Update Northstar.Client/mod/scripts/vscripts/presence/ui_presence.nut * Apply suggestions from code review * New scripts * fix playlist and add native funcs to build * remove snake cases from GameStateStruct * I forgor --------- Co-authored-by: cat_or_not <41955154+catornot@users.noreply.github.com> --- .../mod/scripts/vscripts/presence/ui_presence.nut | 42 +++++----------------- 1 file changed, 8 insertions(+), 34 deletions(-) (limited to 'Northstar.Client/mod/scripts/vscripts/presence/ui_presence.nut') diff --git a/Northstar.Client/mod/scripts/vscripts/presence/ui_presence.nut b/Northstar.Client/mod/scripts/vscripts/presence/ui_presence.nut index 1e3819890..cdf1c9815 100644 --- a/Northstar.Client/mod/scripts/vscripts/presence/ui_presence.nut +++ b/Northstar.Client/mod/scripts/vscripts/presence/ui_presence.nut @@ -1,38 +1,12 @@ untyped globalize_all_functions -void function NSUpdateGameStateUIStart() -{ - thread NSUpdateGameStateLoopUI() -} +void function NorthstarCodeCallback_GenerateUIPresence() { + UIPresenceStruct uis -void function NSUpdateGameStateLoopUI() -{ - while ( true ) - { - wait 1.0 - - if ( uiGlobal.loadedLevel == "" ) - { - if ( uiGlobal.isLoading ) - NSSetLoading( true ) - else - { - NSSetLoading( false ) - NSUpdateGameStateUI( "", "", "", "", true, false ) - } - - continue - } - - NSSetLoading( false ) - if( GetConVarString( "mp_gamemode" ) == "solo" ) - { - NSUpdateGameStateUI( GetActiveLevel(), Localize( GetMapDisplayName( GetActiveLevel() + "_CAMPAIGN_NAME" ) ), "Campaign", "Campaign", IsFullyConnected(), false ) - } - else - { - NSUpdateGameStateUI( GetActiveLevel(), Localize( GetMapDisplayName( GetActiveLevel() ) ), GetConVarString( "mp_gamemode" ), Localize( GetPlaylistDisplayName( GetConVarString( "mp_gamemode" ) ) ), IsFullyConnected(), false ) - } - } -} + uis.isLoading = uiGlobal.isLoading + uis.isLobby = IsLobby() + uis.loadingLevel = uiGlobal.loadingLevel + uis.loadedLevel = uiGlobal.loadedLevel + NSPushUIPresence(uis) +} \ No newline at end of file -- cgit v1.2.3