Initial implementation of the [select_unit] tag per bug #16819
Optional attributes: fire_event (def. no), hilight (def. yes) Part of this is broken since I haven't figured out yet how to make it possible to draw the movement ranges etc. when hilight=yes; apparently some pathfinder stuff is required per mouse_events.cpp:280 and 284...
This commit is contained in:
parent
31c3fc7ddc
commit
3fc1fc16e1
3 changed files with 43 additions and 0 deletions
|
@ -69,6 +69,8 @@ Version 1.9.1+svn:
|
|||
* added new parameters directional_x and directional_y to animations
|
||||
* added new parameters auto_vflip and auto_hflip to animations
|
||||
* Made it so that units affected by [hide_unit] don't appear on the minimap (FR #16796)
|
||||
* New [select_unit] tag, with optional fire_event (def. no) and hilight_hex (def. yes)
|
||||
attributes (FR #16819)
|
||||
* Miscellaneous and bugfixes:
|
||||
* Changed: Lowered severity of some gui2 timer log messages.
|
||||
* Units created in debug mode now play their recruit animation (FR #16766).
|
||||
|
|
|
@ -279,6 +279,20 @@ function wml_actions.scroll_to_unit(cfg)
|
|||
wesnoth.scroll_to_tile(u.x, u.y, cfg.check_fogged)
|
||||
end
|
||||
|
||||
function wml_actions.select_unit(cfg)
|
||||
local u = wesnoth.get_units(cfg)[1]
|
||||
if not u then return end
|
||||
local fire_event = cfg.fire_event
|
||||
local hilight = (cfg.hilight or true)
|
||||
|
||||
wesnoth.select_hex(u.x, u.y)
|
||||
|
||||
if hilight then wesnoth.hilight_hex(u.x, u.y) end
|
||||
if fire_event then
|
||||
wesnoth.fire_event("select", u.x, u.y)
|
||||
end
|
||||
end
|
||||
|
||||
function wml_actions.unit_overlay(cfg)
|
||||
local img = cfg.image
|
||||
for i,u in ipairs(wesnoth.get_units(cfg)) do
|
||||
|
|
|
@ -631,6 +631,33 @@ My best advancement costs $next_cost gold and I'm $experience|% there."
|
|||
[/lua]
|
||||
[/event]
|
||||
|
||||
[event]
|
||||
name=test1
|
||||
first_time_only=no
|
||||
[select_unit]
|
||||
type=Elvish Avenger
|
||||
fire_event=yes
|
||||
[/select_unit]
|
||||
[/event]
|
||||
|
||||
[event]
|
||||
name=select
|
||||
first_time_only=no
|
||||
[filter]
|
||||
type=Elvish Avenger
|
||||
[filter_wml]
|
||||
[status]
|
||||
petrified=yes
|
||||
[/status]
|
||||
[/filter_wml]
|
||||
[/filter]
|
||||
|
||||
[message]
|
||||
speaker=unit
|
||||
message="Oh hi"
|
||||
[/message]
|
||||
[/event]
|
||||
|
||||
[event]
|
||||
name=prestart
|
||||
[time_area]
|
||||
|
|
Loading…
Add table
Reference in a new issue