From b2c443cbe04361933bd4531ab8e747a8ffa368cd Mon Sep 17 00:00:00 2001 From: F1F7Y <64418963+F1F7Y@users.noreply.github.com> Date: Mon, 10 Jan 2022 21:59:56 +0100 Subject: Add a warning when disabling core mods (#98) --- .../northstar_client_localisation_english.txt | Bin 22158 -> 22402 bytes .../mod/scripts/vscripts/ui/menu_ns_modmenu.nut | 43 +++++++++++++++++++-- 2 files changed, 40 insertions(+), 3 deletions(-) (limited to 'Northstar.Client') diff --git a/Northstar.Client/mod/resource/northstar_client_localisation_english.txt b/Northstar.Client/mod/resource/northstar_client_localisation_english.txt index c74bbef3b..c8d400b86 100644 Binary files a/Northstar.Client/mod/resource/northstar_client_localisation_english.txt and b/Northstar.Client/mod/resource/northstar_client_localisation_english.txt differ diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut index cb1535d32..cc681e95b 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut @@ -4,6 +4,8 @@ global function ReloadMods struct { bool shouldReloadModsOnEnd + string currentMod + var currentButton } file void function AddNorthstarModMenu() @@ -83,9 +85,44 @@ void function SetModMenuNameText( var button ) void function OnModMenuButtonPressed( var button ) { string modName = NSGetModNames()[ int ( Hud_GetScriptID( button ) ) ] - NSSetModEnabled( modName, !NSIsModEnabled( modName ) ) - SetModMenuNameText( button ) - + if ( ( modName == "Northstar.Client" || modName == "Northstar.Coop" || modName == "Northstar.CustomServers") && NSIsModEnabled( modName ) ) + { + file.currentMod = modName + file.currentButton = button + CoreModToggleDialog( modName ) + } + else + { + NSSetModEnabled( modName, !NSIsModEnabled( modName ) ) + + SetModMenuNameText( button ) + + file.shouldReloadModsOnEnd = true + } +} + +void function CoreModToggleDialog( string mod ) +{ + DialogData dialogData + dialogData.header = "#WARNING" + dialogData.message = "#CORE_MOD_DISABLE_WARNING" + + AddDialogButton( dialogData, "#CANCEL" ) + // This can't have any arguments so we use the file struct + AddDialogButton( dialogData, "#DISABLE", DisableMod ) + + AddDialogFooter( dialogData, "#A_BUTTON_SELECT" ) + AddDialogFooter( dialogData, "#B_BUTTON_CANCEL" ) + + OpenDialog( dialogData ) +} + +void function DisableMod() +{ + NSSetModEnabled( file.currentMod, false ) + + SetModMenuNameText( file.currentButton ) + file.shouldReloadModsOnEnd = true } -- cgit v1.2.3