Browse Source

[changed] Safer mod removal for Emergency menu (now asks for confirmation). Option to disable mods only displays if mods are installed.

3xpurt 1 year ago
parent
commit
2b1cc562f4
2 changed files with 54 additions and 32 deletions
  1. 26 24
      locations/mod_setting.qsrc
  2. 28 8
      locations/obj_din.qsrc

+ 26 - 24
locations/mod_setting.qsrc

@@ -68,32 +68,34 @@ act ''+iif(settingmode = 1, '<center><b>Install new mod</b></center>','Install n
 	gt 'mod_setting'
 end
 
-act ''+iif(settingmode = 1, '<center><b>Disable all mods</b></center>','Disable all mods')+'':
-	if input('Are you sure? ALL mod will be disabled!<br>please input <b>qqq</B> to confirm') = 'qqq':
-		if mod_list > 0:
-			mod_i=mod_list
-			:mod_data_remover
-			if $mod_name[mod_i] ! '':
-				$mod_su_name = 'mod_<<$mod_name[mod_i]>>_onremove'
-				if LOC($mod_su_name): gs $mod_su_name
-			end
-			if mod_i > 0:
-				mod_i-=1
-				jump 'mod_data_remover'
+if mod_list > 0:
+	act ''+iif(settingmode = 1, '<center><b>Disable all mods</b></center>','Disable all mods')+'':
+		if input('Are you sure? ALL mod will be disabled!<br>please input <b>qqq</B> to confirm') = 'qqq':
+			if mod_list > 0:
+				mod_i=mod_list
+				:mod_data_remover
+				if $mod_name[mod_i] ! '':
+					$mod_su_name = 'mod_<<$mod_name[mod_i]>>_onremove'
+					if LOC($mod_su_name): gs $mod_su_name
+				end
+				if mod_i > 0:
+					mod_i-=1
+					jump 'mod_data_remover'
+				end
+				killvar '$mod_su_name'
+				killvar 'mod_i'
 			end
-			killvar '$mod_su_name'
-			killvar 'mod_i'
-		end
 
-		killqst
-		set mod_list=0
-		killvar '$mod_name'
-		killvar '$mod_version'
-		killvar '$mod_author'
-		killvar '$mod_desc'
-		killvar '$mod_opt'
-		msg 'All mod disabled. You can re-install them later.'
-		gt 'mod_setting'
+			killqst
+			set mod_list=0
+			killvar '$mod_name'
+			killvar '$mod_version'
+			killvar '$mod_author'
+			killvar '$mod_desc'
+			killvar '$mod_opt'
+			msg 'All mod disabled. You can re-install them later.'
+			gt 'mod_setting'
+		end
 	end
 end
 --- mod_setting ---------------------------------

+ 28 - 8
locations/obj_din.qsrc

@@ -2144,14 +2144,34 @@ if $ARGS[0] = 'emergency':
 	cla
 	act 'Go to Pavlovsk':gt 'pav_residential'
 	act 'Go to City Residental':gt 'city_residential'
-	act 'Remove all mods':
-		killqst
-		set mod_list=0
-		killvar '$mod_name'
-		killvar '$mod_version'
-		killvar '$mod_author'
-		killvar '$mod_desc'
-		killvar '$mod_opt'
+	if mod_list > 0:
+		act 'Disable all mods':
+			if input('Are you sure? ALL mod will be disabled!<br>please input <b>qqq</B> to confirm') = 'qqq':
+				if mod_list > 0:
+					mod_i=mod_list
+					:mod_data_remover
+					if $mod_name[mod_i] ! '':
+						$mod_su_name = 'mod_<<$mod_name[mod_i]>>_onremove'
+						if LOC($mod_su_name): gs $mod_su_name
+					end
+					if mod_i > 0:
+						mod_i-=1
+						jump 'mod_data_remover'
+					end
+					killvar '$mod_su_name'
+					killvar 'mod_i'
+				end
+
+				killqst
+				set mod_list=0
+				killvar '$mod_name'
+				killvar '$mod_version'
+				killvar '$mod_author'
+				killvar '$mod_desc'
+				killvar '$mod_opt'
+				msg 'All mod disabled. You can re-install them later.'
+			end
+		end
 	end
 	if $loc ! '' and $loc_arg ! '':
 		act 'Cancel':gt $loc, $loc_arg