aboutsummaryrefslogtreecommitdiff
path: root/Northstar.Client/mod/scripts/vscripts/ui
diff options
context:
space:
mode:
authorF1F7Y <64418963+F1F7Y@users.noreply.github.com>2022-01-10 21:59:56 +0100
committerGitHub <noreply@github.com>2022-01-10 17:59:56 -0300
commitb2c443cbe04361933bd4531ab8e747a8ffa368cd (patch)
tree093e6695c0817bfb037efd7c9086b5a95d44f6c8 /Northstar.Client/mod/scripts/vscripts/ui
parent9acf30fdf2e0d1aaef1c7a3f79168c8afe6e2f88 (diff)
downloadNorthstarMods-b2c443cbe04361933bd4531ab8e747a8ffa368cd.tar.gz
NorthstarMods-b2c443cbe04361933bd4531ab8e747a8ffa368cd.zip
Add a warning when disabling core mods (#98)
Diffstat (limited to 'Northstar.Client/mod/scripts/vscripts/ui')
-rw-r--r--Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut43
1 files changed, 40 insertions, 3 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 cb1535d3..cc681e95 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
}