Skip to content

Commit

Permalink
Support location_id in [teleport]
Browse files Browse the repository at this point in the history
(cherry-picked from commit fed46ec)
  • Loading branch information
CelticMinstrel committed Oct 7, 2018
1 parent 83a6243 commit 5e4b5a5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.md
Expand Up @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions data/lua/wml-tags.lua
Expand Up @@ -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

Expand Down

0 comments on commit 5e4b5a5

Please sign in to comment.