Skip to content

Commit

Permalink
Merge pull request #864 from AntlerForce/cloneAI
Browse files Browse the repository at this point in the history
Fix Option Presets not applying bonuses from saved AI profiles
  • Loading branch information
AntlerForce authored Dec 22, 2024
2 parents 7fcfa76 + 184e14b commit b058f6f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
12 changes: 11 additions & 1 deletion LuaMenu/widgets/gui_optionpresets_panel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ local function applyPreset(presetName)
-- AIs with their settings
local presetAi = presetObj["Bots"]
if presetAi ~= nil and enabledOptions["Bots"] then
local newAiNames = {}
local saidBattleExOnce = false

for key, _ in pairs(currentAITable) do
battleLobby:RemoveAi(key)
Expand All @@ -176,8 +176,18 @@ local function applyPreset(presetName)
local battlestatusoptions = {}
battlestatusoptions.teamColor = value.teamColor
battlestatusoptions.side = value.side
battlestatusoptions.handicap = value.handicap
battleLobby:AddAi(key, value.aiLib, value.allyNumber, value.aiVersion, value.aiOptions,
battlestatusoptions)
if (multiplayer) and battlestatusoptions.handicap then
local isBoss = battle.bossed
if isBoss and isBoss == true then
battleLobby:SayBattle("!force "..key.." bonus ".. tostring(battlestatusoptions.handicap))
elseif saidBattleExOnce == false then
WG.Delay(function() battleLobby:SayBattleEx("tried to apply bonuses to AI, but was prevented due to not being boss") end, 1.5)
saidBattleExOnce = true
end
end
end
end

Expand Down
1 change: 1 addition & 0 deletions libs/liblobby/lobby/interface_skirmish.lua
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,7 @@ function InterfaceSkirmish:AddAi(aiName, aiLib, allyNumber, version, aiOptions,
aiOptions = aiOptions,
teamColor = battleStatusOptions and battleStatusOptions.teamColor,
side = battleStatusOptions and battleStatusOptions.side,
handicap = battleStatusOptions and battleStatusOptions.handicap,
})
end

Expand Down

0 comments on commit b058f6f

Please sign in to comment.