Skip to content

Commit

Permalink
Merge pull request #779 from rlcevg/ai_custom_profile2
Browse files Browse the repository at this point in the history
BARb: Custom hard_aggressive profile
  • Loading branch information
AntlerForce authored Oct 3, 2024
2 parents 17661c0 + 4e35dad commit aa0d7e3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
23 changes: 11 additions & 12 deletions LuaMenu/configs/gameConfig/byar/aiCustomData.lua
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
local customProfiles = {
-- ['BARb stable'] = {
-- {
-- key = 'example', -- must conform to directory name
-- name = 'Not so Hard', -- human readable name displayed in a list
-- -- desc kept for consistency with AIOptions.lua
-- desc = 'Alas desc doesn\'t work - no way to display tooltip on a list item',
-- },
-- },
['BARb stable'] = {
{
key = 'hard_aggressive', -- must conform to directory name
name = 'Hard | Aggressive', -- human readable name displayed in a list
desc = 'Difficulty: Hard | Playstyle: Aggressive | Made by Flaka, tweaked by Corosus',
},
},
}

local blacklistProfiles = {
Expand Down Expand Up @@ -36,16 +35,16 @@ local function ArrayRemove(t, fnKeep)
end

function CustomAiProfiles(name, items)
local filter = blacklistProfiles[name]
if filter then
ArrayRemove(items, function(t, i, j) return not filter[t[i].key] end)
end
local customs = customProfiles[name]
if customs then
for _, v in ipairs(customs) do
table.insert(items, v)
end
end
local filter = blacklistProfiles[name]
if filter then
ArrayRemove(items, function(t, i, j) return not filter[t[i].key] end)
end
end

return {
Expand Down
1 change: 1 addition & 0 deletions LuaMenu/widgets/chobby/components/aioptions_window.lua
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ function AiOptionsWindow:CustomizeProfiles(displayName, options)
for _, data in ipairs(options) do
if data.type == "list" and data.key == "profile" then
WG.Chobby.Configuration.gameConfig.CustomAiProfiles(displayName, data.items) -- in place
return
end
end
end

0 comments on commit aa0d7e3

Please sign in to comment.