[harm_unit]: moved support function bool() to the start of the tag

This change is needed to have the function available for the whole tag.
This commit is contained in:
Elvish_Hunter 2013-06-14 23:11:26 +02:00
parent 81aac64fc2
commit dae1b121a6

View file

@ -775,6 +775,13 @@ function wml_actions.harm_unit(cfg)
-- #textdomain wesnoth
local harmer
local function bool( value ) -- helper for animate fields
+ -- units will be animated upon leveling or killing, even
+ -- with special attacker and defender values
if value then return true
else return false end
end
local this_unit = start_var_scope("this_unit")
for index, unit_to_harm in ipairs(wesnoth.get_units(filter)) do
@ -912,10 +919,6 @@ function wml_actions.harm_unit(cfg)
end
if kill ~= false and unit_to_harm.hitpoints <= 0 then
local function bool( value ) -- support function for kill tag below
if value then return true
else return false end
end
wml_actions.kill({ id = unit_to_harm.id, animate = bool( animate ), fire_event = fire_event })
end