Support as_type=unit in [variable]formula=
This commit is contained in:
parent
516f043e89
commit
6876695e66
1 changed files with 4 additions and 0 deletions
|
@ -25,6 +25,10 @@ local old_variable = wesnoth.wml_conditionals.variable
|
|||
function wesnoth.wml_conditionals.variable(cfg)
|
||||
if cfg.formula then
|
||||
local value = wml.variables[cfg.name]
|
||||
if cfg.as_type == 'unit' then
|
||||
value = wesnoth.units.create(value)
|
||||
-- TODO: Consider supporting other types.
|
||||
end
|
||||
local result = wesnoth.eval_formula(cfg.formula, {value = value})
|
||||
-- WFL considers 0 as false; Lua doesn't
|
||||
if result == 0 then return false end
|
||||
|
|
Loading…
Add table
Reference in a new issue