Add highlight=yes|no to [scroll_to], [scroll_to_unit], [message]

Defaults to no in the first two cases, yes in the third
If yes, the target hex is outlined.
This commit is contained in:
Celtic Minstrel 2016-03-20 02:51:08 -04:00
parent 09d4033916
commit 1c27cafa74
3 changed files with 14 additions and 1 deletions

View file

@ -6,6 +6,9 @@ Version 1.13.4+dev:
* Fix some issues with [foreach]
* Fix some issues with backstab-like weapon specials
* Support [effect]times=<integer>
* Add highlight=yes|no to [scroll_to], [scroll_to_unit], [message]
Defaults to no in the first two cases, yes in the third
If yes, the target hex is outlined.
* Lua API:
* wesnoth.match_unit can now take a location (rather than a unit) as
the optional third parameter. This will cause the filter to consider

View file

@ -573,6 +573,10 @@ function wml_actions.scroll_to(cfg)
if not loc then return end
if not utils.optional_side_filter(cfg) then return end
wesnoth.scroll_to_tile(loc[1], loc[2], cfg.check_fogged, cfg.immediate)
if cfg.highlight then
wesnoth.highlight_hex(loc[1], loc[2])
wml_actions.redraw{}
end
end
function wml_actions.scroll_to_unit(cfg)
@ -580,6 +584,10 @@ function wml_actions.scroll_to_unit(cfg)
if not u then return end
if not utils.optional_side_filter(cfg, "for_side", "for_side") then return end
wesnoth.scroll_to_tile(u.x, u.y, cfg.check_fogged, cfg.immediate)
if cfg.highlight then
wesnoth.highlight_hex(u.x, u.y)
wml_actions.redraw{}
end
end
function wml_actions.lock_view(cfg)
@ -593,7 +601,7 @@ end
function wml_actions.select_unit(cfg)
local u = wesnoth.get_units(cfg)[1]
if not u then return end
wesnoth.select_hex(u.x, u.y, cfg.highlight, cfg.fire_event)
wesnoth.select_unit(u.x, u.y, cfg.highlight, cfg.fire_event)
end
function wml_actions.unit_overlay(cfg)

View file

@ -206,6 +206,8 @@ function wesnoth.wml_actions.message(cfg)
-- No matching unit found, continue onto the next message
log("No speaker found for [message]", "debug")
return
elseif cfg.highlight == false then
-- Nothing to do here
elseif speaker == "narrator" then
-- Narrator, so deselect units
wesnoth.deselect_hex()