aboutsummaryrefslogtreecommitdiff
path: root/Northstar.Client
diff options
context:
space:
mode:
authorBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-10-20 20:11:43 +0100
committerBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-10-20 20:11:43 +0100
commite79a58640e1ef1ea1c3c954aefccd36c3cb55286 (patch)
tree8c7b822f8777ccdf6b0d86587da853b8451953c1 /Northstar.Client
parentd37c5ae333b4e622ebd0d18cf02a87d66aac62f9 (diff)
downloadNorthstarMods-e79a58640e1ef1ea1c3c954aefccd36c3cb55286.tar.gz
NorthstarMods-e79a58640e1ef1ea1c3c954aefccd36c3cb55286.zip
automatic mod enable/disable, refactors and item registration callbacks
Diffstat (limited to 'Northstar.Client')
-rw-r--r--Northstar.Client/mod/resource/northstar_client_localisation_english.txtbin16794 -> 17064 bytes
-rw-r--r--Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut3
-rw-r--r--Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut53
-rw-r--r--Northstar.Client/mod/scripts/vscripts/ui/menu_private_match.nut16
4 files changed, 62 insertions, 10 deletions
diff --git a/Northstar.Client/mod/resource/northstar_client_localisation_english.txt b/Northstar.Client/mod/resource/northstar_client_localisation_english.txt
index e405cbcdd..d3cc63f38 100644
--- a/Northstar.Client/mod/resource/northstar_client_localisation_english.txt
+++ b/Northstar.Client/mod/resource/northstar_client_localisation_english.txt
Binary files differ
diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut
index 588fe7050..ce1175467 100644
--- a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut
+++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut
@@ -1,5 +1,6 @@
global function AddNorthstarModMenu
global function AddNorthstarModMenu_MainMenuFooter
+global function ReloadMods
struct {
bool shouldReloadModsOnEnd
@@ -147,7 +148,7 @@ void function ReloadMods()
NSReloadMods()
ClientCommand( "reload_localization" )
ClientCommand( "loadPlaylists" )
- // ClientCommand( "weapon_reparse" ) // this doesn't work, weapon_reparse only works if a server is running and sv_cheats is 1, gotta figure this out eventually
+ ClientCommand( "sv_cheats 1; weapon_reparse; sv_cheats 0" ) // weapon_reparse only works if a server is running and sv_cheats is 1, gotta figure this out eventually
// note: the logic for this seems really odd, unsure why it doesn't seem to update, since the same code seems to get run irregardless of whether we've read weapon data before
ClientCommand( "uiscript_reset" )
} \ No newline at end of file
diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut
index 121de6141..29c1f81a2 100644
--- a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut
+++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut
@@ -161,7 +161,11 @@ string function FormatServerDescription( int server )
ret += NSGetServerName( server ) + "\n"
ret += format( "%i/%i players\n", NSGetServerPlayerCount( server ), NSGetServerMaxPlayerCount( server ) )
- ret += NSGetServerDescription( server ) + "\n"
+ ret += NSGetServerDescription( server ) + "\n\n"
+
+ ret += "Required Mods: \n"
+ for ( int i = 0; i < NSGetServerRequiredModsCount( server ); i++ )
+ ret += " " + NSGetServerRequiredModName( server, i ) + " v" + NSGetServerRequiredModVersion( server, i ) + "\n"
return ret
}
@@ -170,6 +174,36 @@ void function OnServerSelected( var button )
{
if ( NSIsRequestingServerList() || !NSMasterServerConnectionSuccessful() )
return
+
+ int server = int( Hud_GetScriptID( button ) )
+
+ // check mods
+ for ( int i = 0; i < NSGetServerRequiredModsCount( server ); i++ )
+ {
+ if ( !NSGetModNames().contains( NSGetServerRequiredModName( server, i ) ) )
+ {
+ DialogData dialogData
+ dialogData.header = "#ERROR"
+ dialogData.message = "Missing mod \"" + NSGetServerRequiredModName( server, i ) + "\" v" + NSGetServerRequiredModVersion( server, i )
+ dialogData.image = $"ui/menu/common/dialog_error"
+
+ #if PC_PROG
+ AddDialogButton( dialogData, "#DISMISS" )
+
+ AddDialogFooter( dialogData, "#A_BUTTON_SELECT" )
+ #endif // PC_PROG
+ AddDialogFooter( dialogData, "#B_BUTTON_DISMISS_RUI" )
+
+ OpenDialog( dialogData )
+
+ return
+ }
+ else
+ {
+ string modVersion = NSGetServerRequiredModVersion( server, i )
+ // check this is sorta valid semver, d
+ }
+ }
var menu = GetMenu( "ServerBrowserMenu" )
int serverIndex = file.page * BUTTONS_PER_PAGE + int ( Hud_GetScriptID( button ) )
@@ -194,11 +228,22 @@ void function ThreadedAuthAndConnectToServer( string password = "" )
WaitFrame()
if ( NSWasAuthSuccessful() )
- NSConnectToAuthedServer()
- else
{
- print( "fuck" )
+ array<string> requiredMods
+ for ( int i = 0; i < NSGetServerRequiredModsCount( file.lastSelectedServer ); i++ )
+ requiredMods.append( NSGetServerRequiredModName( file.lastSelectedServer, i ) )
+ // unload mods we don't need, load necessary ones and reload mods before connecting
+ foreach ( string mod in NSGetModNames() )
+ if ( NSIsModRequiredOnClient( mod ) )
+ NSSetModEnabled( mod, requiredMods.contains( mod ) )
+
+ ReloadMods()
+
+ NSConnectToAuthedServer()
+ }
+ else
+ {
DialogData dialogData
dialogData.header = "#ERROR"
dialogData.message = "Authentication Failed"
diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_private_match.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_private_match.nut
index 417214553..2c07ef718 100644
--- a/Northstar.Client/mod/scripts/vscripts/ui/menu_private_match.nut
+++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_private_match.nut
@@ -264,9 +264,12 @@ void function SetupComboButtons( var menu, var navUpButton, var navDownButton )
file.matchSettingsButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_MATCH_SETTINGS" )
Hud_AddEventHandler( file.matchSettingsButton, UIE_CLICK, OnSelectMatchSettings_Activate )
- var friendsButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_INVITE_FRIENDS" )
- file.inviteFriendsButton = friendsButton
- Hud_AddEventHandler( friendsButton, UIE_CLICK, InviteFriendsIfAllowed )
+ if ( !IsNorthstarServer() )
+ {
+ var friendsButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_INVITE_FRIENDS" )
+ file.inviteFriendsButton = friendsButton
+ Hud_AddEventHandler( friendsButton, UIE_CLICK, InviteFriendsIfAllowed )
+ }
headerIndex++
buttonIndex = 0
@@ -562,14 +565,17 @@ function UpdatePrivateMatchButtons()
Hud_SetLocked( file.selectMapButton, true )
Hud_SetLocked( file.selectModeButton, true )
Hud_SetLocked( file.matchSettingsButton, true )
- Hud_SetLocked( file.inviteFriendsButton, true )
+
+ if ( !IsNorthstarServer() )
+ Hud_SetLocked( file.inviteFriendsButton, true )
}
else
{
RHud_SetText( file.startMatchButton, "#START_MATCH" )
Hud_SetLocked( file.selectMapButton, false )
Hud_SetLocked( file.selectModeButton, false )
- Hud_SetLocked( file.inviteFriendsButton, false )
+ if ( !IsNorthstarServer() )
+ Hud_SetLocked( file.inviteFriendsButton, false )
string modeName = PrivateMatch_GetSelectedMode()
bool settingsLocked = IsFDMode( modeName )