From 14c7382675359def22957b269bfc12ebea64a2fd Mon Sep 17 00:00:00 2001 From: Jonathan-Kelly <80054769+Jonathan-Kelly@users.noreply.github.com> Date: Fri, 18 Aug 2023 20:04:05 -0400 Subject: [PATCH] Add range support for [micro_ai]side= (#7853) --- data/lua/wml/micro_ai.lua | 5 ++--- data/schema/core/actionwml.cfg | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/data/lua/wml/micro_ai.lua b/data/lua/wml/micro_ai.lua index 5822a66a7ba..4841efe2010 100644 --- a/data/lua/wml/micro_ai.lua +++ b/data/lua/wml/micro_ai.lua @@ -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 diff --git a/data/schema/core/actionwml.cfg b/data/schema/core/actionwml.cfg index bea8b7e60f9..696a21482e1 100644 --- a/data/schema/core/actionwml.cfg +++ b/data/schema/core/actionwml.cfg @@ -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]