diff --git a/.github/nativefuncs.json b/.github/nativefuncs.json index 6f46095fd..2ae7fbd6e 100644 --- a/.github/nativefuncs.json +++ b/.github/nativefuncs.json @@ -1,58 +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", - "argTypes":"string modName" - }, - { - "name":"NSGetModVersionByModName", - "helpText":"", - "returnTypeString":"string", - "argTypes":"string modName" - }, - { - "name":"NSGetModDownloadLinkByModName", - "helpText":"", - "returnTypeString":"string", - "argTypes":"string modName" + "argTypes":"int index, bool enabled" }, { - "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", @@ -248,59 +218,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", @@ -454,59 +394,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" - }, - { - "name":"NSGetModDescriptionByModName", - "helpText":"", - "returnTypeString":"string", - "argTypes":"string modName" - }, - { - "name":"NSGetModVersionByModName", - "helpText":"", - "returnTypeString":"string", - "argTypes":"string modName" + "argTypes":"int index, bool enabled" }, { - "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", diff --git a/Northstar.Client/mod/resource/northstar_client_localisation_english.txt b/Northstar.Client/mod/resource/northstar_client_localisation_english.txt index 5dabd5398..dbc7e0c11 100644 --- a/Northstar.Client/mod/resource/northstar_client_localisation_english.txt +++ b/Northstar.Client/mod/resource/northstar_client_localisation_english.txt @@ -321,6 +321,11 @@ 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" + + // 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/mod.json\nFound location: %s2/mod.json\n\nMake sure both mod.json file and mod directory are direct children of your mod folder." // Mod Settings "MOD_SETTINGS" "Mod Settings" diff --git a/Northstar.Client/mod/resource/northstar_client_localisation_french.txt b/Northstar.Client/mod/resource/northstar_client_localisation_french.txt index d90cea05f..b5bea14a3 100644 --- a/Northstar.Client/mod/resource/northstar_client_localisation_french.txt +++ b/Northstar.Client/mod/resource/northstar_client_localisation_french.txt @@ -320,6 +320,11 @@ Choisissez Oui si vous êtes d'accord. Ce choix peut être modifié à tout inst "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 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" "ONLY_HOST_MATCH_SETTINGS" "Seul l'hôte peut changer les paramètres de match privé" diff --git a/Northstar.Client/mod/resource/northstar_client_localisation_german.txt b/Northstar.Client/mod/resource/northstar_client_localisation_german.txt index f5c814f5a..b239c3f7d 100644 --- a/Northstar.Client/mod/resource/northstar_client_localisation_german.txt +++ b/Northstar.Client/mod/resource/northstar_client_localisation_german.txt @@ -310,6 +310,11 @@ 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." "SNS_LEADER_BANKRUPT_SUB" "%s1 Wurde Von %s2 Zurückgesetzt" } } diff --git a/Northstar.Client/mod/resource/northstar_client_localisation_italian.txt b/Northstar.Client/mod/resource/northstar_client_localisation_italian.txt index 38e67dea4..7ffe67c9b 100644 --- a/Northstar.Client/mod/resource/northstar_client_localisation_italian.txt +++ b/Northstar.Client/mod/resource/northstar_client_localisation_italian.txt @@ -320,6 +320,11 @@ Premi Sì se sei d'accordo. Questa scelta può essere modificata in qualsiasi mo "JSON_PARSE_ERROR" "Errore nell'analisi della risposta json" "UNSUPPORTED_VERSION" "La versione che stai usando non è più supportata" + // Incorrect Mod Installation + "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." } + "MOD_SETTINGS" "Impostazioni Mod" "NORTHSTAR_BASE_SETTINGS" "Impostazioni base Northstar" "ONLY_HOST_MATCH_SETTINGS" "Solo l'Host può modificare le impostazioni della Partita Privata" 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 fe7cf2b35..99945b83c 100644 --- a/Northstar.Client/mod/resource/northstar_client_localisation_russian.txt +++ b/Northstar.Client/mod/resource/northstar_client_localisation_russian.txt @@ -253,6 +253,11 @@ "INVALID_MASTERSERVER_TOKEN" "Срок действия жетона главного сервера истек или не является правильным" "JSON_PARSE_ERROR" "Ошибка разбора ответа json" "UNSUPPORTED_VERSION" "Используемая вами версия больше не поддерживается" + + // Incorrect Mod Install + "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 и директория мода находятся в вашей папке модов." "DISABLE" "Выключить" "DIALOG_AUTHENTICATING_MASTERSERVER" "Аутентификация на главном сервере." "WARNING" "Предупреждение" 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 e543f7117..4e70a1204 100644 --- a/Northstar.Client/mod/resource/northstar_client_localisation_tchinese.txt +++ b/Northstar.Client/mod/resource/northstar_client_localisation_tchinese.txt @@ -323,6 +323,12 @@ "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文件夹的直接子文件夹。" + "NORTHSTAR_BASE_SETTINGS" "北极星基础设置" "ONLY_HOST_CAN_START_MATCH" "只有服主可以開始對局" "MATCH_COUNTDOWN_LENGTH" "私人對局倒計時時間" 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..28da8a0ac --- /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 240" + 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/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 3f643aa3d..5d9496da3 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut @@ -3,20 +3,18 @@ untyped global function AddNorthstarModMenu global function AddNorthstarModMenu_MainMenuFooter global function ReloadMods +global function GetModByName - -struct modData { - string name = "" - string version = "" - string link = "" - int loadPriority = 0 - bool enabled = false - array conVars = [] +enum PanelType +{ + MOD, + INVALID_MOD, + HEADER, } -struct panelContent { - modData& mod - bool isHeader = false +struct PanelContent { + Mod& mod + int type // PanelType } enum filterShow { @@ -33,19 +31,26 @@ struct { } mouseDeltaBuffer struct { - array mods + array panels var menu - array panels + array uiPanels int scrollOffset = 0 array enabledMods var currentButton string searchTerm - modData& lastMod + PanelContent& lastPanel } 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 ) @@ -65,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" ) @@ -73,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 ) @@ -131,7 +136,7 @@ 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() @@ -150,7 +155,7 @@ void function OnModMenuClosed() } catch ( ex ) {} - array current = GetEnabledModsArray() + array current = GetEnabledModNames() bool reload foreach ( string mod in current ) { @@ -166,26 +171,26 @@ 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.lastMod = file.mods[ int ( Hud_GetScriptID( Hud_GetParent( button ) ) ) + file.scrollOffset - 1 ].mod - string modName = file.lastMod.name + 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" ) ) 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, "headerText", lastMod.name ) + RuiSetString( rui, "messageText", FormatPanelDescription( file.lastPanel ) ) // Add a button to open the link with if required - string link = NSGetModDownloadLinkByModName( modName ) var linkButton = Hud_GetChild( file.menu, "ModPageButton" ) - if ( link.len() ) + if ( lastMod.link.len() ) { Hud_SetEnabled( linkButton, true ) Hud_SetVisible( linkButton, true ) - Hud_SetText( linkButton, link ) + Hud_SetText( linkButton, lastMod.link ) } else { @@ -193,26 +198,32 @@ void function OnModButtonFocused( var button ) Hud_SetVisible( linkButton, false ) } - SetControlBarColor( modName ) + SetControlBarColor( file.lastPanel.mod.enabled ) - bool required = NSIsModRequiredOnClient( modName ) - Hud_SetVisible( Hud_GetChild( file.menu, "WarningLegendLabel" ), required ) - Hud_SetVisible( Hud_GetChild( file.menu, "WarningLegendImage" ), required ) + 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 ) { - string modName = file.mods[ int ( Hud_GetScriptID( Hud_GetParent( button ) ) ) + file.scrollOffset - 1 ].mod.name - if ( StaticFind( modName ) && NSIsModEnabled( modName ) ) + PanelContent pc = file.panels[ 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 { - NSSetModEnabled( modName, !NSIsModEnabled( modName ) ) - 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 ) - // RefreshMods() + NSSetModEnabled( mod.index, !mod.enabled ) + mod.enabled = !mod.enabled + 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 ) + UpdateListSliderPosition() UpdateListSliderHeight() } @@ -230,10 +241,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 = NSGetModDownloadLinkByModName( modName ) + 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 = "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 ) } @@ -257,11 +267,10 @@ void function OnBtnFiltersClear_Activate( var button ) void function OnHideConVarsChange( var n ) { - string modName = file.lastMod.name - if ( modName == "" ) + 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( modName ) ) + RuiSetString( rui, "messageText", FormatPanelDescription( file.lastPanel ) ) } // LIST LOGIC @@ -284,31 +293,33 @@ 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.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] - SetControlBoxColor( Hud_GetChild( panel, "ControlBox" ), modName ) - SetControlBarColor( modName ) - SetModEnabledHelperImageAsset( Hud_GetChild( panel, "EnabledImage" ), modName ) + 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 ) 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 } void function HideAllPanels() { - foreach ( var panel in file.panels ) + foreach ( var panel in file.uiPanels ) { Hud_SetEnabled( panel, false ) Hud_SetVisible( panel, false ) @@ -322,161 +333,173 @@ void function UpdateList() DisplayModPanels() } +void function AddInvalidModsToPanels() +{ + array invalidMods = NSGetInvalidMods() + + if ( !invalidMods.len() ) + return + + PanelContent headerPanel = { type = PanelType.HEADER, ... } + Mod header + header.name = Localize( "#INCORRECT_MODS_MODLIST_HEADER", invalidMods.len() ) + headerPanel.mod = header + + file.panels.append( headerPanel ) + + foreach ( invalidMod in invalidMods ) + { + PanelContent p = { type = PanelType.INVALID_MOD, ... } + p.mod = invalidMod + + p.mod.enabled = false // the mod might not be explicitly disabled in enabledmods.json, but should always show as disabled in the list + + file.panels.append( p ) + } +} + void function RefreshMods() { - array modNames = NSGetModNames() - file.mods.clear() + file.panels.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 ? 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 = 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 = NSGetModLoadPriority( mod ) - - if ( reverse ? pr < lastLoadPriority : pr > lastLoadPriority ) + if ( reverse ? mod.loadPriority < lastLoadPriority : mod.loadPriority > lastLoadPriority ) { - modData m - m.name = pr.tostring() - - panelContent c - 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 ) - modData m - m.name = mod - m.version = NSGetModVersionByModName( mod ) - m.link = NSGetModDownloadLinkByModName( mod ) - m.loadPriority = NSGetModLoadPriority( mod ) - m.enabled = enabled - m.conVars = NSGetModConvarsByModName( mod ) + PanelContent pc + pc.mod = m + pc.type = PanelType.HEADER - panelContent c - c.mod = m + file.panels.append( pc ) + } - file.mods.append( c ) + PanelContent pc + pc.type = PanelType.MOD + pc.mod = mod + 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 ] - modData mod = c.mod + PanelContent c = file.panels[ file.scrollOffset + i ] + 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" ) - - if ( c.isHeader ) + + switch ( c.type ) { - Hud_SetEnabled( btn, false ) - Hud_SetVisible( btn, false ) + case PanelType.HEADER: + Hud_SetEnabled( btn, false ) + Hud_SetVisible( btn, false ) - Hud_SetText( headerLabel, "Load Priority: " + mod.name ) - Hud_SetVisible( headerLabel, true ) + Hud_SetText( headerLabel, mod.name ) + Hud_SetVisible( headerLabel, true ) - Hud_SetVisible( box, false ) - Hud_SetVisible( line, true ) + Hud_SetVisible( box, false ) + Hud_SetVisible( line, true ) - 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, false ) + Hud_SetVisible( enabledImage, false ) + break + + case PanelType.MOD: + case PanelType.INVALID_MOD: + Hud_SetEnabled( btn, true ) + Hud_SetVisible( btn, true ) + Hud_SetText( btn, mod.name ) - Hud_SetVisible( headerLabel, false ) + Hud_SetVisible( headerLabel, false ) - SetControlBoxColor( box, mod.name ) - Hud_SetVisible( box, true ) - Hud_SetVisible( line, false ) + SetControlBoxColor( box, mod.enabled ) + Hud_SetVisible( box, true ) + Hud_SetVisible( line, false ) - Hud_SetVisible( warning, NSIsModRequiredOnClient( c.mod.name ) ) + Hud_SetVisible( warning, c.mod.requiredOnClient ) - SetModEnabledHelperImageAsset( enabledImage, c.mod.name ) + SetModEnabledHelperImageAsset( enabledImage, c.mod ) + break } 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: @@ -498,17 +521,32 @@ vector function GetControlColorForMod( string modName ) unreachable } -string function FormatModDescription( string modName ) +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 // version - ret += format( "Version %s\n", NSGetModVersionByModName( modName ) ) + ret += format( "Version %s\n", mod.version ) // load priority - ret += format( "Load Priority: %i\n", NSGetModLoadPriority( modName ) ) + ret += format( "Load Priority: %i\n", mod.loadPriority ) // convars - array modCvars = NSGetModConvarsByModName( modName ) + array modCvars = mod.conVars if ( modCvars.len() != 0 && GetConVarBool( "modlist_show_convars" ) ) { ret += "ConVars: " @@ -525,7 +563,7 @@ string function FormatModDescription( string modName ) } // description - ret += format( "\n%s\n", NSGetModDescriptionByModName( modName ) ) + ret += format( "\n%s\n", mod.description ) return ret } @@ -546,7 +584,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" ) @@ -560,7 +598,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] @@ -573,7 +611,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() } @@ -583,7 +621,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 )) @@ -603,7 +641,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) @@ -620,10 +658,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() } @@ -639,10 +677,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() } @@ -657,8 +695,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() @@ -689,4 +727,26 @@ 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 +} + +//////////// +// 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 +} + +int function FindLast(string s, int c) +{ + int index = -1 + foreach( int i, sc in s ) + if( sc == c ) + index = i + return index +} 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 c40461329..7ab4e6542 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 @@ -1088,10 +1093,18 @@ void function ThreadedAuthAndConnectToServer( string password = "" ) // enable all RequiredOnClient mods that are required by the server and are currently disabled foreach ( RequiredModInfo mod in file.lastSelectedServer.requiredMods ) { - if ( NSIsModRequiredOnClient( mod.name ) && !NSIsModEnabled( mod.name )) + Mod ornull localMod = GetModByName( mod.name ) + + if( localMod == null ) + { + throw format( "Tried joining server without required mod %s. Please report this Bug.", mod.name ) + } + + expect Mod( localMod ) + if( localMod.requiredOnClient ) { modsChanged = true - NSSetModEnabled( mod.name, true ) + NSSetModEnabled( localMod.name, true ) } } 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..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" + 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 eef19b5ee..9209f7dfb 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut @@ -59,6 +59,13 @@ 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" ) ) + } + ) + ComboStruct comboStruct = ComboButtons_Create( file.panel ) int headerIndex = 0 @@ -189,6 +196,28 @@ 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() ) // 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 + Hud_SetWidth( panel, width ) + Hud_SetWidth( Hud_GetChild( panel, "Frame" ), width ) + Hud_SetWidth( Hud_GetChild( panel, "ButtoN" ), width ) + + Hud_SetXOverTime( panel, -Hud_GetWidth( panel ), 0.3, INTERPOLATOR_SIMPLESPLINE ) + RuiSetImage( Hud_GetRui( Hud_GetChild( panel, "Image" ) ), "basicImage", $"ui/menu/common/dialog_error" ) } void function EnableCheckPlus() @@ -429,9 +458,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