From c602110e726b6094e445f4a179ebd8526879d3c2 Mon Sep 17 00:00:00 2001 From: Celtic Minstrel Date: Wed, 13 Nov 2019 00:22:50 -0500 Subject: [PATCH] Support [variables] in [modify_side] This allows merging in changes to side variables and may alleviate the lack of [set_variables] support for side variables --- changelog.md | 1 + data/lua/wml/modify_side.lua | 2 ++ 2 files changed, 3 insertions(+) diff --git a/changelog.md b/changelog.md index 89782fc9610..b77e36e5363 100644 --- a/changelog.md +++ b/changelog.md @@ -47,6 +47,7 @@ * Support upkeep in StandardUnitFilter * [effect]apply_to=variation now supports heal_full * Support [set/clear_variable] inside [modify_unit/side] + * Support [variables] in [modify_side], as in [modify_unit] ### Packaging * The Wesnoth client now looks for the data/dist file when logging into the multiplayer server. This file should contain one of the following values based on where the package is for: diff --git a/data/lua/wml/modify_side.lua b/data/lua/wml/modify_side.lua index 19c38c998ab..91c7b3d2e1f 100644 --- a/data/lua/wml/modify_side.lua +++ b/data/lua/wml/modify_side.lua @@ -103,6 +103,8 @@ function wesnoth.wml_actions.modify_side(cfg) wesnoth.wml_actions.set_variable(v[2], side.variables) elseif tag == "clear_variable" then wesnoth.wml_actions.clear_variable(cfg, side.variables) + elseif tag == "variables" then + side.variables.__cfg = wml.merge(side.variables.__cfg, content, cfg.var_merge_mode or "replace") end end