Add [modify_unit]rebuild=no

This commit is contained in:
Celtic Minstrel 2019-11-13 01:00:24 -05:00
parent 06a3799b46
commit 51d6402453
2 changed files with 7 additions and 3 deletions

View file

@ -48,6 +48,7 @@
* [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]
* [modify_unit] now accepts rebuild=no which will avoid a rebuild of the unit if possible (not guaranteed)
### 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:

View file

@ -53,6 +53,7 @@ local known_attributes = make_set {
"description",
"hidden",
"unrenamable",
"rebuild",
}
local known_tags = make_set {
@ -179,9 +180,11 @@ local function simple_modify_unit(cfg)
u:transform(cfg.type or u.type, cfg.variation)
end
-- always do an advancement here (not only when experience/max_experience/type was modified)
-- for compatability with old code.
u:advance()
-- by default always do an advancement here (not only when experience/max_experience/type was modified)
-- for compatibility with old code.
if cfg.experience or cfg.max_experience or cfg.rebuild ~= false then
u:advance()
end
end
local this_unit = utils.start_var_scope("this_unit")