Support location_id in [teleport]

(cherry-picked from commit fed46ec45f)
This commit is contained in:
Celtic Minstrel 2018-04-01 14:05:33 -04:00
parent 83a6243fb9
commit 5e4b5a56b2
2 changed files with 5 additions and 0 deletions

View file

@ -23,6 +23,7 @@
### WML engine
* Support formula= key in [variable] ConditionalWML
* Support to_location in [move_unit], taking a location ID
* Support location_id in [teleport] for the target location
* Support [filter_weapon] in leadership and resistance abilities,
which activates the ability only when the affected unit is using
a matching weapon.

View file

@ -866,6 +866,10 @@ wml_actions.teleport = function(cfg)
-- No error if no unit matches.
return
end
local x,y = cfg.x, cfg.y
if not x or not y then
x,y = wesnoth.special_locations[cfg.location_id]
end
wesnoth.teleport(unit, cfg.x, cfg.y, cfg.check_passability == false, cfg.clear_shroud ~= false, cfg.animate)
end