From 5bb7ecb8b2a31cca88e2820c060c4b0f99410d5f Mon Sep 17 00:00:00 2001 From: Moose <124457076+AntlerForce@users.noreply.github.com> Date: Tue, 3 Dec 2024 13:34:35 -0700 Subject: [PATCH] Prevent modoptions from presets being applied if not boss --- LuaMenu/widgets/gui_optionpresets_panel.lua | 37 ++++++++++++--------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/LuaMenu/widgets/gui_optionpresets_panel.lua b/LuaMenu/widgets/gui_optionpresets_panel.lua index 55ee7bbbc..65a54150b 100644 --- a/LuaMenu/widgets/gui_optionpresets_panel.lua +++ b/LuaMenu/widgets/gui_optionpresets_panel.lua @@ -137,22 +137,6 @@ local function applyPreset(presetName) battleLobby:SayBattle("!nbTeams " .. presetMPBattleSettings["nbTeams"]) end - -- modoptions - currentModoptions = presetObj["Modoptions"] - if (currentModoptions ~= nil and enabledOptions["Modoptions"]) then - -- if multiplayer have to disable other modoptions first: - if (multiplayer) then - -- now apply the modoptions as the baseline - local combinedModoptions = multiplayerModoptions - for key, value in pairs(currentModoptions) do - multiplayerModoptions[key] = value - end - currentModoptions = combinedModoptions - end - - battleLobby:SetModOptions(currentModoptions) - end - -- map local presetMapName = presetObj["Map"] if (presetMapName ~= nil and enabledOptions["Map"]) then @@ -196,6 +180,27 @@ local function applyPreset(presetName) battlestatusoptions) end end + + -- modoptions + currentModoptions = presetObj["Modoptions"] + if (currentModoptions ~= nil and enabledOptions["Modoptions"]) then + -- if multiplayer have to disable other modoptions first: + if (multiplayer) then + local isBoss = battle.bossed + if isBoss and isBoss == true then + -- now apply the modoptions as the baseline + local combinedModoptions = multiplayerModoptions + for key, value in pairs(currentModoptions) do + multiplayerModoptions[key] = value + end + currentModoptions = combinedModoptions + else + WG.Delay(function() battleLobby:SayBattleEx("tried to apply a preset containing modoptions, but was prevented due to not being boss") end, 1.5) + return + end + end + battleLobby:SetModOptions(currentModoptions) + end end end