[modify_unit] now supports dvs for modifications

This means [object], [advancement], and [trait] tags within [modify_unit]
can now use delayed_variable_substitution=yes.

This is currently needed for adding teleport, backstab, and leadership abilities.
This commit is contained in:
Celtic Minstrel 2016-05-18 20:45:57 -04:00
parent 87f0716616
commit af58b33aca
2 changed files with 9 additions and 1 deletions

View file

@ -47,6 +47,8 @@ Version 1.13.4+dev:
* Added new keys name_generator, male_name_generator and female_name_generator
for the [race] tag to declare a context-free grammar to describe how names
are derived
* Modification tags in [modify_unit] now support delayed_variable_substitution
(This means [advancement], [object], and [trait] tags.)
* AiWML:
* Simplified aspect syntax which works for all aspects, present and future:
* All aspects with simple values can be specified as key=value

View file

@ -40,9 +40,15 @@ function wml_actions.modify_unit(cfg)
if current_tag == "filter" then
-- nothing
elseif current_tag == "object" or current_tag == "trait" or current_tag == "advancement" then
local mod = current_table[2]
if mod.delayed_variable_substitution then
mod = helper.literal(mod)
else
mod = helper.parsed(mod)
end
local unit = wesnoth.get_variable(unit_path)
unit = wesnoth.create_unit(unit)
wesnoth.add_modification(unit, current_tag, current_table[2])
wesnoth.add_modification(unit, current_tag, mod)
unit = unit.__cfg;
wesnoth.set_variable(unit_path, unit)
else