mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-18 07:07:28 +00:00
Add suffix= and prefix= operations to [set_variable]
This commit is contained in:
parent
e117e2cede
commit
aa0a3bebd1
@ -15,6 +15,8 @@ Version 1.13.11+dev:
|
||||
* [set_menu_item] no longer fires repeatedly if the player holds the
|
||||
hotkey (bug #1711). If you were relying on repeated firing, add
|
||||
repeat_on_hold=yes to [default_hotkey].
|
||||
* [set_variable] now supports prefix and suffix operations for
|
||||
string concatenation.
|
||||
* Miscellaneous and bug fixes:
|
||||
* Fixed standing animation toggle not taking immediate effect (bug
|
||||
#1653).
|
||||
|
@ -15,6 +15,14 @@ function wesnoth.wml_actions.set_variable(cfg)
|
||||
wesnoth.set_variable(name, wesnoth.get_variable(cfg.to_variable))
|
||||
end
|
||||
|
||||
if cfg.suffix then
|
||||
wesnoth.set_variable(name, (wesnoth.get_variable(name) or '') .. (cfg.suffix or ''))
|
||||
end
|
||||
|
||||
if cfg.prefix then
|
||||
wesnoth.set_variable(name, (cfg.prefix or '') .. (wesnoth.get_variable(name) or ''))
|
||||
end
|
||||
|
||||
if cfg.add then
|
||||
wesnoth.set_variable(name, (tonumber(wesnoth.get_variable(name)) or 0) + (tonumber(cfg.add) or 0))
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user