This commit moves [event] to be implemented in lua/wml-tags.lua.
It turns out that because of some questionable ordering in
data/core/_main.cfg, none of the tags defined in
data/lua/wml-tags.lua are actually defined at the time that core
is read, instead they are defined right after this. This is broken,
the entire wml library should be defined before core is read. Thus
we reorder some directives in data/core/_main.cfg to ensure this.
This commit adds lua callbacks `wesnoth.add_event_handler`,
`wesnoth.remove_event_handler` as well.
variable v does not exist... the function is not commented so I
can't be sure of the intention, but the most backwards-compatible
fix is to not pass argument v, so that it will be nil as before.
this bug was revealed by enabling lua "strict mode"
Enables an ilua feature called "strict mode" in all of our lua
environments. This change causes lua to report an error if a global
variable is used before it is assigned. The benefits of this are:
- Improved maintainability of lua-based add-ons, since you get
better error reporting in case of a typo.
- Improved behavior of the lua interpreter console, since mistyped
or gibberish lines resolve to an error rather than "nil", which
the console treats as a legal return value.
It is possible to disable this or work around it in individual
scripts. For more info see release notes.
The logic is supposed to be, if (x,y) == (prev_x, prev_y), then
skip the "find_vacant_hex" function because we don't have to move.
Instead we effectively had, if (x == prev_x OR y == prev_y), then
we can skip the check.
This revises a commit
72f138c544
in the hopes to fix a bug reported here:
http://forums.wesnoth.org/viewtopic.php?f=4&t=41084
Modified the lua script for wml_action.move_unit. In the
loop to check for vacant tile, if the current location
is equal to the previous location we don't look for a
vacant tile since our location is free (where we are).
I frequently make the mistake of using {IF_VAR} but forgetting to
use [then] with it. One solution is to use my own macro, but the
better solution is to add proper error reporting to if. If the
engine parses an [if] tag with no [then], [else], or [elseif], it
should flag an error... otherwise these mistakes are generally
silent and very difficult to find.
Add the variables, lua, and wml support variables to allow a scenario
designer the ability to define different from the standard recall costs
or team recall costs for both individual units and unit types.
from least to highest order of precendent we'll have default, team/side,
unit_type, and finally individual units.
The tag in the scenarios and in the unit config files is recall_cost=int.
Previously, when a unit was petrified with [petrify] or [harm_unit], it
would continue its standing animation. Also, it would not start its
standing animation when unpetrifying it with [unpetrify] or
[heal_unit]. Now the animation stops/starts correctly when the status
is changed.
This fixes bug #20124