Add range support for [micro_ai]side= (#7853)

This commit is contained in:
Jonathan-Kelly 2023-08-18 20:04:05 -04:00 committed by GitHub
parent 83ab05532a
commit 14c7382675
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View File

@ -19,9 +19,8 @@ function wesnoth.wml_actions.micro_ai(cfg)
-- Check that the required common keys are all present and set correctly
if (not cfg.ai_type) then wml.error("[micro_ai] is missing required ai_type= key") end
if (not cfg.side) then wml.error("[micro_ai] is missing required side= key") end
if string.find(cfg.side, ',') then
local sides = stringx.split(cfg.side)
for _,side in ipairs(sides) do
if string.find(cfg.side, ',') or string.find(cfg.side, '-') then
for side in stringx.iter_ranges(cfg.side) do
cfg.side = tonumber(side)
wesnoth.wml_actions.micro_ai(cfg)
end

View File

@ -1256,7 +1256,7 @@
max=infinite
{INSERT_TAG}
{REQUIRED_KEY ai_type string}
{REQUIRED_KEY side s_unsigned}
{REQUIRED_KEY side s_unsigned_range_list}
{REQUIRED_KEY action micro_ai_action}
{SIMPLE_KEY ca_id string}
[if]