From 81aace2149e1a4d55470f35f228a9e9f8f4362e3 Mon Sep 17 00:00:00 2001 From: uniboi Date: Sun, 26 Feb 2023 13:18:37 +0100 Subject: [PATCH 01/16] add invalid mod install notification --- .github/nativefuncs.json | 6 +- .../mod/resource/ui/menus/panels/mainmenu.res | 239 ++++++++++++++++++ .../resource/ui/menus/panels/toast_popup.res | 56 ++++ .../scripts/vscripts/ui/menu_ns_modmenu.nut | 229 ++++++++++++----- .../vscripts/ui/menu_ns_serverbrowser.nut | 6 +- .../vscripts/ui/menu_ns_setversionlabel.nut | 2 +- .../scripts/vscripts/ui/panel_mainmenu.nut | 28 ++ 7 files changed, 494 insertions(+), 72 deletions(-) create mode 100644 Northstar.Client/mod/resource/ui/menus/panels/mainmenu.res create mode 100644 Northstar.Client/mod/resource/ui/menus/panels/toast_popup.res diff --git a/.github/nativefuncs.json b/.github/nativefuncs.json index 50bba0e5f..115b2f823 100644 --- a/.github/nativefuncs.json +++ b/.github/nativefuncs.json @@ -21,19 +21,19 @@ { "name":"NSGetModDescriptionByModName", "helpText":"", - "returnTypeString":"string", + "returnTypeString":"string ornull", "argTypes":"string modName" }, { "name":"NSGetModVersionByModName", "helpText":"", - "returnTypeString":"string", + "returnTypeString":"string ornull", "argTypes":"string modName" }, { "name":"NSGetModDownloadLinkByModName", "helpText":"", - "returnTypeString":"string", + "returnTypeString":"string ornull", "argTypes":"string modName" }, { diff --git a/Northstar.Client/mod/resource/ui/menus/panels/mainmenu.res b/Northstar.Client/mod/resource/ui/menus/panels/mainmenu.res new file mode 100644 index 000000000..18d7bda19 --- /dev/null +++ b/Northstar.Client/mod/resource/ui/menus/panels/mainmenu.res @@ -0,0 +1,239 @@ +#base "../combo_buttons.res" +"resource/ui/menus/panels/mainmenu.res" +{ + Screen + { + ControlName Label + wide %100 + tall %100 + labelText "" + visible 0 + } + + PinFrame + { + ControlName Label + ypos -41 + wide 1328 + tall 433 + labelText "" + //bgcolor_override "210 170 0 255" + //paintbackground 1 + //visible 1 + + pin_to_sibling Screen + pin_corner_to_sibling TOP + pin_to_sibling_corner CENTER + } + + ButtonRowAnchor + { + ControlName Label + labelText "" + + pin_to_sibling PinFrame + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_LEFT + } + + MainMenuButton0 + { + ControlName RuiButton + InheritProperties RuiSmallButton + classname MainMenuButtonClass + scriptID 0 + visible 0 + + navUp MainMenuButton6 + navDown MainMenuButton1 + + pin_to_sibling ButtonRow2x0 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner BOTTOM_LEFT + } + MainMenuButton1 + { + ControlName RuiButton + InheritProperties RuiSmallButton + classname MainMenuButtonClass + scriptID 1 + visible 0 + + navUp MainMenuButton0 + navDown MainMenuButton2 + + pin_to_sibling MainMenuButton0 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner BOTTOM_LEFT + } + MainMenuButton2 + { + ControlName RuiButton + InheritProperties RuiSmallButton + classname MainMenuButtonClass + scriptID 2 + visible 0 + + navUp MainMenuButton1 + navDown MainMenuButton3 + + pin_to_sibling MainMenuButton1 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner BOTTOM_LEFT + } + MainMenuButton3 + { + ControlName RuiButton + InheritProperties RuiSmallButton + classname MainMenuButtonClass + scriptID 3 + visible 0 + + navUp MainMenuButton2 + navDown MainMenuButton4 + + pin_to_sibling MainMenuButton2 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner BOTTOM_LEFT + } + MainMenuButton4 + { + ControlName RuiButton + InheritProperties RuiSmallButton + classname MainMenuButtonClass + scriptID 4 + visible 0 + + navUp MainMenuButton3 + navDown MainMenuButton5 + + pin_to_sibling MainMenuButton3 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner BOTTOM_LEFT + } + MainMenuButton5 + { + ControlName RuiButton + InheritProperties RuiSmallButton + classname MainMenuButtonClass + scriptID 5 + visible 0 + + navUp MainMenuButton4 + navDown MainMenuButton6 + + pin_to_sibling MainMenuButton4 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner BOTTOM_LEFT + } + MainMenuButton6 + { + ControlName RuiButton + InheritProperties RuiSmallButton + classname MainMenuButtonClass + scriptID 6 + visible 0 + + navUp MainMenuButton5 + navDown MainMenuButton0 + + pin_to_sibling MainMenuButton5 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner BOTTOM_LEFT + } + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + ServiceStatus + { + ControlName RuiPanel + xpos -12 + ypos -38 + wide 744 + tall 100 + rui "ui/service_status.rpak" + visible 1 + + pin_to_sibling PinFrame + pin_corner_to_sibling BOTTOM_LEFT + pin_to_sibling_corner BOTTOM_LEFT + } + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + WhatsNew + { + ControlName RuiPanel + ypos 380 + wide 740 + tall 125 + rui "ui/whats_new.rpak" + visible 1 + + pin_to_sibling PinFrame + pin_corner_to_sibling TOP_RIGHT + pin_to_sibling_corner TOP_RIGHT + } + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + SpotlightPanel + { + ControlName CNestedPanel + xpos -540 + ypos -11 + wide 1920 + tall 1080 + visible 0 + controlSettingsFile "resource/ui/menus/panels/spotlight.res" + + pin_to_sibling PinFrame + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_RIGHT + } + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + InstallProgress + { + ControlName RuiPanel + wide 500 + tall 100 + rui "ui/main_menu_install_progress.rpak" + visible 1 + + pin_to_sibling ServiceStatus + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_LEFT + } + + ActiveProfile + { + ControlName RuiPanel + xpos -13 + wide 600 + tall 28 + visible 0 + rui "ui/mainmenu_active_profile.rpak" + + pin_to_sibling PinFrame + pin_corner_to_sibling BOTTOM_LEFT + pin_to_sibling_corner BOTTOM_LEFT + } + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + NSInvalidModsHint + { + ControlName CNestedPanel + + tall 150 + + ypos -100 + controlSettingsFile "resource/ui/menus/panels/toast_popup.res" + + pin_to_sibling Screen + pin_to_sibling_corner RIGHT + pin_corner_to_sibling LEFT // start out of sight + } +} diff --git a/Northstar.Client/mod/resource/ui/menus/panels/toast_popup.res b/Northstar.Client/mod/resource/ui/menus/panels/toast_popup.res new file mode 100644 index 000000000..abe9e65e6 --- /dev/null +++ b/Northstar.Client/mod/resource/ui/menus/panels/toast_popup.res @@ -0,0 +1,56 @@ +resource/ui/menus/panels/toast_popup.res +{ + Frame + { + ControlName ImagePanel + + tall 100 + auto_wide_tocontents 1 + + image vgui/hud/white + drawcolor "0 0 0 180" + scaleImage 1 + } + + Image + { + ControlName RuiPanel + + wide 50 + tall 50 + + xpos -20 + rui "ui/basic_image.rpak" // The rui of an ruipanel needs to end with .rpak. Don't ask. + + pin_to_sibling Frame + pin_to_sibling_corner LEFT + pin_corner_to_sibling LEFT + } + + Text + { + ControlName Label + + tall 100 + auto_wide_tocontents 1 + + xpos 20 + labelText "#INCORRECT_MOD_INSTALL_TOAST" + + pin_to_sibling Image + pin_to_sibling_corner RIGHT + pin_corner_to_sibling LEFT + } + + Button + { + ControlName RuiButton + + tall 100 + labelText "" + + pin_to_sibling Frame + pin_to_sibling_corner CENTER + pin_corner_to_sibling CENTER + } +} \ No newline at end of file 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 3f643aa3d..3bfb1a4de 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut @@ -3,9 +3,17 @@ untyped global function AddNorthstarModMenu global function AddNorthstarModMenu_MainMenuFooter global function ReloadMods +global function ScrollToModListIndex +enum PanelType +{ + MOD, + HEADER, + INVALID_MOD, + INVALID_MOD_HEADER, +} -struct modData { +struct ModPanelData { string name = "" string version = "" string link = "" @@ -14,9 +22,10 @@ struct modData { array conVars = [] } -struct panelContent { - modData& mod +struct PanelContent { + ModPanelData& mod bool isHeader = false + int type // PanelType } enum filterShow { @@ -33,14 +42,14 @@ struct { } mouseDeltaBuffer struct { - array mods + array mods var menu array panels int scrollOffset = 0 array enabledMods var currentButton string searchTerm - modData& lastMod + ModPanelData& lastMod } file const int PANELS_LEN = 15 @@ -62,6 +71,25 @@ void function AdvanceToModListMenu( var button ) AdvanceMenu( GetMenu( "ModListMenu" ) ) } +void function ScrollToModListIndex( int index ) +{ + if( index > 0 ) + { + file.scrollOffset = index + } + else + { + int index = file.mods.len() - file.panels.len() - index - 1 + if( index >= 0 ) + file.scrollOffset = file.mods.len() - file.panels.len() - index - 1 + } + + UpdateList() + UpdateListSliderPosition() + + Hud_SetFocused( Hud_GetChild( file.panels[ index > 0 ? index : file.panels.len() + index ], "BtnMod" ) ) +} + void function InitModMenu() { file.menu = GetMenu( "ModListMenu" ) @@ -179,10 +207,11 @@ void function OnModButtonFocused( var button ) RuiSetString( rui, "messageText", FormatModDescription( modName ) ) // Add a button to open the link with if required - string link = NSGetModDownloadLinkByModName( modName ) + string ornull link = NSGetModDownloadLinkByModName( modName ) var linkButton = Hud_GetChild( file.menu, "ModPageButton" ) - if ( link.len() ) + if ( link != null && expect string( link ).len() ) { + expect string( link ) Hud_SetEnabled( linkButton, true ) Hud_SetVisible( linkButton, true ) Hud_SetText( linkButton, link ) @@ -195,9 +224,13 @@ void function OnModButtonFocused( var button ) SetControlBarColor( modName ) - bool required = NSIsModRequiredOnClient( modName ) - Hud_SetVisible( Hud_GetChild( file.menu, "WarningLegendLabel" ), required ) - Hud_SetVisible( Hud_GetChild( file.menu, "WarningLegendImage" ), required ) + bool ornull required = NSIsModRequiredOnClient( modName ) + if( required != null ) + { + expect bool( required ) + Hud_SetVisible( Hud_GetChild( file.menu, "WarningLegendLabel" ), required ) + Hud_SetVisible( Hud_GetChild( file.menu, "WarningLegendImage" ), required ) + } } void function OnModButtonPressed( var button ) @@ -205,7 +238,7 @@ void function OnModButtonPressed( var button ) string modName = file.mods[ int ( Hud_GetScriptID( Hud_GetParent( button ) ) ) + file.scrollOffset - 1 ].mod.name if ( StaticFind( modName ) && NSIsModEnabled( modName ) ) CoreModToggleDialog( modName ) - else + else if( NSGetModVersionByModName( modName ) != null ) // check if the mod is correctly installed { NSSetModEnabled( modName, !NSIsModEnabled( modName ) ) var panel = file.panels[ int ( Hud_GetScriptID( Hud_GetParent( button ) ) ) - 1 ] @@ -231,7 +264,7 @@ void function OnAuthenticationAgreementButtonPressed( var button ) void function OnModLinkButtonPressed( var button ) { string modName = file.mods[ int ( Hud_GetScriptID( Hud_GetParent( file.currentButton ) ) ) + file.scrollOffset - 1 ].mod.name - string link = NSGetModDownloadLinkByModName( modName ) + string link = expect string( NSGetModDownloadLinkByModName( modName ) ) if ( link.find("http://") != 0 && link.find("https://") != 0 ) link = "http://" + link // links without the http or https protocol get opened in the internal browser LaunchExternalWebBrowser( link, WEBBROWSER_FLAG_FORCEEXTERNAL ) @@ -319,9 +352,32 @@ void function UpdateList() { HideAllPanels() RefreshMods() + + array invalidMods = NSGetInvalidMods() + if( invalidMods.len() ) + AddInvalidMods( invalidMods ) + DisplayModPanels() } +void function AddInvalidMods( array invalidMods ) +{ + PanelContent c = { isHeader = true, type = PanelType.INVALID_MOD_HEADER, ... } + c.mod.name = string( invalidMods.len() ) + file.mods.append( c ) + + foreach( invalidMod in invalidMods ) + { + ModPanelData m + m.name = invalidMod + + PanelContent c = { type = PanelType.INVALID_MOD, ... } + c.mod = m + + file.mods.append( c ) + } +} + void function RefreshMods() { array modNames = NSGetModNames() @@ -329,7 +385,7 @@ void function RefreshMods() bool reverse = GetConVarBool( "modlist_reverse" ) - int lastLoadPriority = reverse ? NSGetModLoadPriority( modNames[ modNames.len() - 1 ] ) + 1 : -1 + int lastLoadPriority = reverse ? expect int( NSGetModLoadPriority( modNames[ modNames.len() - 1 ] ) ) + 1 : -1 string searchTerm = Hud_GetUTF8Text( Hud_GetChild( file.menu, "BtnModsSearch" ) ).tolower() for ( int i = reverse ? modNames.len() - 1 : 0; @@ -342,7 +398,7 @@ void function RefreshMods() continue bool enabled = NSIsModEnabled( mod ) - bool required = NSIsModRequiredOnClient( mod ) + bool required = expect bool( NSIsModRequiredOnClient( mod ) ) switch ( GetConVarInt( "filter_mods" ) ) { case filterShow.ONLY_ENABLED: @@ -363,29 +419,29 @@ void function RefreshMods() break } - int pr = NSGetModLoadPriority( mod ) + int pr = expect int( NSGetModLoadPriority( mod ) ) if ( reverse ? pr < lastLoadPriority : pr > lastLoadPriority ) { - modData m + ModPanelData m m.name = pr.tostring() - panelContent c + PanelContent c = { type = PanelType.HEADER, ... } c.mod = m c.isHeader = true file.mods.append( c ) lastLoadPriority = pr } - modData m + ModPanelData m m.name = mod - m.version = NSGetModVersionByModName( mod ) - m.link = NSGetModDownloadLinkByModName( mod ) - m.loadPriority = NSGetModLoadPriority( mod ) + m.version = expect string( NSGetModVersionByModName( mod ) ) + m.link = expect string( NSGetModDownloadLinkByModName( mod ) ) + m.loadPriority = expect int( NSGetModLoadPriority( mod ) ) m.enabled = enabled m.conVars = NSGetModConvarsByModName( mod ) - panelContent c + PanelContent c c.mod = m file.mods.append( c ) @@ -399,8 +455,8 @@ void function DisplayModPanels() if ( i >= file.mods.len() || file.scrollOffset + i >= file.mods.len() ) // don't try to show more panels than needed break - panelContent c = file.mods[ file.scrollOffset + i ] - modData mod = c.mod + PanelContent c = file.mods[ file.scrollOffset + i ] + ModPanelData mod = c.mod var btn = Hud_GetChild( panel, "BtnMod" ) var headerLabel = Hud_GetChild( panel, "Header" ) var box = Hud_GetChild( panel, "ControlBox" ) @@ -408,35 +464,66 @@ void function DisplayModPanels() var warning = Hud_GetChild( panel, "WarningImage" ) var enabledImage = Hud_GetChild( panel, "EnabledImage" ) - if ( c.isHeader ) + switch( c.type ) { - Hud_SetEnabled( btn, false ) - Hud_SetVisible( btn, false ) + case PanelType.MOD: + Hud_SetEnabled( btn, true ) + Hud_SetVisible( btn, true ) + Hud_SetText( btn, mod.name ) - Hud_SetText( headerLabel, "Load Priority: " + mod.name ) - Hud_SetVisible( headerLabel, true ) + Hud_SetVisible( headerLabel, false ) - Hud_SetVisible( box, false ) - Hud_SetVisible( line, true ) + SetControlBoxColor( box, mod.name ) + Hud_SetVisible( box, true ) + Hud_SetVisible( line, false ) - Hud_SetVisible( warning, false ) - Hud_SetVisible( enabledImage, false ) - } - else - { - Hud_SetEnabled( btn, true ) - Hud_SetVisible( btn, true ) - Hud_SetText( btn, mod.name ) + Hud_SetVisible( warning, expect bool( NSIsModRequiredOnClient( c.mod.name ) ) ) + + SetModEnabledHelperImageAsset( enabledImage, c.mod.name ) + break + case PanelType.HEADER: + Hud_SetEnabled( btn, false ) + Hud_SetVisible( btn, false ) + + Hud_SetText( headerLabel, "Load Priority: " + mod.name ) + Hud_SetVisible( headerLabel, true ) + + Hud_SetVisible( box, false ) + Hud_SetVisible( line, true ) + + Hud_SetVisible( warning, false ) + Hud_SetVisible( enabledImage, false ) + break + case PanelType.INVALID_MOD: + Hud_SetEnabled( btn, true ) + Hud_SetVisible( btn, true ) + Hud_SetText( btn, mod.name ) + + Hud_SetVisible( headerLabel, false ) + + Hud_SetVisible( box, false ) + Hud_SetVisible( line, false ) - Hud_SetVisible( headerLabel, false ) + Hud_SetVisible( warning, false ) - SetControlBoxColor( box, mod.name ) - Hud_SetVisible( box, true ) - Hud_SetVisible( line, false ) + RuiSetImage( Hud_GetRui( enabledImage ), "basicImage", $"ui/menu/common/dialog_error" ) + RuiSetFloat3(Hud_GetRui( enabledImage ), "basicImageColor", GetControlColorForMod( mod.name ) ) + Hud_SetVisible( enabledImage, true ) + break + case PanelType.INVALID_MOD_HEADER: + Hud_SetEnabled( btn, false ) + Hud_SetVisible( btn, false ) + + Hud_SetText( headerLabel, Localize( "#INCORRECT_MODS_MODLIST_HEADER", mod.name ) ) + Hud_SetVisible( headerLabel, true ) - Hud_SetVisible( warning, NSIsModRequiredOnClient( c.mod.name ) ) + Hud_SetVisible( box, false ) + Hud_SetVisible( line, true ) - SetModEnabledHelperImageAsset( enabledImage, c.mod.name ) + Hud_SetVisible( warning, false ) + Hud_SetVisible( enabledImage, false ) + break + default: } Hud_SetVisible( panel, true ) } @@ -500,34 +587,46 @@ vector function GetControlColorForMod( string modName ) string function FormatModDescription( string modName ) { - string ret - // version - ret += format( "Version %s\n", NSGetModVersionByModName( modName ) ) + string ornull modVersion = NSGetModVersionByModName( modName ); // Returns null for mods that aren't found. - // load priority - ret += format( "Load Priority: %i\n", NSGetModLoadPriority( modName ) ) - - // convars - array modCvars = NSGetModConvarsByModName( modName ) - if ( modCvars.len() != 0 && GetConVarBool( "modlist_show_convars" ) ) + if( modVersion != null ) { - ret += "ConVars: " + string ret + + // version + ret += format( "Version %s\n", modVersion ) + + // load priority + ret += format( "Load Priority: %i\n", expect int( NSGetModLoadPriority( modName ) ) ) - for ( int i = 0; i < modCvars.len(); i++ ) + // convars + array modCvars = NSGetModConvarsByModName( modName ) + if ( modCvars.len() != 0 && GetConVarBool( "modlist_show_convars" ) ) { - if ( i != modCvars.len() - 1 ) - ret += format( "\"%s\", ", modCvars[ i ] ) - else - ret += format( "\"%s\"", modCvars[ i ] ) + ret += "ConVars: " + + for ( int i = 0; i < modCvars.len(); i++ ) + { + if ( i != modCvars.len() - 1 ) + ret += format( "\"%s\", ", modCvars[ i ] ) + else + ret += format( "\"%s\"", modCvars[ i ] ) + } + + ret += "\n" } - ret += "\n" + // description + ret += format( "\n%s\n", expect string( NSGetModDescriptionByModName( modName ) ) ) + return ret + } + else // optimally should store if a mod is invalid in the struct instead of going by mod names not found, but this is alredy a big pile of spaghetti code so I can't be bothered + { + // If a mod is named e.g. "R2Northstar/mods/FunnyMod" and another mod is incorrectly installed under that path, the "you installed incorrect bla bla" will not show up, but the mods' description + return Localize( "#INCORRECT_MOD_INSTALL_DESCRIPTION" ) } - // description - ret += format( "\n%s\n", NSGetModDescriptionByModName( modName ) ) - - return ret + unreachable } //////////// 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 030282557..4c9aa27ea 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut @@ -986,7 +986,7 @@ void function OnServerSelected( var button ) { // this uses semver https://semver.org array serverModVersion = split( NSGetServerRequiredModVersion( serverIndex, i ), "." ) - array clientModVersion = split( NSGetModVersionByModName( NSGetServerRequiredModName( serverIndex, i ) ), "." ) + array clientModVersion = split( expect string( NSGetModVersionByModName( NSGetServerRequiredModName( serverIndex, i ) ) ), "." ) bool semverFail = false // if server has invalid semver don't bother checking @@ -1004,7 +1004,7 @@ void function OnServerSelected( var button ) { DialogData dialogData dialogData.header = "#ERROR" - dialogData.message = "Server has mod \"" + NSGetServerRequiredModName( serverIndex, i ) + "\" v" + NSGetServerRequiredModVersion( serverIndex, i ) + " while we have v" + NSGetModVersionByModName( NSGetServerRequiredModName( serverIndex, i ) ) + dialogData.message = "Server has mod \"" + NSGetServerRequiredModName( serverIndex, i ) + "\" v" + NSGetServerRequiredModVersion( serverIndex, i ) + " while we have v" + expect string( NSGetModVersionByModName( NSGetServerRequiredModName( serverIndex, i ) ) ) dialogData.image = $"ui/menu/common/dialog_error" #if PC_PROG @@ -1082,7 +1082,7 @@ void function ThreadedAuthAndConnectToServer( string password = "" ) // unload mods we don't need, load necessary ones and reload mods before connecting foreach ( string mod in NSGetModNames() ) { - if ( NSIsModRequiredOnClient( mod ) ) + if ( expect bool( NSIsModRequiredOnClient( mod ) ) ) { modsChanged = modsChanged || NSIsModEnabled( mod ) != requiredMods.contains( mod ) NSSetModEnabled( mod, requiredMods.contains( mod ) ) diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_setversionlabel.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_setversionlabel.nut index 6dbafde96..b1b0b3fb8 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_setversionlabel.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_setversionlabel.nut @@ -5,6 +5,6 @@ void function NS_SetVersionLabel() { var mainMenu = GetMenu( "MainMenu" ) //Gets main menu element var versionLabel = GetElementsByClassname( mainMenu, "nsVersionClass" )[0] //Gets the label from the mainMenu element. - Hud_SetText( versionLabel, "v" + NSGetModVersionByModName("Northstar.Client")) //Sets the label text (Getting Northstar version from Northstar.Client) + Hud_SetText( versionLabel, "v" + expect string( NSGetModVersionByModName( "Northstar.Client" ) )) //Sets the label text (Getting Northstar version from Northstar.Client) } diff --git a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut index 95b7bdae4..a08edc1ac 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut @@ -59,6 +59,14 @@ void function InitMainMenuPanel() file.serviceStatus = Hud_GetRui( Hud_GetChild( file.panel, "ServiceStatus" ) ) file.whatsNew = Hud_GetRui( Hud_GetChild( file.panel, "WhatsNew" ) ) + Hud_AddEventHandler( Hud_GetChild( Hud_GetChild( file.panel, "NSInvalidModsHint" ), "Button" ), UIE_CLICK, + void function( var button ) + { + AdvanceMenu( GetMenu( "ModListMenu" ) ) + ScrollToModListIndex( -1 ) + } + ) + ComboStruct comboStruct = ComboButtons_Create( file.panel ) int headerIndex = 0 @@ -185,6 +193,26 @@ void function OnShowMainMenuPanel() SetPanelDefaultFocus( file.panel, Hud_GetChild( file.panel, defaultButtonRowFocus ) ) PanelFocusDefault( file.panel ) + + thread ShowInvalidModsHint() +} + +void function ShowInvalidModsHint() +{ + wait 1.0 // wait a bit before showing the warning to give UI a chance to not lag / load + + array invalidMods = NSGetInvalidMods() + if( !invalidMods.len() ) + return + var panel = Hud_GetChild( file.panel, "NSInvalidModsHint" ) + + int width = Hud_GetWidth( Hud_GetChild( panel, "Text" ) ) + 110 // autowide is a bit scuffed and doesn't take everything into account + Hud_SetWidth( panel, width ) + Hud_SetWidth( Hud_GetChild( panel, "Frame" ), width ) + Hud_SetWidth( Hud_GetChild( panel, "ButtoN" ), width ) + + Hud_SetXOverTime( panel, -Hud_GetWidth( panel ), 1.0, INTERPOLATOR_SIMPLESPLINE ) + RuiSetImage( Hud_GetRui( Hud_GetChild( panel, "Image" ) ), "basicImage", $"ui/menu/common/dialog_error" ) } void function EnableCheckPlus() From c70b8c474bd1c23864ce191fc62ee432f1fa17e6 Mon Sep 17 00:00:00 2001 From: uniboi Date: Sun, 26 Feb 2023 13:25:59 +0100 Subject: [PATCH 02/16] add translation example --- .../northstar_client_localisation_english.txt | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Northstar.Client/mod/resource/northstar_client_localisation_english.txt b/Northstar.Client/mod/resource/northstar_client_localisation_english.txt index c25708a6f..da5463b0f 100644 --- a/Northstar.Client/mod/resource/northstar_client_localisation_english.txt +++ b/Northstar.Client/mod/resource/northstar_client_localisation_english.txt @@ -321,5 +321,31 @@ Press Yes if you agree to this. This choice can be changed in the mods menu at a "INVALID_MASTERSERVER_TOKEN" "Invalid or expired masterserver token" "JSON_PARSE_ERROR" "Error parsing json response" "UNSUPPORTED_VERSION" "The version you are using is no longer supported" + + // Mod Settings + "MOD_SETTINGS" "Mod Settings" + "NORTHSTAR_BASE_SETTINGS" "Northstar Base Settings" + "ONLY_HOST_MATCH_SETTINGS" "Only Host can change Private Match settings" + "ONLY_HOST_CAN_START_MATCH" "Only Host can Start the Match" + "MATCH_COUNTDOWN_LENGTH" "Private Match Countdown Duration" + "LOG_UNKNOWN_CLIENTCOMMANDS" "Log Unknown Client Commands" + "DISALLOWED_TACTICALS" "Prohibited Tacticals" + "TACTICAL_REPLACEMENT" "Replacement Tactical" + "DISALLOWED_WEAPONS" "Prohibited Weapons" + "REPLACEMENT_WEAPON" "Replacement Weapon" + "SHOULD_RETURN_TO_LOBBY" "Return To Lobby After Match End" + "ARE_YOU_SURE" "Are you sure?" + "WILL_RESET_ALL_SETTINGS" "This will reset ALL settings that belong to this category.\n\nThis is not revertable." + "WILL_RESET_SETTING" "This will reset the %s1 setting to it's default value.\n\nThis is not revertable." + "MOD_SETTINGS_SERVER" "Server" + "MOD_SETTINGS_RESET" "Reset" + "MOD_SETTINGS_RESET_ALL" "Reset All" + "NO_RESULTS" "No results." + "NO_MODS" "No settings available! Install more mods at ^5588FF00northstar.thunderstore.io^0." + + // Incorrect Mod Installation + "INCORRECT_MOD_INSTALL_TOAST" "Some of your mods are incorrectly installed. Click here for more info." + "INCORRECT_MODS_MODLIST_HEADER" "Incorrectly Installed Mods (%s1)" + "INCORRECT_MOD_INSTALL_DESCRIPTION" "This mod is incorrectly installed. Every mod has a file called \"mod.json\" in it's root directory, however for this mod it was not found.\nPossible reasons\n - Mods manually downloaded from thunderstore are wrapped in another folder. Navigate to this folder bla bla bla" } } From ce2e95ff883feff8fff126d7a459fb12fdda4f81 Mon Sep 17 00:00:00 2001 From: uniboi <64006268+uniboi@users.noreply.github.com> Date: Tue, 28 Feb 2023 18:33:07 +0100 Subject: [PATCH 03/16] requests from review --- .github/nativefuncs.json | 6 ++++++ .../northstar_client_localisation_english.txt | 21 ------------------- .../resource/ui/menus/panels/toast_popup.res | 2 +- .../scripts/vscripts/ui/panel_mainmenu.nut | 2 +- 4 files changed, 8 insertions(+), 23 deletions(-) diff --git a/.github/nativefuncs.json b/.github/nativefuncs.json index 115b2f823..db8ba6fad 100644 --- a/.github/nativefuncs.json +++ b/.github/nativefuncs.json @@ -54,6 +54,12 @@ "returnTypeString":"array", "argTypes":"string modName" }, + { + "name":"NSGetInvalidMods", + "helpText":"", + "returnTypeString":"array", + "argTypes":"string modName" + }, { "name":"DecodeJSON", "helpText":"converts a json string to a squirrel table", diff --git a/Northstar.Client/mod/resource/northstar_client_localisation_english.txt b/Northstar.Client/mod/resource/northstar_client_localisation_english.txt index da5463b0f..77c8b7f16 100644 --- a/Northstar.Client/mod/resource/northstar_client_localisation_english.txt +++ b/Northstar.Client/mod/resource/northstar_client_localisation_english.txt @@ -321,27 +321,6 @@ Press Yes if you agree to this. This choice can be changed in the mods menu at a "INVALID_MASTERSERVER_TOKEN" "Invalid or expired masterserver token" "JSON_PARSE_ERROR" "Error parsing json response" "UNSUPPORTED_VERSION" "The version you are using is no longer supported" - - // Mod Settings - "MOD_SETTINGS" "Mod Settings" - "NORTHSTAR_BASE_SETTINGS" "Northstar Base Settings" - "ONLY_HOST_MATCH_SETTINGS" "Only Host can change Private Match settings" - "ONLY_HOST_CAN_START_MATCH" "Only Host can Start the Match" - "MATCH_COUNTDOWN_LENGTH" "Private Match Countdown Duration" - "LOG_UNKNOWN_CLIENTCOMMANDS" "Log Unknown Client Commands" - "DISALLOWED_TACTICALS" "Prohibited Tacticals" - "TACTICAL_REPLACEMENT" "Replacement Tactical" - "DISALLOWED_WEAPONS" "Prohibited Weapons" - "REPLACEMENT_WEAPON" "Replacement Weapon" - "SHOULD_RETURN_TO_LOBBY" "Return To Lobby After Match End" - "ARE_YOU_SURE" "Are you sure?" - "WILL_RESET_ALL_SETTINGS" "This will reset ALL settings that belong to this category.\n\nThis is not revertable." - "WILL_RESET_SETTING" "This will reset the %s1 setting to it's default value.\n\nThis is not revertable." - "MOD_SETTINGS_SERVER" "Server" - "MOD_SETTINGS_RESET" "Reset" - "MOD_SETTINGS_RESET_ALL" "Reset All" - "NO_RESULTS" "No results." - "NO_MODS" "No settings available! Install more mods at ^5588FF00northstar.thunderstore.io^0." // Incorrect Mod Installation "INCORRECT_MOD_INSTALL_TOAST" "Some of your mods are incorrectly installed. Click here for more info." diff --git a/Northstar.Client/mod/resource/ui/menus/panels/toast_popup.res b/Northstar.Client/mod/resource/ui/menus/panels/toast_popup.res index abe9e65e6..28da8a0ac 100644 --- a/Northstar.Client/mod/resource/ui/menus/panels/toast_popup.res +++ b/Northstar.Client/mod/resource/ui/menus/panels/toast_popup.res @@ -8,7 +8,7 @@ resource/ui/menus/panels/toast_popup.res auto_wide_tocontents 1 image vgui/hud/white - drawcolor "0 0 0 180" + drawcolor "0 0 0 240" scaleImage 1 } diff --git a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut index a08edc1ac..00d23368b 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut @@ -211,7 +211,7 @@ void function ShowInvalidModsHint() Hud_SetWidth( Hud_GetChild( panel, "Frame" ), width ) Hud_SetWidth( Hud_GetChild( panel, "ButtoN" ), width ) - Hud_SetXOverTime( panel, -Hud_GetWidth( panel ), 1.0, INTERPOLATOR_SIMPLESPLINE ) + Hud_SetXOverTime( panel, -Hud_GetWidth( panel ), 0.3, INTERPOLATOR_SIMPLESPLINE ) RuiSetImage( Hud_GetRui( Hud_GetChild( panel, "Image" ) ), "basicImage", $"ui/menu/common/dialog_error" ) } From d05f1feb6f24ff7dd43ceea6db2b082e8ae4bf7a Mon Sep 17 00:00:00 2001 From: uniboi Date: Thu, 2 Mar 2023 09:25:50 +0100 Subject: [PATCH 04/16] display invalid mods on top of the modlist --- .../mod/scripts/vscripts/ui/menu_ns_modmenu.nut | 17 +++++++---------- .../mod/scripts/vscripts/ui/panel_mainmenu.nut | 2 +- 2 files changed, 8 insertions(+), 11 deletions(-) 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 3bfb1a4de..033585f63 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut @@ -73,21 +73,19 @@ void function AdvanceToModListMenu( var button ) void function ScrollToModListIndex( int index ) { - if( index > 0 ) + if( index >= 0 ) { file.scrollOffset = index } else { - int index = file.mods.len() - file.panels.len() - index - 1 - if( index >= 0 ) - file.scrollOffset = file.mods.len() - file.panels.len() - index - 1 + file.scrollOffset = file.mods.len() - file.panels.len() - index - 1 } UpdateList() UpdateListSliderPosition() - Hud_SetFocused( Hud_GetChild( file.panels[ index > 0 ? index : file.panels.len() + index ], "BtnMod" ) ) + Hud_SetFocused( Hud_GetChild( file.panels[ index >= 0 ? index : file.panels.len() + index ], "BtnMod" ) ) } void function InitModMenu() @@ -245,7 +243,6 @@ void function OnModButtonPressed( var button ) SetControlBoxColor( Hud_GetChild( panel, "ControlBox" ), modName ) SetControlBarColor( modName ) SetModEnabledHelperImageAsset( Hud_GetChild( panel, "EnabledImage" ), modName ) - // RefreshMods() UpdateListSliderPosition() UpdateListSliderHeight() } @@ -351,12 +348,12 @@ void function HideAllPanels() void function UpdateList() { HideAllPanels() - RefreshMods() - + file.mods.clear() array invalidMods = NSGetInvalidMods() if( invalidMods.len() ) AddInvalidMods( invalidMods ) + RefreshMods() DisplayModPanels() } @@ -381,7 +378,7 @@ void function AddInvalidMods( array invalidMods ) void function RefreshMods() { array modNames = NSGetModNames() - file.mods.clear() + // file.mods.clear() bool reverse = GetConVarBool( "modlist_reverse" ) @@ -788,4 +785,4 @@ void function ReloadMods() // 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/panel_mainmenu.nut b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut index a08edc1ac..789347e9f 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut @@ -63,7 +63,7 @@ void function InitMainMenuPanel() void function( var button ) { AdvanceMenu( GetMenu( "ModListMenu" ) ) - ScrollToModListIndex( -1 ) + ScrollToModListIndex( 0 ) } ) From 8fcb543130df3d81f8c071fd7cb3403dcbe5b705 Mon Sep 17 00:00:00 2001 From: uniboi Date: Mon, 3 Apr 2023 17:48:13 +0200 Subject: [PATCH 05/16] use invalid mod names --- .../northstar_client_localisation_english.txt | 3 ++- .../scripts/vscripts/ui/menu_ns_modmenu.nut | 26 +++++++++++++------ .../scripts/vscripts/ui/panel_mainmenu.nut | 2 +- 3 files changed, 21 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 77c8b7f16..f460caca4 100644 --- a/Northstar.Client/mod/resource/northstar_client_localisation_english.txt +++ b/Northstar.Client/mod/resource/northstar_client_localisation_english.txt @@ -325,6 +325,7 @@ Press Yes if you agree to this. This choice can be changed in the mods menu at a // Incorrect Mod Installation "INCORRECT_MOD_INSTALL_TOAST" "Some of your mods are incorrectly installed. Click here for more info." "INCORRECT_MODS_MODLIST_HEADER" "Incorrectly Installed Mods (%s1)" - "INCORRECT_MOD_INSTALL_DESCRIPTION" "This mod is incorrectly installed. Every mod has a file called \"mod.json\" in it's root directory, however for this mod it was not found.\nPossible reasons\n - Mods manually downloaded from thunderstore are wrapped in another folder. Navigate to this folder bla bla bla" + "INCORRECT_MOD_INSTALL_DESCRIPTION" "This mod is incorrectly installed. Every mod has a file called \"mod.json\" in it's root directory, however for this mod it was not found in the correct location.\nPossible reasons\n - Mods manually downloaded from thunderstore are wrapped in another folder.\n - The mod is badly formatted by the author\n\nThe mod is found at this location:\n%s1\nMove this folder into the \"mods\" folder of your profile, usually \"R2Northstar\"" + "INCORRECT_MOD_INSTALL_DESCRIPTION_DEFAULT" "This mod is incorrectly installed.\nAn error occured while determining details for this description please open a ticket on Discord or an issue on GitHub." } } 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 033585f63..e0b6ac679 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut @@ -13,9 +13,11 @@ enum PanelType INVALID_MOD_HEADER, } -struct ModPanelData { +struct ModPanelData +{ string name = "" string version = "" + string ornull description = null // description is not null for invalid mods string link = "" int loadPriority = 0 bool enabled = false @@ -42,6 +44,7 @@ struct { } mouseDeltaBuffer struct { + table nameToMod array mods var menu array panels @@ -159,7 +162,6 @@ void function OnModMenuOpened() { file.enabledMods = GetEnabledModsArray() // used to check if mods should be reloaded - UpdateList() UpdateListSliderHeight() UpdateListSliderPosition() @@ -200,9 +202,11 @@ void function OnModButtonFocused( var button ) string modName = file.lastMod.name var rui = Hud_GetRui( Hud_GetChild( file.menu, "LabelDetails" ) ) + ModPanelData m = file.nameToMod[ modName ] + RuiSetGameTime( rui, "startTime", -99999.99 ) // make sure it skips the whole animation for showing this RuiSetString( rui, "headerText", modName ) - RuiSetString( rui, "messageText", FormatModDescription( modName ) ) + RuiSetString( rui, "messageText", m.description == null ? FormatModDescription( modName ) : expect string( m.description ) ) // create description for valid mods // Add a button to open the link with if required string ornull link = NSGetModDownloadLinkByModName( modName ) @@ -291,7 +295,10 @@ void function OnHideConVarsChange( var n ) if ( modName == "" ) return var rui = Hud_GetRui( Hud_GetChild( file.menu, "LabelDetails" ) ) - RuiSetString( rui, "messageText", FormatModDescription( modName ) ) + + ModPanelData m = file.nameToMod[ modName ] + + RuiSetString( rui, "messageText", m.description == null ? FormatModDescription( modName ) : expect string( m.description ) ) } // LIST LOGIC @@ -349,7 +356,7 @@ void function UpdateList() { HideAllPanels() file.mods.clear() - array invalidMods = NSGetInvalidMods() + array< table< string, string > > invalidMods = NSGetInvalidMods() if( invalidMods.len() ) AddInvalidMods( invalidMods ) @@ -357,7 +364,7 @@ void function UpdateList() DisplayModPanels() } -void function AddInvalidMods( array invalidMods ) +void function AddInvalidMods( array< table< string, string > > invalidMods ) { PanelContent c = { isHeader = true, type = PanelType.INVALID_MOD_HEADER, ... } c.mod.name = string( invalidMods.len() ) @@ -366,12 +373,14 @@ void function AddInvalidMods( array invalidMods ) foreach( invalidMod in invalidMods ) { ModPanelData m - m.name = invalidMod + m.name = invalidMod.name + m.description = Localize( "#INCORRECT_MOD_INSTALL_DESCRIPTION", invalidMod.path ) PanelContent c = { type = PanelType.INVALID_MOD, ... } c.mod = m file.mods.append( c ) + file.nameToMod[invalidMod.name] <- m } } @@ -442,6 +451,7 @@ void function RefreshMods() c.mod = m file.mods.append( c ) + file.nameToMod[mod] <- m } } @@ -620,7 +630,7 @@ string function FormatModDescription( string modName ) else // optimally should store if a mod is invalid in the struct instead of going by mod names not found, but this is alredy a big pile of spaghetti code so I can't be bothered { // If a mod is named e.g. "R2Northstar/mods/FunnyMod" and another mod is incorrectly installed under that path, the "you installed incorrect bla bla" will not show up, but the mods' description - return Localize( "#INCORRECT_MOD_INSTALL_DESCRIPTION" ) + return Localize( "#INCORRECT_MOD_INSTALL_DESCRIPTION_DEFAULT" ) } unreachable diff --git a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut index 3a9a0b765..8be867c4d 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut @@ -201,7 +201,7 @@ void function ShowInvalidModsHint() { wait 1.0 // wait a bit before showing the warning to give UI a chance to not lag / load - array invalidMods = NSGetInvalidMods() + array< table< string, string > > invalidMods = NSGetInvalidMods() if( !invalidMods.len() ) return var panel = Hud_GetChild( file.panel, "NSInvalidModsHint" ) From 0cbfa5fdc64522e62aad3438fa2d4e115dfc4fd5 Mon Sep 17 00:00:00 2001 From: uniboi Date: Mon, 3 Apr 2023 18:17:28 +0200 Subject: [PATCH 06/16] update localization --- .../northstar_client_localisation_english.txt | 2 +- .../mod/scripts/vscripts/ui/menu_ns_modmenu.nut | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Northstar.Client/mod/resource/northstar_client_localisation_english.txt b/Northstar.Client/mod/resource/northstar_client_localisation_english.txt index f460caca4..458903cb9 100644 --- a/Northstar.Client/mod/resource/northstar_client_localisation_english.txt +++ b/Northstar.Client/mod/resource/northstar_client_localisation_english.txt @@ -325,7 +325,7 @@ Press Yes if you agree to this. This choice can be changed in the mods menu at a // Incorrect Mod Installation "INCORRECT_MOD_INSTALL_TOAST" "Some of your mods are incorrectly installed. Click here for more info." "INCORRECT_MODS_MODLIST_HEADER" "Incorrectly Installed Mods (%s1)" - "INCORRECT_MOD_INSTALL_DESCRIPTION" "This mod is incorrectly installed. Every mod has a file called \"mod.json\" in it's root directory, however for this mod it was not found in the correct location.\nPossible reasons\n - Mods manually downloaded from thunderstore are wrapped in another folder.\n - The mod is badly formatted by the author\n\nThe mod is found at this location:\n%s1\nMove this folder into the \"mods\" folder of your profile, usually \"R2Northstar\"" + "INCORRECT_MOD_INSTALL_DESCRIPTION" "This mod is incorrectly installed. Every mod has a file called \"mod.json\" in its root directory, however for this mod it was not found.\n\nExpected location: %s1\nFound location: %s2\n\nMake sure both mod.json file and mod directory are direct children of your mod folder." "INCORRECT_MOD_INSTALL_DESCRIPTION_DEFAULT" "This mod is incorrectly installed.\nAn error occured while determining details for this description please open a ticket on Discord or an issue on GitHub." } } 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 e0b6ac679..fe5d72a8a 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut @@ -364,6 +364,15 @@ void function UpdateList() DisplayModPanels() } +int function FindLast(string s, int c) +{ + int index = -1 + foreach( int i, sc in s ) + if( sc == c ) + index = i + return index +} + void function AddInvalidMods( array< table< string, string > > invalidMods ) { PanelContent c = { isHeader = true, type = PanelType.INVALID_MOD_HEADER, ... } @@ -374,7 +383,7 @@ void function AddInvalidMods( array< table< string, string > > invalidMods ) { ModPanelData m m.name = invalidMod.name - m.description = Localize( "#INCORRECT_MOD_INSTALL_DESCRIPTION", invalidMod.path ) + m.description = Localize( "#INCORRECT_MOD_INSTALL_DESCRIPTION", format("R2Northstar/mods%s", invalidMod.path.slice( FindLast( invalidMod.path, '/' ) ) ), invalidMod.path ) PanelContent c = { type = PanelType.INVALID_MOD, ... } c.mod = m From 2fda18c4c0cfa81cdf022df51313a03245c820ba Mon Sep 17 00:00:00 2001 From: uniboi Date: Mon, 3 Apr 2023 21:37:03 +0200 Subject: [PATCH 07/16] include profile in expected path --- Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 fe5d72a8a..2d3d83aa7 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut @@ -383,7 +383,7 @@ void function AddInvalidMods( array< table< string, string > > invalidMods ) { ModPanelData m m.name = invalidMod.name - m.description = Localize( "#INCORRECT_MOD_INSTALL_DESCRIPTION", format("R2Northstar/mods%s", invalidMod.path.slice( FindLast( invalidMod.path, '/' ) ) ), invalidMod.path ) + m.description = Localize( "#INCORRECT_MOD_INSTALL_DESCRIPTION", format("%s/mods%s", invalidMod.path.slice( 0, invalidMod.path.find("/") ), invalidMod.path.slice( FindLast( invalidMod.path, '/' ) ) ), invalidMod.path ) PanelContent c = { type = PanelType.INVALID_MOD, ... } c.mod = m From dbb74b6e6a36e5668a4474312a7c7f6edb81d1ba Mon Sep 17 00:00:00 2001 From: uniboi Date: Sun, 7 May 2023 19:13:38 +0200 Subject: [PATCH 08/16] switch to new native mods api --- .../vscripts/cl_northstar_client_init.nut | 15 + .../scripts/vscripts/ui/menu_ns_modmenu.nut | 387 +++++++----------- .../vscripts/ui/menu_ns_serverbrowser.nut | 26 +- .../vscripts/ui/menu_ns_setversionlabel.nut | 8 +- .../scripts/vscripts/ui/panel_mainmenu.nut | 12 +- 5 files changed, 197 insertions(+), 251 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..4fb44760a 100644 --- a/Northstar.Client/mod/scripts/vscripts/cl_northstar_client_init.nut +++ b/Northstar.Client/mod/scripts/vscripts/cl_northstar_client_init.nut @@ -41,3 +41,18 @@ global struct ServerInfo string region array< RequiredModInfo > requiredMods } + +global struct Mod +{ + int index + string name + string description + string version + string link + string installLocation + int loadPriority + bool requiredOnClient + bool enabled + array conVars +} + 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 2d3d83aa7..88af87b44 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut @@ -3,30 +3,17 @@ untyped global function AddNorthstarModMenu global function AddNorthstarModMenu_MainMenuFooter global function ReloadMods -global function ScrollToModListIndex +global function GetModByName enum PanelType { MOD, - HEADER, INVALID_MOD, - INVALID_MOD_HEADER, -} - -struct ModPanelData -{ - string name = "" - string version = "" - string ornull description = null // description is not null for invalid mods - string link = "" - int loadPriority = 0 - bool enabled = false - array conVars = [] + HEADER, } struct PanelContent { - ModPanelData& mod - bool isHeader = false + Mod& mod int type // PanelType } @@ -44,7 +31,6 @@ struct { } mouseDeltaBuffer struct { - table nameToMod array mods var menu array panels @@ -52,12 +38,19 @@ struct { array enabledMods var currentButton string searchTerm - ModPanelData& lastMod + Mod& lastMod } file const int PANELS_LEN = 15 const string[3] CORE_MODS = ["Northstar.Client", "Northstar.Coop", "Northstar.CustomServers"] // Shows a warning if you try to disable these +Mod ornull function GetModByName( string name ) +{ + foreach ( mod in NSGetMods() ) + if ( mod.name == name ) + return mod +} + void function AddNorthstarModMenu() { AddMenu( "ModListMenu", $"resource/ui/menus/modlist.menu", InitModMenu ) @@ -74,23 +67,6 @@ void function AdvanceToModListMenu( var button ) AdvanceMenu( GetMenu( "ModListMenu" ) ) } -void function ScrollToModListIndex( int index ) -{ - if( index >= 0 ) - { - file.scrollOffset = index - } - else - { - file.scrollOffset = file.mods.len() - file.panels.len() - index - 1 - } - - UpdateList() - UpdateListSliderPosition() - - Hud_SetFocused( Hud_GetChild( file.panels[ index >= 0 ? index : file.panels.len() + index ], "BtnMod" ) ) -} - void function InitModMenu() { file.menu = GetMenu( "ModListMenu" ) @@ -160,8 +136,9 @@ void function InitModMenu() void function OnModMenuOpened() { - file.enabledMods = GetEnabledModsArray() // used to check if mods should be reloaded + file.enabledMods = GetEnabledModNames() // used to check if mods should be reloaded + UpdateList() UpdateListSliderHeight() UpdateListSliderPosition() @@ -178,7 +155,7 @@ void function OnModMenuClosed() } catch ( ex ) {} - array current = GetEnabledModsArray() + array current = GetEnabledModNames() bool reload foreach ( string mod in current ) { @@ -199,24 +176,19 @@ void function OnModButtonFocused( var button ) file.currentButton = button file.lastMod = file.mods[ int ( Hud_GetScriptID( Hud_GetParent( button ) ) ) + file.scrollOffset - 1 ].mod - string modName = file.lastMod.name var rui = Hud_GetRui( Hud_GetChild( file.menu, "LabelDetails" ) ) - ModPanelData m = file.nameToMod[ modName ] - RuiSetGameTime( rui, "startTime", -99999.99 ) // make sure it skips the whole animation for showing this - RuiSetString( rui, "headerText", modName ) - RuiSetString( rui, "messageText", m.description == null ? FormatModDescription( modName ) : expect string( m.description ) ) // create description for valid mods + RuiSetString( rui, "headerText", file.lastMod.name ) + RuiSetString( rui, "messageText", FormatModDescription( file.lastMod ) ) // Add a button to open the link with if required - string ornull link = NSGetModDownloadLinkByModName( modName ) var linkButton = Hud_GetChild( file.menu, "ModPageButton" ) - if ( link != null && expect string( link ).len() ) + if ( file.lastMod.link.len() ) { - expect string( link ) Hud_SetEnabled( linkButton, true ) Hud_SetVisible( linkButton, true ) - Hud_SetText( linkButton, link ) + Hud_SetText( linkButton, file.lastMod.link ) } else { @@ -224,29 +196,32 @@ void function OnModButtonFocused( var button ) Hud_SetVisible( linkButton, false ) } - SetControlBarColor( modName ) + SetControlBarColor( file.lastMod.enabled ) - bool ornull required = NSIsModRequiredOnClient( modName ) - if( required != null ) - { - expect bool( required ) - Hud_SetVisible( Hud_GetChild( file.menu, "WarningLegendLabel" ), required ) - Hud_SetVisible( Hud_GetChild( file.menu, "WarningLegendImage" ), required ) - } + Hud_SetVisible( Hud_GetChild( file.menu, "WarningLegendLabel" ), file.lastMod.requiredOnClient ) + Hud_SetVisible( Hud_GetChild( file.menu, "WarningLegendImage" ), file.lastMod.requiredOnClient ) } void function OnModButtonPressed( var button ) { - string modName = file.mods[ int ( Hud_GetScriptID( Hud_GetParent( button ) ) ) + file.scrollOffset - 1 ].mod.name - if ( StaticFind( modName ) && NSIsModEnabled( modName ) ) + PanelContent pc = file.mods[ int ( Hud_GetScriptID( Hud_GetParent( button ) ) ) + file.scrollOffset - 1 ] + Mod mod = pc.mod + + if ( pc.type == PanelType.INVALID_MOD ) + return + + string modName = mod.name + if ( StaticFind( modName ) && mod.enabled ) CoreModToggleDialog( modName ) - else if( NSGetModVersionByModName( modName ) != null ) // check if the mod is correctly installed + else { - NSSetModEnabled( modName, !NSIsModEnabled( modName ) ) + NSSetModEnabled( mod.index, !mod.enabled ) + mod.enabled = !mod.enabled var panel = file.panels[ int ( Hud_GetScriptID( Hud_GetParent( button ) ) ) - 1 ] - SetControlBoxColor( Hud_GetChild( panel, "ControlBox" ), modName ) - SetControlBarColor( modName ) - SetModEnabledHelperImageAsset( Hud_GetChild( panel, "EnabledImage" ), modName ) + SetControlBoxColor( Hud_GetChild( panel, "ControlBox" ), mod.enabled ) + SetControlBarColor( mod.enabled ) + SetModEnabledHelperImageAsset( Hud_GetChild( panel, "EnabledImage" ), mod ) + UpdateListSliderPosition() UpdateListSliderHeight() } @@ -264,10 +239,9 @@ void function OnAuthenticationAgreementButtonPressed( var button ) void function OnModLinkButtonPressed( var button ) { - string modName = file.mods[ int ( Hud_GetScriptID( Hud_GetParent( file.currentButton ) ) ) + file.scrollOffset - 1 ].mod.name - string link = expect string( NSGetModDownloadLinkByModName( modName ) ) + string link = file.mods[ int ( Hud_GetScriptID( Hud_GetParent( file.currentButton ) ) ) + file.scrollOffset - 1 ].mod.link if ( link.find("http://") != 0 && link.find("https://") != 0 ) - link = "http://" + link // links without the http or https protocol get opened in the internal browser + link = format( "http://%s", link ) // links without the http or https protocol get opened in the internal browser LaunchExternalWebBrowser( link, WEBBROWSER_FLAG_FORCEEXTERNAL ) } @@ -291,14 +265,10 @@ void function OnBtnFiltersClear_Activate( var button ) void function OnHideConVarsChange( var n ) { - string modName = file.lastMod.name - if ( modName == "" ) + if ( file.lastMod.name == "" ) // not sure if this is stil needed. Leaving it in just to be sure return var rui = Hud_GetRui( Hud_GetChild( file.menu, "LabelDetails" ) ) - - ModPanelData m = file.nameToMod[ modName ] - - RuiSetString( rui, "messageText", m.description == null ? FormatModDescription( modName ) : expect string( m.description ) ) + RuiSetString( rui, "messageText", FormatModDescription( file.lastMod ) ) } // LIST LOGIC @@ -321,24 +291,26 @@ void function CoreModToggleDialog( string mod ) void function DisableMod() { - string modName = file.mods[ int ( Hud_GetScriptID( Hud_GetParent( file.currentButton ) ) ) + file.scrollOffset - 1 ].mod.name - NSSetModEnabled( modName, false ) + Mod mod = file.mods[ int ( Hud_GetScriptID( Hud_GetParent( file.currentButton ) ) ) + file.scrollOffset - 1 ].mod + + NSSetModEnabled( mod.index, false ) + mod.enabled = false var panel = file.panels[ int ( Hud_GetScriptID( Hud_GetParent( file.currentButton ) ) ) - 1] - SetControlBoxColor( Hud_GetChild( panel, "ControlBox" ), modName ) - SetControlBarColor( modName ) - SetModEnabledHelperImageAsset( Hud_GetChild( panel, "EnabledImage" ), modName ) + SetControlBoxColor( Hud_GetChild( panel, "ControlBox" ), mod.enabled ) + SetControlBarColor( mod.enabled ) + SetModEnabledHelperImageAsset( Hud_GetChild( panel, "EnabledImage" ), mod ) RefreshMods() } -array function GetEnabledModsArray() +array function GetEnabledModNames() { array enabledMods - foreach ( string mod in NSGetModNames() ) + foreach ( Mod mod in NSGetMods() ) { - if ( NSIsModEnabled( mod ) ) - enabledMods.append( mod ) + if ( mod.enabled ) + enabledMods.append( mod.name ) } return enabledMods } @@ -355,112 +327,94 @@ void function HideAllPanels() void function UpdateList() { HideAllPanels() - file.mods.clear() - array< table< string, string > > invalidMods = NSGetInvalidMods() - if( invalidMods.len() ) - AddInvalidMods( invalidMods ) - RefreshMods() DisplayModPanels() } -int function FindLast(string s, int c) +void function AddInvalidModsToPanels() { - int index = -1 - foreach( int i, sc in s ) - if( sc == c ) - index = i - return index -} + array invalidMods = NSGetInvalidMods() -void function AddInvalidMods( array< table< string, string > > invalidMods ) -{ - PanelContent c = { isHeader = true, type = PanelType.INVALID_MOD_HEADER, ... } - c.mod.name = string( invalidMods.len() ) - file.mods.append( c ) + if ( !invalidMods.len() ) + return + + PanelContent headerPanel = { type = PanelType.HEADER, ... } + Mod header + header.name = format( "Incorrectly installed mods (%i)", invalidMods.len() ) + headerPanel.mod = header - foreach( invalidMod in invalidMods ) + file.mods.append( headerPanel ) + + foreach ( invalidMod in invalidMods ) { - ModPanelData m - m.name = invalidMod.name - m.description = Localize( "#INCORRECT_MOD_INSTALL_DESCRIPTION", format("%s/mods%s", invalidMod.path.slice( 0, invalidMod.path.find("/") ), invalidMod.path.slice( FindLast( invalidMod.path, '/' ) ) ), invalidMod.path ) + PanelContent p = { type = PanelType.INVALID_MOD, ... } + p.mod = invalidMod - PanelContent c = { type = PanelType.INVALID_MOD, ... } - c.mod = m + p.mod.enabled = false // the mod might not be explicitly disabled in enabledmods.json, but should always show as disabled in the list - file.mods.append( c ) - file.nameToMod[invalidMod.name] <- m + file.mods.append( p ) } } void function RefreshMods() { - array modNames = NSGetModNames() - // file.mods.clear() + file.mods.clear() + string searchTerm = Hud_GetUTF8Text( Hud_GetChild( file.menu, "BtnModsSearch" ) ).tolower() + array mods = NSGetMods() bool reverse = GetConVarBool( "modlist_reverse" ) + int lastLoadPriority = -1 - int lastLoadPriority = reverse ? expect int( NSGetModLoadPriority( modNames[ modNames.len() - 1 ] ) ) + 1 : -1 - string searchTerm = Hud_GetUTF8Text( Hud_GetChild( file.menu, "BtnModsSearch" ) ).tolower() + mods.sort( SortModsByAscendingPriority ) - for ( int i = reverse ? modNames.len() - 1 : 0; - reverse ? ( i >= 0 ) : ( i < modNames.len() ); - i += ( reverse ? -1 : 1) ) + if ( reverse ) { - string mod = modNames[i] + mods.reverse() + if ( mods.len() ) + lastLoadPriority = mods[0].loadPriority + 1 + } + + AddInvalidModsToPanels() - if ( searchTerm.len() && mod.tolower().find( searchTerm ) == null ) + foreach ( mod in mods ) + { + if ( searchTerm.len() && mod.name.tolower().find( searchTerm ) == null ) continue - bool enabled = NSIsModEnabled( mod ) - bool required = expect bool( NSIsModRequiredOnClient( mod ) ) switch ( GetConVarInt( "filter_mods" ) ) { case filterShow.ONLY_ENABLED: - if ( !enabled ) + if ( !mod.enabled ) continue - break case filterShow.ONLY_DISABLED: - if ( enabled ) + if ( mod.enabled ) continue - break case filterShow.ONLY_REQUIRED: - if ( !required ) + if ( !mod.requiredOnClient ) continue - break case filterShow.ONLY_NOT_REQUIRED: - if( required ) + if( mod.requiredOnClient ) continue - break } - int pr = expect int( NSGetModLoadPriority( mod ) ) - - if ( reverse ? pr < lastLoadPriority : pr > lastLoadPriority ) + if ( reverse ? mod.loadPriority < lastLoadPriority : mod.loadPriority > lastLoadPriority ) { - ModPanelData m - m.name = pr.tostring() - - PanelContent c = { type = PanelType.HEADER, ... } - c.mod = m - c.isHeader = true - file.mods.append( c ) - lastLoadPriority = pr - } + lastLoadPriority = mod.loadPriority + + Mod m + m.name = format( "Load Priority: %i", mod.loadPriority ) - ModPanelData m - m.name = mod - m.version = expect string( NSGetModVersionByModName( mod ) ) - m.link = expect string( NSGetModDownloadLinkByModName( mod ) ) - m.loadPriority = expect int( NSGetModLoadPriority( mod ) ) - m.enabled = enabled - m.conVars = NSGetModConvarsByModName( mod ) + PanelContent pc + pc.mod = m + pc.type = PanelType.HEADER - PanelContent c - c.mod = m + file.mods.append( pc ) + } - file.mods.append( c ) - file.nameToMod[mod] <- m + PanelContent pc + pc.type = PanelType.MOD + pc.mod = mod + file.mods.append( pc ) } } @@ -472,36 +426,21 @@ void function DisplayModPanels() break PanelContent c = file.mods[ file.scrollOffset + i ] - ModPanelData mod = c.mod + Mod mod = c.mod var btn = Hud_GetChild( panel, "BtnMod" ) var headerLabel = Hud_GetChild( panel, "Header" ) var box = Hud_GetChild( panel, "ControlBox" ) var line = Hud_GetChild( panel, "BottomLine" ) var warning = Hud_GetChild( panel, "WarningImage" ) var enabledImage = Hud_GetChild( panel, "EnabledImage" ) - - switch( c.type ) - { - case PanelType.MOD: - Hud_SetEnabled( btn, true ) - Hud_SetVisible( btn, true ) - Hud_SetText( btn, mod.name ) - - Hud_SetVisible( headerLabel, false ) - - SetControlBoxColor( box, mod.name ) - Hud_SetVisible( box, true ) - Hud_SetVisible( line, false ) - - Hud_SetVisible( warning, expect bool( NSIsModRequiredOnClient( c.mod.name ) ) ) - SetModEnabledHelperImageAsset( enabledImage, c.mod.name ) - break + switch ( c.type ) + { case PanelType.HEADER: Hud_SetEnabled( btn, false ) Hud_SetVisible( btn, false ) - Hud_SetText( headerLabel, "Load Priority: " + mod.name ) + Hud_SetText( headerLabel, mod.name ) Hud_SetVisible( headerLabel, true ) Hud_SetVisible( box, false ) @@ -510,6 +449,8 @@ void function DisplayModPanels() Hud_SetVisible( warning, false ) Hud_SetVisible( enabledImage, false ) break + + case PanelType.MOD: case PanelType.INVALID_MOD: Hud_SetEnabled( btn, true ) Hud_SetVisible( btn, true ) @@ -517,69 +458,46 @@ void function DisplayModPanels() Hud_SetVisible( headerLabel, false ) - Hud_SetVisible( box, false ) + SetControlBoxColor( box, mod.enabled ) + Hud_SetVisible( box, true ) Hud_SetVisible( line, false ) - Hud_SetVisible( warning, false ) - - RuiSetImage( Hud_GetRui( enabledImage ), "basicImage", $"ui/menu/common/dialog_error" ) - RuiSetFloat3(Hud_GetRui( enabledImage ), "basicImageColor", GetControlColorForMod( mod.name ) ) - Hud_SetVisible( enabledImage, true ) - break - case PanelType.INVALID_MOD_HEADER: - Hud_SetEnabled( btn, false ) - Hud_SetVisible( btn, false ) - - Hud_SetText( headerLabel, Localize( "#INCORRECT_MODS_MODLIST_HEADER", mod.name ) ) - Hud_SetVisible( headerLabel, true ) - - Hud_SetVisible( box, false ) - Hud_SetVisible( line, true ) + Hud_SetVisible( warning, c.mod.requiredOnClient ) - Hud_SetVisible( warning, false ) - Hud_SetVisible( enabledImage, false ) + SetModEnabledHelperImageAsset( enabledImage, c.mod ) break - default: } Hud_SetVisible( panel, true ) } } -void function SetModEnabledHelperImageAsset( var panel, string modName ) +void function SetModEnabledHelperImageAsset( var panel, Mod mod ) { - if( NSIsModEnabled( modName ) ) + if( mod.enabled ) RuiSetImage( Hud_GetRui( panel ), "basicImage", $"rui/menu/common/merit_state_success" ) else RuiSetImage( Hud_GetRui( panel ), "basicImage", $"rui/menu/common/merit_state_failure" ) - RuiSetFloat3(Hud_GetRui( panel ), "basicImageColor", GetControlColorForMod( modName ) ) + RuiSetFloat3(Hud_GetRui( panel ), "basicImageColor", GetControlColorForMod( mod.enabled ) ) Hud_SetVisible( panel, true ) } -void function SetControlBoxColor( var box, string modName ) +void function SetControlBoxColor( var box, bool modEnabled ) { var rui = Hud_GetRui( box ) - // if ( NSIsModEnabled( modName ) ) - // RuiSetFloat3(rui, "basicImageColor", <0,1,0>) - // else - // RuiSetFloat3(rui, "basicImageColor", <1,0,0>) - RuiSetFloat3(rui, "basicImageColor", GetControlColorForMod( modName ) ) + RuiSetFloat3(rui, "basicImageColor", GetControlColorForMod( modEnabled ) ) } -void function SetControlBarColor( string modName ) +void function SetControlBarColor( bool modEnabled ) { var bar_element = Hud_GetChild( file.menu, "ModEnabledBar" ) var bar = Hud_GetRui( bar_element ) - // if ( NSIsModEnabled( modName ) ) - // RuiSetFloat3(bar, "basicImageColor", <0,1,0>) - // else - // RuiSetFloat3(bar, "basicImageColor", <1,0,0>) - RuiSetFloat3(bar, "basicImageColor", GetControlColorForMod( modName ) ) + RuiSetFloat3(bar, "basicImageColor", GetControlColorForMod( modEnabled ) ) Hud_SetVisible( bar_element, true ) } -vector function GetControlColorForMod( string modName ) +vector function GetControlColorForMod( bool modEnabled ) { - if ( NSIsModEnabled( modName ) ) + if ( modEnabled ) switch ( GetConVarInt( "colorblind_mode" ) ) { case 1: @@ -601,48 +519,36 @@ vector function GetControlColorForMod( string modName ) unreachable } -string function FormatModDescription( string modName ) +string function FormatModDescription( Mod mod ) { - string ornull modVersion = NSGetModVersionByModName( modName ); // Returns null for mods that aren't found. + string ret + // version + ret += format( "Version %s\n", mod.version ) - if( modVersion != null ) - { - string ret - - // version - ret += format( "Version %s\n", modVersion ) + // load priority + ret += format( "Load Priority: %i\n", mod.loadPriority ) - // load priority - ret += format( "Load Priority: %i\n", expect int( NSGetModLoadPriority( modName ) ) ) + // convars + array modCvars = mod.conVars + if ( modCvars.len() != 0 && GetConVarBool( "modlist_show_convars" ) ) + { + ret += "ConVars: " - // convars - array modCvars = NSGetModConvarsByModName( modName ) - if ( modCvars.len() != 0 && GetConVarBool( "modlist_show_convars" ) ) + for ( int i = 0; i < modCvars.len(); i++ ) { - ret += "ConVars: " - - for ( int i = 0; i < modCvars.len(); i++ ) - { - if ( i != modCvars.len() - 1 ) - ret += format( "\"%s\", ", modCvars[ i ] ) - else - ret += format( "\"%s\"", modCvars[ i ] ) - } - - ret += "\n" + if ( i != modCvars.len() - 1 ) + ret += format( "\"%s\", ", modCvars[ i ] ) + else + ret += format( "\"%s\"", modCvars[ i ] ) } - // description - ret += format( "\n%s\n", expect string( NSGetModDescriptionByModName( modName ) ) ) - return ret - } - else // optimally should store if a mod is invalid in the struct instead of going by mod names not found, but this is alredy a big pile of spaghetti code so I can't be bothered - { - // If a mod is named e.g. "R2Northstar/mods/FunnyMod" and another mod is incorrectly installed under that path, the "you installed incorrect bla bla" will not show up, but the mods' description - return Localize( "#INCORRECT_MOD_INSTALL_DESCRIPTION_DEFAULT" ) + ret += "\n" } - unreachable + // description + ret += format( "\n%s\n", mod.description ) + + return ret } //////////// @@ -805,3 +711,16 @@ void function ReloadMods() // 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" ) } + +//////////// +// Sorting +//////////// + +int function SortModsByAscendingPriority( Mod a, Mod b ) +{ + if ( a.loadPriority > b.loadPriority ) + return 1 + else if ( a. loadPriority < b.loadPriority ) + return -1 + return 0 +} 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 7ea8134a8..ac2d764af 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut @@ -959,13 +959,16 @@ void function OnServerSelected( var button ) file.lastSelectedServer = server - foreach ( RequiredModInfo mod in server.requiredMods ) + foreach ( RequiredModInfo requiredMod in server.requiredMods ) { - if ( !NSGetModNames().contains( mod.name ) ) + Mod ornull localMod = GetModByName( requiredMod.name ) + bool modNotInstalled + + if ( localMod == null ) { DialogData dialogData dialogData.header = "#ERROR" - dialogData.message = format( "Missing mod \"%s\" v%s", mod.name, mod.version ) + dialogData.message = format( "Missing mod \"%s\" v%s", requiredMod.name, requiredMod.version ) dialogData.image = $"ui/menu/common/dialog_error" #if PC_PROG @@ -981,9 +984,11 @@ void function OnServerSelected( var button ) } else { + expect Mod( localMod ) + // this uses semver https://semver.org - array serverModVersion = split( mod.name, "." ) - array clientModVersion = split( NSGetModVersionByModName( mod.name ), "." ) + array serverModVersion = split( requiredMod.name, "." ) + array clientModVersion = split( localMod.name, "." ) bool semverFail = false // if server has invalid semver don't bother checking @@ -1001,7 +1006,7 @@ void function OnServerSelected( var button ) { DialogData dialogData dialogData.header = "#ERROR" - dialogData.message = format( "Server has mod \"%s\" v%s while we have v%s", mod.name, mod.version, NSGetModVersionByModName( mod.name ) ) + dialogData.message = format( "Server has mod \"%s\" v%s while we have v%s", requiredMod.name, requiredMod.version, localMod.version ) dialogData.image = $"ui/menu/common/dialog_error" #if PC_PROG @@ -1064,10 +1069,13 @@ void function ThreadedAuthAndConnectToServer( string password = "" ) // unload mods we don't need, load necessary ones and reload mods before connecting foreach ( RequiredModInfo mod in file.lastSelectedServer.requiredMods ) { - if ( NSIsModRequiredOnClient( mod.name ) ) + Mod ornull localMod = GetModByName( mod.name ) + expect Mod( localMod ) + if ( localMod.requiredOnClient ) { - modsChanged = modsChanged || NSIsModEnabled( mod.name ) != file.lastSelectedServer.requiredMods.contains( mod ) - NSSetModEnabled( mod.name, file.lastSelectedServer.requiredMods.contains( mod ) ) + bool setModEnabled = file.lastSelectedServer.requiredMods.contains( mod ) + modsChanged = modsChanged || localMod.enabled != setModEnabled + NSSetModEnabled( localMod.index, setModEnabled ) } } diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_setversionlabel.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_setversionlabel.nut index b1b0b3fb8..77cf8d804 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_setversionlabel.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_setversionlabel.nut @@ -3,8 +3,10 @@ global function NS_SetVersionLabel void function NS_SetVersionLabel() { - var mainMenu = GetMenu( "MainMenu" ) //Gets main menu element - var versionLabel = GetElementsByClassname( mainMenu, "nsVersionClass" )[0] //Gets the label from the mainMenu element. - Hud_SetText( versionLabel, "v" + expect string( NSGetModVersionByModName( "Northstar.Client" ) )) //Sets the label text (Getting Northstar version from Northstar.Client) + var mainMenu = GetMenu( "MainMenu" ) // Gets main menu element + var versionLabel = GetElementsByClassname( mainMenu, "nsVersionClass" )[0] // Gets the label from the mainMenu element. + + Mod ornull nsClient = GetModByName( "Northstar.Client" ) + Hud_SetText( versionLabel, "v" + expect Mod( nsClient ).version ) // Sets the label text (Getting Northstar version from Northstar.Client) } diff --git a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut index 75bc203ff..b94023018 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut @@ -63,7 +63,6 @@ void function InitMainMenuPanel() void function( var button ) { AdvanceMenu( GetMenu( "ModListMenu" ) ) - ScrollToModListIndex( 0 ) } ) @@ -201,9 +200,11 @@ void function ShowInvalidModsHint() { wait 1.0 // wait a bit before showing the warning to give UI a chance to not lag / load - array< table< string, string > > invalidMods = NSGetInvalidMods() - if( !invalidMods.len() ) + array invalidMods = NSGetInvalidMods() + + if( !invalidMods.len() ) // Don't show if all mods are installed correctly return + var panel = Hud_GetChild( file.panel, "NSInvalidModsHint" ) int width = Hud_GetWidth( Hud_GetChild( panel, "Text" ) ) + 110 // autowide is a bit scuffed and doesn't take everything into account @@ -453,9 +454,10 @@ void function UpdatePlayButton( var button ) { // restrict non-vanilla players from accessing official servers bool hasNonVanillaMods = false - foreach ( string modName in NSGetModNames() ) + + foreach ( Mod mod in NSGetMods() ) { - if ( NSIsModEnabled( modName ) && NSIsModRequiredOnClient( modName ) ) + if( mod.enabled && mod.requiredOnClient ) { hasNonVanillaMods = true break From f4bc4074658e2a66dddfc23687418399582970c2 Mon Sep 17 00:00:00 2001 From: uniboi Date: Sun, 7 May 2023 19:17:55 +0200 Subject: [PATCH 09/16] add new functions to nativefuncs.json --- .github/nativefuncs.json | 168 ++++++++------------------------------- 1 file changed, 33 insertions(+), 135 deletions(-) diff --git a/.github/nativefuncs.json b/.github/nativefuncs.json index ad8ff0d7a..a76e4ccaf 100644 --- a/.github/nativefuncs.json +++ b/.github/nativefuncs.json @@ -1,64 +1,28 @@ { "SERVER":[ - { - "name":"NSGetModNames", - "helpText":"", - "returnTypeString":"array", - "argTypes":"" - }, - { - "name":"NSIsModEnabled", - "helpText":"", - "returnTypeString":"bool", - "argTypes":"string modName" - }, { "name":"NSSetModEnabled", "helpText":"", "returnTypeString":"void", - "argTypes":"string modName, bool enabled" - }, - { - "name":"NSGetModDescriptionByModName", - "helpText":"", - "returnTypeString":"string ornull", - "argTypes":"string modName" + "argTypes":"int index, bool enabled" }, { - "name":"NSGetModVersionByModName", - "helpText":"", - "returnTypeString":"string ornull", - "argTypes":"string modName" - }, - { - "name":"NSGetModDownloadLinkByModName", - "helpText":"", - "returnTypeString":"string ornull", - "argTypes":"string modName" - }, - { - "name":"NSGetModLoadPriority", - "helpText":"", - "returnTypeString":"int", - "argTypes":"string modName" - }, - { - "name":"NSIsModRequiredOnClient", - "helpText":"", - "returnTypeString":"bool", - "argTypes":"string modName" + "name":"NSGetMods", + "helpText":"Get all installed mods", + "returnTypeString":"array", + "argTypes":"" }, { - "name":"NSGetModConvarsByModName", - "helpText":"", - "returnTypeString":"array", - "argTypes":"string modName" + "name":"NSGetInvalidMods", + "helpText":"Get all mods that are installed in a subfolder", + "returnTypeString":"array", + "argTypes":"" }, { - "name":"NSGetInvalidMods", + "name":"NSReloadMods", "helpText":"", - "returnTypeString":"array", - "argTypes":"string modName" + "returnTypeString":"void", + "argTypes":"" }, { "name":"DecodeJSON", @@ -206,59 +170,29 @@ "returnTypeString":"void", "argTypes":"int context, string text" }, - { - "name":"NSGetModNames", - "helpText":"", - "returnTypeString":"array", - "argTypes":"" - }, - { - "name":"NSIsModEnabled", - "helpText":"", - "returnTypeString":"bool", - "argTypes":"string modName" - }, { "name":"NSSetModEnabled", "helpText":"", "returnTypeString":"void", - "argTypes":"string modName, bool enabled" + "argTypes":"int index, bool enabled" }, { - "name":"NSGetModDescriptionByModName", - "helpText":"", - "returnTypeString":"string", - "argTypes":"string modName" - }, - { - "name":"NSGetModVersionByModName", - "helpText":"", - "returnTypeString":"string", - "argTypes":"string modName" - }, - { - "name":"NSGetModDownloadLinkByModName", - "helpText":"", - "returnTypeString":"string", - "argTypes":"string modName" - }, - { - "name":"NSGetModLoadPriority", - "helpText":"", - "returnTypeString":"int", - "argTypes":"string modName" + "name":"NSGetMods", + "helpText":"Get all installed mods", + "returnTypeString":"array", + "argTypes":"" }, { - "name":"NSIsModRequiredOnClient", - "helpText":"", - "returnTypeString":"bool", - "argTypes":"string modName" + "name":"NSGetInvalidMods", + "helpText":"Get all mods that are installed in a subfolder", + "returnTypeString":"array", + "argTypes":"" }, { - "name":"NSGetModConvarsByModName", + "name":"NSReloadMods", "helpText":"", - "returnTypeString":"array", - "argTypes":"string modName" + "returnTypeString":"void", + "argTypes":"" }, { "name":"DecodeJSON", @@ -364,59 +298,23 @@ "returnTypeString":"var", "argTypes":"int promoDataKey" }, - { - "name":"NSGetModNames", - "helpText":"", - "returnTypeString":"array", - "argTypes":"" - }, - { - "name":"NSIsModEnabled", - "helpText":"", - "returnTypeString":"bool", - "argTypes":"string modName" - }, { "name":"NSSetModEnabled", "helpText":"", "returnTypeString":"void", - "argTypes":"string modName, bool enabled" + "argTypes":"int index, bool enabled" }, { - "name":"NSGetModDescriptionByModName", - "helpText":"", - "returnTypeString":"string", - "argTypes":"string modName" - }, - { - "name":"NSGetModVersionByModName", - "helpText":"", - "returnTypeString":"string", - "argTypes":"string modName" - }, - { - "name":"NSGetModDownloadLinkByModName", - "helpText":"", - "returnTypeString":"string", - "argTypes":"string modName" - }, - { - "name":"NSGetModLoadPriority", - "helpText":"", - "returnTypeString":"int", - "argTypes":"string modName" - }, - { - "name":"NSIsModRequiredOnClient", - "helpText":"", - "returnTypeString":"bool", - "argTypes":"string modName" + "name":"NSGetMods", + "helpText":"Get all installed mods", + "returnTypeString":"array", + "argTypes":"" }, { - "name":"NSGetModConvarsByModName", - "helpText":"", - "returnTypeString":"array", - "argTypes":"string modName" + "name":"NSGetInvalidMods", + "helpText":"Get all mods that are installed in a subfolder", + "returnTypeString":"array", + "argTypes":"" }, { "name":"NSReloadMods", From 4011dcbbd070e38218474006ce9b3ae1719cc6bf Mon Sep 17 00:00:00 2001 From: uniboi Date: Sun, 7 May 2023 21:06:55 +0200 Subject: [PATCH 10/16] store last selected panel for extra information --- .../scripts/vscripts/ui/menu_ns_modmenu.nut | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) 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 88af87b44..085a3f879 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut @@ -38,7 +38,7 @@ struct { array enabledMods var currentButton string searchTerm - Mod& lastMod + PanelContent& lastPanel } file const int PANELS_LEN = 15 @@ -175,20 +175,22 @@ void function OnModButtonFocused( var button ) return file.currentButton = button - file.lastMod = file.mods[ int ( Hud_GetScriptID( Hud_GetParent( button ) ) ) + file.scrollOffset - 1 ].mod + file.lastPanel = file.mods[ int ( Hud_GetScriptID( Hud_GetParent( button ) ) ) + file.scrollOffset - 1 ] + Mod lastMod = file.lastPanel.mod + var rui = Hud_GetRui( Hud_GetChild( file.menu, "LabelDetails" ) ) RuiSetGameTime( rui, "startTime", -99999.99 ) // make sure it skips the whole animation for showing this - RuiSetString( rui, "headerText", file.lastMod.name ) - RuiSetString( rui, "messageText", FormatModDescription( file.lastMod ) ) + RuiSetString( rui, "headerText", lastMod.name ) + RuiSetString( rui, "messageText", FormatModDescription( lastMod ) ) // Add a button to open the link with if required var linkButton = Hud_GetChild( file.menu, "ModPageButton" ) - if ( file.lastMod.link.len() ) + if ( lastMod.link.len() ) { Hud_SetEnabled( linkButton, true ) Hud_SetVisible( linkButton, true ) - Hud_SetText( linkButton, file.lastMod.link ) + Hud_SetText( linkButton, lastMod.link ) } else { @@ -196,10 +198,10 @@ void function OnModButtonFocused( var button ) Hud_SetVisible( linkButton, false ) } - SetControlBarColor( file.lastMod.enabled ) + SetControlBarColor( file.lastPanel.mod.enabled ) - Hud_SetVisible( Hud_GetChild( file.menu, "WarningLegendLabel" ), file.lastMod.requiredOnClient ) - Hud_SetVisible( Hud_GetChild( file.menu, "WarningLegendImage" ), file.lastMod.requiredOnClient ) + Hud_SetVisible( Hud_GetChild( file.menu, "WarningLegendLabel" ), file.lastPanel.mod.requiredOnClient ) + Hud_SetVisible( Hud_GetChild( file.menu, "WarningLegendImage" ), file.lastPanel.mod.requiredOnClient ) } void function OnModButtonPressed( var button ) @@ -265,10 +267,10 @@ void function OnBtnFiltersClear_Activate( var button ) void function OnHideConVarsChange( var n ) { - if ( file.lastMod.name == "" ) // not sure if this is stil needed. Leaving it in just to be sure + if ( file.lastPanel.mod.name == "" ) // not sure if this is stil needed. Leaving it in just to be sure return var rui = Hud_GetRui( Hud_GetChild( file.menu, "LabelDetails" ) ) - RuiSetString( rui, "messageText", FormatModDescription( file.lastMod ) ) + RuiSetString( rui, "messageText", FormatModDescription( file.lastPanel.mod ) ) } // LIST LOGIC @@ -340,7 +342,7 @@ void function AddInvalidModsToPanels() PanelContent headerPanel = { type = PanelType.HEADER, ... } Mod header - header.name = format( "Incorrectly installed mods (%i)", invalidMods.len() ) + header.name = Localize( "#INCORRECT_MODS_MODLIST_HEADER", invalidMods.len() ) headerPanel.mod = header file.mods.append( headerPanel ) From 2b4fb8d65bdcd670b5753cf1c168905fbbe656ce Mon Sep 17 00:00:00 2001 From: uniboi Date: Sun, 7 May 2023 21:07:46 +0200 Subject: [PATCH 11/16] rename vars for more precision --- .../scripts/vscripts/ui/menu_ns_modmenu.nut | 66 +++++++++---------- 1 file changed, 33 insertions(+), 33 deletions(-) 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 085a3f879..ad48d8f0a 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut @@ -31,9 +31,9 @@ struct { } mouseDeltaBuffer struct { - array mods + array panels var menu - array panels + array uiPanels int scrollOffset = 0 array enabledMods var currentButton @@ -70,7 +70,7 @@ void function AdvanceToModListMenu( var button ) void function InitModMenu() { file.menu = GetMenu( "ModListMenu" ) - file.panels = GetElementsByClassname( file.menu, "ModSelectorPanel" ) + file.uiPanels = GetElementsByClassname( file.menu, "ModSelectorPanel" ) var rui = Hud_GetRui( Hud_GetChild( file.menu, "WarningLegendImage" ) ) RuiSetImage( rui, "basicImage", $"ui/menu/common/dialog_error" ) @@ -78,7 +78,7 @@ void function InitModMenu() RuiSetFloat( Hud_GetRui( Hud_GetChild( file.menu, "ModEnabledBar" ) ), "basicImageAlpha", 0.8 ) // Mod buttons - foreach ( var panel in file.panels ) + foreach ( var panel in file.uiPanels ) { var button = Hud_GetChild( panel, "BtnMod" ) AddButtonEventHandler( button, UIE_GET_FOCUS, OnModButtonFocused ) @@ -171,11 +171,11 @@ void function OnModMenuClosed() void function OnModButtonFocused( var button ) { - if( int ( Hud_GetScriptID( Hud_GetParent( button ) ) ) > file.mods.len() ) + if( int ( Hud_GetScriptID( Hud_GetParent( button ) ) ) > file.panels.len() ) return file.currentButton = button - file.lastPanel = file.mods[ int ( Hud_GetScriptID( Hud_GetParent( button ) ) ) + file.scrollOffset - 1 ] + file.lastPanel = file.panels[ int ( Hud_GetScriptID( Hud_GetParent( button ) ) ) + file.scrollOffset - 1 ] Mod lastMod = file.lastPanel.mod var rui = Hud_GetRui( Hud_GetChild( file.menu, "LabelDetails" ) ) @@ -206,7 +206,7 @@ void function OnModButtonFocused( var button ) void function OnModButtonPressed( var button ) { - PanelContent pc = file.mods[ int ( Hud_GetScriptID( Hud_GetParent( button ) ) ) + file.scrollOffset - 1 ] + PanelContent pc = file.panels[ int ( Hud_GetScriptID( Hud_GetParent( button ) ) ) + file.scrollOffset - 1 ] Mod mod = pc.mod if ( pc.type == PanelType.INVALID_MOD ) @@ -219,7 +219,7 @@ void function OnModButtonPressed( var button ) { NSSetModEnabled( mod.index, !mod.enabled ) mod.enabled = !mod.enabled - var panel = file.panels[ int ( Hud_GetScriptID( Hud_GetParent( button ) ) ) - 1 ] + var panel = file.uiPanels[ int ( Hud_GetScriptID( Hud_GetParent( button ) ) ) - 1 ] SetControlBoxColor( Hud_GetChild( panel, "ControlBox" ), mod.enabled ) SetControlBarColor( mod.enabled ) SetModEnabledHelperImageAsset( Hud_GetChild( panel, "EnabledImage" ), mod ) @@ -241,7 +241,7 @@ void function OnAuthenticationAgreementButtonPressed( var button ) void function OnModLinkButtonPressed( var button ) { - string link = file.mods[ int ( Hud_GetScriptID( Hud_GetParent( file.currentButton ) ) ) + file.scrollOffset - 1 ].mod.link + string link = file.panels[ int ( Hud_GetScriptID( Hud_GetParent( file.currentButton ) ) ) + file.scrollOffset - 1 ].mod.link if ( link.find("http://") != 0 && link.find("https://") != 0 ) link = format( "http://%s", link ) // links without the http or https protocol get opened in the internal browser LaunchExternalWebBrowser( link, WEBBROWSER_FLAG_FORCEEXTERNAL ) @@ -293,12 +293,12 @@ void function CoreModToggleDialog( string mod ) void function DisableMod() { - Mod mod = file.mods[ int ( Hud_GetScriptID( Hud_GetParent( file.currentButton ) ) ) + file.scrollOffset - 1 ].mod + Mod mod = file.panels[ int ( Hud_GetScriptID( Hud_GetParent( file.currentButton ) ) ) + file.scrollOffset - 1 ].mod NSSetModEnabled( mod.index, false ) mod.enabled = false - var panel = file.panels[ int ( Hud_GetScriptID( Hud_GetParent( file.currentButton ) ) ) - 1] + var panel = file.uiPanels[ int ( Hud_GetScriptID( Hud_GetParent( file.currentButton ) ) ) - 1] SetControlBoxColor( Hud_GetChild( panel, "ControlBox" ), mod.enabled ) SetControlBarColor( mod.enabled ) SetModEnabledHelperImageAsset( Hud_GetChild( panel, "EnabledImage" ), mod ) @@ -319,7 +319,7 @@ array function GetEnabledModNames() void function HideAllPanels() { - foreach ( var panel in file.panels ) + foreach ( var panel in file.uiPanels ) { Hud_SetEnabled( panel, false ) Hud_SetVisible( panel, false ) @@ -345,7 +345,7 @@ void function AddInvalidModsToPanels() header.name = Localize( "#INCORRECT_MODS_MODLIST_HEADER", invalidMods.len() ) headerPanel.mod = header - file.mods.append( headerPanel ) + file.panels.append( headerPanel ) foreach ( invalidMod in invalidMods ) { @@ -354,13 +354,13 @@ void function AddInvalidModsToPanels() p.mod.enabled = false // the mod might not be explicitly disabled in enabledmods.json, but should always show as disabled in the list - file.mods.append( p ) + file.panels.append( p ) } } void function RefreshMods() { - file.mods.clear() + file.panels.clear() string searchTerm = Hud_GetUTF8Text( Hud_GetChild( file.menu, "BtnModsSearch" ) ).tolower() array mods = NSGetMods() @@ -410,24 +410,24 @@ void function RefreshMods() pc.mod = m pc.type = PanelType.HEADER - file.mods.append( pc ) + file.panels.append( pc ) } PanelContent pc pc.type = PanelType.MOD pc.mod = mod - file.mods.append( pc ) + file.panels.append( pc ) } } void function DisplayModPanels() { - foreach ( int i, var panel in file.panels) + foreach ( int i, var panel in file.uiPanels) { - if ( i >= file.mods.len() || file.scrollOffset + i >= file.mods.len() ) // don't try to show more panels than needed + if ( i >= file.panels.len() || file.scrollOffset + i >= file.panels.len() ) // don't try to show more panels than needed break - PanelContent c = file.mods[ file.scrollOffset + i ] + PanelContent c = file.panels[ file.scrollOffset + i ] Mod mod = c.mod var btn = Hud_GetChild( panel, "BtnMod" ) var headerLabel = Hud_GetChild( panel, "Header" ) @@ -569,7 +569,7 @@ void function UpdateMouseDeltaBuffer(int x, int y) void function SliderBarUpdate() { - if ( file.mods.len() <= 15 ) + if ( file.panels.len() <= 15 ) return var sliderButton = Hud_GetChild( file.menu , "BtnModListSlider" ) @@ -583,7 +583,7 @@ void function SliderBarUpdate() float maxYPos = minYPos - (maxHeight - Hud_GetHeight( sliderPanel )) float useableSpace = (maxHeight - Hud_GetHeight( sliderPanel )) - float jump = minYPos - (useableSpace / ( float( file.mods.len()))) + float jump = minYPos - (useableSpace / ( float( file.panels.len()))) // got local from official respaw scripts, without untyped throws an error local pos = Hud_GetPos(sliderButton)[1] @@ -596,7 +596,7 @@ void function SliderBarUpdate() Hud_SetPos( sliderPanel , 2, newPos ) Hud_SetPos( movementCapture , 2, newPos ) - file.scrollOffset = -int( ( (newPos - minYPos) / useableSpace ) * ( file.mods.len() - PANELS_LEN) ) + file.scrollOffset = -int( ( (newPos - minYPos) / useableSpace ) * ( file.panels.len() - PANELS_LEN) ) UpdateList() } @@ -606,7 +606,7 @@ void function UpdateListSliderPosition() var sliderPanel = Hud_GetChild( file.menu , "BtnModListSliderPanel" ) var movementCapture = Hud_GetChild( file.menu , "MouseMovementCapture" ) - float mods = float ( file.mods.len() ) + float mods = float ( file.panels.len() ) float minYPos = -40.0 * (GetScreenSize()[1] / 1080.0) float useableSpace = (604.0 * (GetScreenSize()[1] / 1080.0) - Hud_GetHeight( sliderPanel )) @@ -626,7 +626,7 @@ void function UpdateListSliderHeight() var sliderPanel = Hud_GetChild( file.menu , "BtnModListSliderPanel" ) var movementCapture = Hud_GetChild( file.menu , "MouseMovementCapture" ) - float mods = float ( file.mods.len() ) + float mods = float ( file.panels.len() ) float maxHeight = 604.0 * (GetScreenSize()[1] / 1080.0) float minHeight = 80.0 * (GetScreenSize()[1] / 1080.0) @@ -643,10 +643,10 @@ void function UpdateListSliderHeight() void function OnScrollDown( var button ) { - if ( file.mods.len() <= PANELS_LEN ) return + if ( file.panels.len() <= PANELS_LEN ) return file.scrollOffset += 5 - if (file.scrollOffset + PANELS_LEN > file.mods.len()) - file.scrollOffset = file.mods.len() - PANELS_LEN + if (file.scrollOffset + PANELS_LEN > file.panels.len()) + file.scrollOffset = file.panels.len() - PANELS_LEN Hud_SetFocused( Hud_GetChild( file.menu, "BtnModListSlider" ) ) ValidateScrollOffset() } @@ -662,10 +662,10 @@ void function OnScrollUp( var button ) void function OnDownArrowSelected( var button ) { - if ( file.mods.len() <= PANELS_LEN ) return + if ( file.panels.len() <= PANELS_LEN ) return file.scrollOffset += 1 - if (file.scrollOffset + PANELS_LEN > file.mods.len()) - file.scrollOffset = file.mods.len() - PANELS_LEN + if (file.scrollOffset + PANELS_LEN > file.panels.len()) + file.scrollOffset = file.panels.len() - PANELS_LEN ValidateScrollOffset() } @@ -680,8 +680,8 @@ void function OnUpArrowSelected( var button ) void function ValidateScrollOffset() { RefreshMods() - if( file.scrollOffset + 15 > file.mods.len() ) - file.scrollOffset = file.mods.len() - 15 + if( file.scrollOffset + 15 > file.panels.len() ) + file.scrollOffset = file.panels.len() - 15 if( file.scrollOffset < 0 ) file.scrollOffset = 0 HideAllPanels() From ad3557a6f0568624f5c81b9036faba714c5b15ae Mon Sep 17 00:00:00 2001 From: uniboi Date: Sun, 7 May 2023 21:15:05 +0200 Subject: [PATCH 12/16] use localized helptext for incorrect installs --- .../northstar_client_localisation_english.txt | 1 - .../scripts/vscripts/ui/menu_ns_modmenu.nut | 28 +++++++++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/Northstar.Client/mod/resource/northstar_client_localisation_english.txt b/Northstar.Client/mod/resource/northstar_client_localisation_english.txt index 458903cb9..23cc4505a 100644 --- a/Northstar.Client/mod/resource/northstar_client_localisation_english.txt +++ b/Northstar.Client/mod/resource/northstar_client_localisation_english.txt @@ -326,6 +326,5 @@ Press Yes if you agree to this. This choice can be changed in the mods menu at a "INCORRECT_MOD_INSTALL_TOAST" "Some of your mods are incorrectly installed. Click here for more info." "INCORRECT_MODS_MODLIST_HEADER" "Incorrectly Installed Mods (%s1)" "INCORRECT_MOD_INSTALL_DESCRIPTION" "This mod is incorrectly installed. Every mod has a file called \"mod.json\" in its root directory, however for this mod it was not found.\n\nExpected location: %s1\nFound location: %s2\n\nMake sure both mod.json file and mod directory are direct children of your mod folder." - "INCORRECT_MOD_INSTALL_DESCRIPTION_DEFAULT" "This mod is incorrectly installed.\nAn error occured while determining details for this description please open a ticket on Discord or an issue on GitHub." } } 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 ad48d8f0a..5d9496da3 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut @@ -182,7 +182,7 @@ void function OnModButtonFocused( var button ) RuiSetGameTime( rui, "startTime", -99999.99 ) // make sure it skips the whole animation for showing this RuiSetString( rui, "headerText", lastMod.name ) - RuiSetString( rui, "messageText", FormatModDescription( lastMod ) ) + RuiSetString( rui, "messageText", FormatPanelDescription( file.lastPanel ) ) // Add a button to open the link with if required var linkButton = Hud_GetChild( file.menu, "ModPageButton" ) @@ -270,7 +270,7 @@ void function OnHideConVarsChange( var n ) if ( file.lastPanel.mod.name == "" ) // not sure if this is stil needed. Leaving it in just to be sure return var rui = Hud_GetRui( Hud_GetChild( file.menu, "LabelDetails" ) ) - RuiSetString( rui, "messageText", FormatModDescription( file.lastPanel.mod ) ) + RuiSetString( rui, "messageText", FormatPanelDescription( file.lastPanel ) ) } // LIST LOGIC @@ -521,6 +521,21 @@ vector function GetControlColorForMod( bool modEnabled ) unreachable } +string function FormatPanelDescription( PanelContent panel ) +{ + if ( panel.type == PanelType.INVALID_MOD ) + return Localize( + "#INCORRECT_MOD_INSTALL_DESCRIPTION", + format( + "%s/mods%s", + panel.mod.installLocation.slice( 0, panel.mod.installLocation.find("/") ), + panel.mod.installLocation.slice( FindLast( panel.mod.installLocation, '/' ) ) + ), + panel.mod.installLocation + ) + return FormatModDescription( panel.mod ) +} + string function FormatModDescription( Mod mod ) { string ret @@ -726,3 +741,12 @@ int function SortModsByAscendingPriority( Mod a, Mod b ) return -1 return 0 } + +int function FindLast(string s, int c) +{ + int index = -1 + foreach( int i, sc in s ) + if( sc == c ) + index = i + return index +} From 093c0eed6650d0a58b14ad54d56e21d532ac739c Mon Sep 17 00:00:00 2001 From: uniboi Date: Wed, 10 May 2023 09:48:20 +0200 Subject: [PATCH 13/16] mention mod.json in the expected & actual path --- .../mod/resource/northstar_client_localisation_english.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Northstar.Client/mod/resource/northstar_client_localisation_english.txt b/Northstar.Client/mod/resource/northstar_client_localisation_english.txt index 23cc4505a..2d0230cfe 100644 --- a/Northstar.Client/mod/resource/northstar_client_localisation_english.txt +++ b/Northstar.Client/mod/resource/northstar_client_localisation_english.txt @@ -325,6 +325,6 @@ Press Yes if you agree to this. This choice can be changed in the mods menu at a // Incorrect Mod Installation "INCORRECT_MOD_INSTALL_TOAST" "Some of your mods are incorrectly installed. Click here for more info." "INCORRECT_MODS_MODLIST_HEADER" "Incorrectly Installed Mods (%s1)" - "INCORRECT_MOD_INSTALL_DESCRIPTION" "This mod is incorrectly installed. Every mod has a file called \"mod.json\" in its root directory, however for this mod it was not found.\n\nExpected location: %s1\nFound location: %s2\n\nMake sure both mod.json file and mod directory are direct children of your mod folder." + "INCORRECT_MOD_INSTALL_DESCRIPTION" "This mod is incorrectly installed. Every mod has a file called \"mod.json\" in its root directory, however for this mod it was not found.\n\nExpected location: %s1/mod.json\nFound location: %s2/mod.json\n\nMake sure both mod.json file and mod directory are direct children of your mod folder." } } From 8e7325949a75854320185024bc51b101a470ba20 Mon Sep 17 00:00:00 2001 From: Remy Raes Date: Mon, 22 May 2023 18:13:20 +0200 Subject: [PATCH 14/16] feat: add missing translations --- .../mod/resource/northstar_client_localisation_french.txt | 5 +++++ .../mod/resource/northstar_client_localisation_german.txt | 5 +++++ .../mod/resource/northstar_client_localisation_italian.txt | 5 +++++ .../resource/northstar_client_localisation_japanese.txt | 5 +++++ .../resource/northstar_client_localisation_mspanish.txt | 7 ++++++- .../resource/northstar_client_localisation_portuguese.txt | 5 +++++ .../mod/resource/northstar_client_localisation_russian.txt | 5 +++++ .../mod/resource/northstar_client_localisation_spanish.txt | 7 ++++++- .../resource/northstar_client_localisation_tchinese.txt | 5 +++++ 9 files changed, 47 insertions(+), 2 deletions(-) diff --git a/Northstar.Client/mod/resource/northstar_client_localisation_french.txt b/Northstar.Client/mod/resource/northstar_client_localisation_french.txt index 2a1991869..5c1afe52e 100644 --- a/Northstar.Client/mod/resource/northstar_client_localisation_french.txt +++ b/Northstar.Client/mod/resource/northstar_client_localisation_french.txt @@ -319,5 +319,10 @@ Choisissez Oui si vous êtes d'accord. Ce choix peut être modifié à tout inst "INVALID_MASTERSERVER_TOKEN" "Jeton du server maître invalide ou expiré" "JSON_PARSE_ERROR" "Une erreur est survenue durant l'analyse JSON" "UNSUPPORTED_VERSION" "La version que vous utilisez n'est plus supportée" + + // Incorrect Mod Installation + "INCORRECT_MOD_INSTALL_TOAST" "Certains mods sont mal installés. Cliquez ici pour plus d'informations." + "INCORRECT_MODS_MODLIST_HEADER" "Mods incorrectement installés (%s1)" + "INCORRECT_MOD_INSTALL_DESCRIPTION" "Ce mod n'a pas correctement été installé. Chaque mod a un fichier nommé \"mod.json\" à sa racine, et celui-ci n'a pas été trouvé pour ce mod.\n\nEmplacement attendu : %s1/mod.json\nEmplacement trouvé : %s2/mod.json\n\nVérifiez que le fichier \"mod.json\" ainsi que le dossier \"mod\" sont directement contenus dans le répertoire du mod." } } diff --git a/Northstar.Client/mod/resource/northstar_client_localisation_german.txt b/Northstar.Client/mod/resource/northstar_client_localisation_german.txt index 0316bbcf7..4ea8f1efa 100644 --- a/Northstar.Client/mod/resource/northstar_client_localisation_german.txt +++ b/Northstar.Client/mod/resource/northstar_client_localisation_german.txt @@ -310,5 +310,10 @@ Drücke Ja, um zuzustimmen. Du kannst diese Entscheidung jederzeit im Modmenü "INVALID_MASTERSERVER_TOKEN" "Ungültiger oder abgelaufener Token vom Masterserver" "JSON_PARSE_ERROR" "Fehler beim Verarbeiten der JSON-Antwort" "UNSUPPORTED_VERSION" "Die Version die du benutzt ist nicht länger unterstützt" + + // Incorrect Mod Installation + "INCORRECT_MOD_INSTALL_TOAST" "Einige Ihrer Mods sind nicht korrekt installiert. Klicken Sie hier für weitere Informationen." + "INCORRECT_MODS_MODLIST_HEADER" "Fehlerhaft installierte Mods (%s1)" + "INCORRECT_MOD_INSTALL_DESCRIPTION" "Dieser Mod ist nicht korrekt installiert. Jede Mod hat eine Datei namens "mod.json" in ihrem Stammverzeichnis, aber für diese Mod wurde sie nicht gefunden.\n\nErwarteter Speicherort: %s1/mod.json\nGefundener Speicherort: %s2/mod.json\n\nStellen Sie sicher, dass sowohl die mod.json-Datei als auch das mod-Verzeichnis direkte Unterordner Ihres mod-Ordners sind." } } diff --git a/Northstar.Client/mod/resource/northstar_client_localisation_italian.txt b/Northstar.Client/mod/resource/northstar_client_localisation_italian.txt index 72bf70309..320a9cc2f 100644 --- a/Northstar.Client/mod/resource/northstar_client_localisation_italian.txt +++ b/Northstar.Client/mod/resource/northstar_client_localisation_italian.txt @@ -319,5 +319,10 @@ Premi Sì se sei d'accordo. Questa scelta può essere modificata in qualsiasi mo "INVALID_MASTERSERVER_TOKEN" "Token Masterserver invalido o scaduto" "JSON_PARSE_ERROR" "Errore nell'analisi di risposta json" "UNSUPPORTED_VERSION" "La versione che stai usando non è più supportata" + + // Incorrect Mod Installation + "INCORRECT_MOD_INSTALL_TOAST" "Alcune mod non sono state installate correttamente. Clicca qui per maggiori informazioni." + "INCORRECT_MODS_MODLIST_HEADER" "Mod installate in modo errato (%s1)" + "INCORRECT_MOD_INSTALL_DESCRIPTION" "Questa mod non è stata installata correttamente. Ogni mod ha un file chiamato "mod.json" nella sua directory principale, ma per questa mod non è stato trovato.\n\nPosizione attesa: %s1/mod.json\nPosizione trovata: %s2/mod.json\n\nAssicurarsi che sia il file mod.json che la directory mod siano figli diretti della cartella mod". } } diff --git a/Northstar.Client/mod/resource/northstar_client_localisation_japanese.txt b/Northstar.Client/mod/resource/northstar_client_localisation_japanese.txt index b7fadeaff..3b973369e 100644 --- a/Northstar.Client/mod/resource/northstar_client_localisation_japanese.txt +++ b/Northstar.Client/mod/resource/northstar_client_localisation_japanese.txt @@ -349,5 +349,10 @@ "UNSUPPORTED_VERSION" "現在使用しているバージョンはサポートされていません\n(The version you are using is no longer supported)" // Translation done by Zetryox and CYakigasi + + // Incorrect Mod Installation + "INCORRECT_MOD_INSTALL_TOAST" "一部のMODが誤ってインストールされています。詳しくはここをクリックしてください。" + "INCORRECT_MODS_MODLIST_HEADER" "不正にインストールされたMOD (%s1)" + "INCORRECT_MOD_INSTALL_DESCRIPTION" "このMODは正しくインストールされていません。すべてのMODはルートディレクトリに「mod.json」というファイルを持ちますが、このMODでは見つかりませんでした\n\nExpected location: %s1/mod.json\nFound location: %s2/mod.json\n\nMODフォルダから直接MODディレクトリとmod.jsonファイルの両方を確認する" } } diff --git a/Northstar.Client/mod/resource/northstar_client_localisation_mspanish.txt b/Northstar.Client/mod/resource/northstar_client_localisation_mspanish.txt index 186346680..2a986445f 100644 --- a/Northstar.Client/mod/resource/northstar_client_localisation_mspanish.txt +++ b/Northstar.Client/mod/resource/northstar_client_localisation_mspanish.txt @@ -318,6 +318,11 @@ Si estas de acuerdo con esto, presiona SI. Esta decision puede ser cambiada en e "PLAYER_NOT_FOUND" "No se encontró la cuenta del jugador" "INVALID_MASTERSERVER_TOKEN" "Token de jugador expirado o invalido" "JSON_PARSE_ERROR" "Error procesando respuesta json" - "UNSUPPORTED_VERSION" "La versión que estas usando ya no esta soportada" + "UNSUPPORTED_VERSION" "La versión que estas usando ya no esta soportada" + + // Incorrect Mod Installation + "INCORRECT_MOD_INSTALL_TOAST" "Algunos de tus mods están instalados incorrectamente. Haz clic aquí para obtener más información." + "INCORRECT_MODS_MODLIST_HEADER" "Mods instalados incorrectamente (%s1)" + "INCORRECT_MOD_INSTALL_DESCRIPTION" "Este mod está instalado incorrectamente. Cada mod tiene un archivo llamado "mod.json" en su directorio raíz, sin embargo para este mod no fue encontrado.\n\nUbicación esperada: %s1/mod.json\nUbicación encontrada: %s2/mod.json\n\nAsegúrese de que tanto el archivo mod.json como el directorio mod son hijos directos de su carpeta mod." } } diff --git a/Northstar.Client/mod/resource/northstar_client_localisation_portuguese.txt b/Northstar.Client/mod/resource/northstar_client_localisation_portuguese.txt index 51854726b..0f761377c 100644 --- a/Northstar.Client/mod/resource/northstar_client_localisation_portuguese.txt +++ b/Northstar.Client/mod/resource/northstar_client_localisation_portuguese.txt @@ -306,5 +306,10 @@ Clique em Sim se você concorda. Esta escolha pode ser alterada a qualquer momen // In-game chat "HUD_CHAT_WHISPER_PREFIX" "[WHISPER]" "HUD_CHAT_SERVER_PREFIX" "[SERVER]" + + // Incorrect Mod Install + "INCORRECT_MOD_INSTALL_TOAST" "Alguns dos teus mods estão incorrectamente instalados. Clique aqui para mais informações." + "INCORRECT_MODS_MODLIST_HEADER" "Mods instalados incorrectamente (%s1)" + "INCORRECT_MOD_INSTALL_DESCRIPTION" "Este mod está instalado incorrectamente. Todos os mods têm um ficheiro chamado \"mod.json\" no seu directório raiz, mas para este mod não foi encontrado.\n\nLocalização esperada: %s1/mod.json\nLocalização encontrada: %s2/mod.json\n\nCertifica-te de que o ficheiro mod.json e o directório mod são filhos directos da tua pasta mod." } } diff --git a/Northstar.Client/mod/resource/northstar_client_localisation_russian.txt b/Northstar.Client/mod/resource/northstar_client_localisation_russian.txt index 9ce0c2e3e..a6af7c217 100644 --- a/Northstar.Client/mod/resource/northstar_client_localisation_russian.txt +++ b/Northstar.Client/mod/resource/northstar_client_localisation_russian.txt @@ -253,5 +253,10 @@ "INVALID_MASTERSERVER_TOKEN" "Срок действия жетона главного сервера истек или не является правильным" "JSON_PARSE_ERROR" "Ошибка разбора ответа json" "UNSUPPORTED_VERSION" "Используемая вами версия больше не поддерживается" + + // Incorrect Mod Install + "INCORRECT_MOD_INSTALL_TOAST" "Некоторые из ваших модов установлены неправильно. Нажмите здесь для получения дополнительной информации." + "INCORRECT_MODS_MODLIST_HEADER" "Incorrectly Installed Mods (%s1)" + "INCORRECT_MOD_INSTALL_DESCRIPTION" "Этот мод установлен неправильно. Каждый мод имеет файл под названием \"mod.json\" в своем корневом каталоге, однако для этого мода он не был найден.\n\nОжидаемое местоположение: %s1/mod.json\nНайдено местоположение: %s2/mod.json\n\nУбедитесь, что файл mod.json и каталог mod являются прямыми дочерними папками вашей папки mod." } } diff --git a/Northstar.Client/mod/resource/northstar_client_localisation_spanish.txt b/Northstar.Client/mod/resource/northstar_client_localisation_spanish.txt index 0dc82570b..365e4ae33 100644 --- a/Northstar.Client/mod/resource/northstar_client_localisation_spanish.txt +++ b/Northstar.Client/mod/resource/northstar_client_localisation_spanish.txt @@ -318,6 +318,11 @@ Presiona Sí al estar de acuerdo. Esta opcion se puede cambiar en el menú de mo "PLAYER_NOT_FOUND" "No se encontró la cuenta del jugador" "INVALID_MASTERSERVER_TOKEN" "Token de jugador expirado o invalido" "JSON_PARSE_ERROR" "Error procesando respuesta json" - "UNSUPPORTED_VERSION" "La versión que estas usando ya no esta soportada" + "UNSUPPORTED_VERSION" "La versión que estas usando ya no esta soportada" + + // Incorrect Mod Installation + "INCORRECT_MOD_INSTALL_TOAST" "Algunos de tus mods están instalados incorrectamente. Haz clic aquí para obtener más información." + "INCORRECT_MODS_MODLIST_HEADER" "Mods instalados incorrectamente (%s1)" + "INCORRECT_MOD_INSTALL_DESCRIPTION" "Este mod está instalado incorrectamente. Cada mod tiene un archivo llamado "mod.json" en su directorio raíz, sin embargo para este mod no fue encontrado.\n\nUbicación esperada: %s1/mod.json\nUbicación encontrada: %s2/mod.json\n\nAsegúrese de que tanto el archivo mod.json como el directorio mod son hijos directos de su carpeta mod." } } diff --git a/Northstar.Client/mod/resource/northstar_client_localisation_tchinese.txt b/Northstar.Client/mod/resource/northstar_client_localisation_tchinese.txt index 12b6cad1b..c5c5af6a0 100644 --- a/Northstar.Client/mod/resource/northstar_client_localisation_tchinese.txt +++ b/Northstar.Client/mod/resource/northstar_client_localisation_tchinese.txt @@ -323,5 +323,10 @@ "INVALID_MASTERSERVER_TOKEN" "主伺服器token過期或無效" "JSON_PARSE_ERROR" "讀取json回應時發生錯誤" "UNSUPPORTED_VERSION" "您的遊戲版本過低" + + // Incorrect Mod Installation + "INCORRECT_MOD_INSTALL_TOAST" "你的一些MOD被错误地安装。点击这里获取更多信息。" + "INCORRECT_MODS_MODLIST_HEADER" "不正确地安装了MODs (%s1)" + "INCORRECT_MOD_INSTALL_DESCRIPTION" "这个MOD的安装不正确。每个mod在它的根目录下都有一个叫mod.json的文件,但是对于这个mod来说,它没有被找到。\n\n预期的位置:%s1/mod.json/n找到的位置:%s2/mod.json\n\n确保mod.json文件和mod目录都是你mod文件夹的直接子文件夹。" } } From 65ff5bef9b149f882a01b47786cda6e564a0b8bb Mon Sep 17 00:00:00 2001 From: uniboi <64006268+uniboi@users.noreply.github.com> Date: Mon, 22 May 2023 18:24:10 +0200 Subject: [PATCH 15/16] italian translation --- .../mod/resource/northstar_client_localisation_italian.txt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Northstar.Client/mod/resource/northstar_client_localisation_italian.txt b/Northstar.Client/mod/resource/northstar_client_localisation_italian.txt index 320a9cc2f..7af500f0f 100644 --- a/Northstar.Client/mod/resource/northstar_client_localisation_italian.txt +++ b/Northstar.Client/mod/resource/northstar_client_localisation_italian.txt @@ -321,8 +321,7 @@ Premi Sì se sei d'accordo. Questa scelta può essere modificata in qualsiasi mo "UNSUPPORTED_VERSION" "La versione che stai usando non è più supportata" // Incorrect Mod Installation - "INCORRECT_MOD_INSTALL_TOAST" "Alcune mod non sono state installate correttamente. Clicca qui per maggiori informazioni." - "INCORRECT_MODS_MODLIST_HEADER" "Mod installate in modo errato (%s1)" - "INCORRECT_MOD_INSTALL_DESCRIPTION" "Questa mod non è stata installata correttamente. Ogni mod ha un file chiamato "mod.json" nella sua directory principale, ma per questa mod non è stato trovato.\n\nPosizione attesa: %s1/mod.json\nPosizione trovata: %s2/mod.json\n\nAssicurarsi che sia il file mod.json che la directory mod siano figli diretti della cartella mod". - } + "INCORRECT_MOD_INSTALL_TOAST" "Alcune delle tue mods sono state installate incorrettamente. Clicca qui per avere più info." + "INCORRECT_MODS_MODLIST_HEADER" "Mods Installate Incorrettamente (%s1)" + "INCORRECT_MOD_INSTALL_DESCRIPTION" "Questa mod è installata incorrettamente. Tutte le mod hanno un file chiamato \"mod.json\" nella loro cartella principale, ma non è stata trovata in questa mod.\n\nPosizione aspettata: %s1/mod.json\nFound location: %s2/mod.json\n\nAssicurati che sia il file mod.json che mod directory siano sottocategorie dirette della tua cartella mod." } } From 4d4df9364038b77ce35f37f428a267d8e608ea59 Mon Sep 17 00:00:00 2001 From: uniboi <64006268+uniboi@users.noreply.github.com> Date: Tue, 30 May 2023 15:35:43 +0000 Subject: [PATCH 16/16] russian & french translations --- .../mod/resource/northstar_client_localisation_french.txt | 6 +++--- .../mod/resource/northstar_client_localisation_russian.txt | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Northstar.Client/mod/resource/northstar_client_localisation_french.txt b/Northstar.Client/mod/resource/northstar_client_localisation_french.txt index b497fa6c6..b5bea14a3 100644 --- a/Northstar.Client/mod/resource/northstar_client_localisation_french.txt +++ b/Northstar.Client/mod/resource/northstar_client_localisation_french.txt @@ -321,9 +321,9 @@ Choisissez Oui si vous êtes d'accord. Ce choix peut être modifié à tout inst "UNSUPPORTED_VERSION" "La version que vous utilisez n'est plus supportée" // Incorrect Mod Installation - "INCORRECT_MOD_INSTALL_TOAST" "Certains mods sont mal installés. Cliquez ici pour plus d'informations." - "INCORRECT_MODS_MODLIST_HEADER" "Mods incorrectement installés (%s1)" - "INCORRECT_MOD_INSTALL_DESCRIPTION" "Ce mod n'a pas correctement été installé. Chaque mod a un fichier nommé \"mod.json\" à sa racine, et celui-ci n'a pas été trouvé pour ce mod.\n\nEmplacement attendu : %s1/mod.json\nEmplacement trouvé : %s2/mod.json\n\nVérifiez que le fichier \"mod.json\" ainsi que le dossier \"mod\" sont directement contenus dans le répertoire du mod." + "INCORRECT_MOD_INSTALL_TOAST" "Certains de vos mods sont incorrectement installés. Cliquez ici pour plus d'informations." + "INCORRECT_MODS_MODLIST_HEADER" "Mods Incorrectement Installés (%s1)" + "INCORRECT_MOD_INSTALL_DESCRIPTION" "Ce mod est incorrectement installé. Chaque mod a un fichier appelé "mod.json" dans son répertoire principal, cependant pour ce mod, il n'a pas été trouvé.\n\nEmplacement attendu : %s1/mod.json\nEmplacement trouvé : %s2/mod.json\n\nAssurez-vous que le fichier mod.json et le répertoire mod sont des enfants directs de votre dossier mod." "MOD_SETTINGS" "Paramètres de mod" "NORTHSTAR_BASE_SETTINGS" "Paramètres de base de Northstar" diff --git a/Northstar.Client/mod/resource/northstar_client_localisation_russian.txt b/Northstar.Client/mod/resource/northstar_client_localisation_russian.txt index a6af7c217..a2d17d1f3 100644 --- a/Northstar.Client/mod/resource/northstar_client_localisation_russian.txt +++ b/Northstar.Client/mod/resource/northstar_client_localisation_russian.txt @@ -255,8 +255,8 @@ "UNSUPPORTED_VERSION" "Используемая вами версия больше не поддерживается" // Incorrect Mod Install - "INCORRECT_MOD_INSTALL_TOAST" "Некоторые из ваших модов установлены неправильно. Нажмите здесь для получения дополнительной информации." - "INCORRECT_MODS_MODLIST_HEADER" "Incorrectly Installed Mods (%s1)" - "INCORRECT_MOD_INSTALL_DESCRIPTION" "Этот мод установлен неправильно. Каждый мод имеет файл под названием \"mod.json\" в своем корневом каталоге, однако для этого мода он не был найден.\n\nОжидаемое местоположение: %s1/mod.json\nНайдено местоположение: %s2/mod.json\n\nУбедитесь, что файл mod.json и каталог mod являются прямыми дочерними папками вашей папки mod." + "INCORRECT_MOD_INSTALL_TOAST" "Некоторые из ваших модов неправильно установлены. Нажмите здесь для подробной информации." + "INCORRECT_MODS_MODLIST_HEADER" "Неправильно Установленных Модов (%s1)" + "INCORRECT_MOD_INSTALL_DESCRIPTION" "Этот мод неправильно установлен. Каждый мод имеет файл \"mod.json\" в его корневой директории, но для этого мода он не был найден.\n\nОжидаемое место: %s1/mod.json\nНайдено место: %s2/mod.json\n\nУдостоверьтесь, что файл mod.json и директория мода находятся в вашей папке модов." } }