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
72f138c54414bc0349def0271ec1ccbad984a28b
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
This impacts wesnoth.transform_unit, [effect]apply_to=type, and
[effect]apply_to=variation. If desired, the poisoned state can still
be explicitly set for immune units; this change only affects default
behavior, making it correspond better to the core rules.
This is actually simpler to implement and is more consistent with the
[transform_unit] tag. Plus, the wiki documentation for
wesnoth.transform_unit() does not state that the hit points definitely
will be changed (it's a bit vague on that point), so this is
consistent with the existing documentation.
They are trivial wrappers for the wesnoth.lock_view() function in Lua.
Neither takes any parameters.
There is no wrapper for wesnoth.view_locked() yet until I decide on its
name and usefulness factor.
...to the [scroll_to] and [scroll_to_unit] WML actions
When immediate is set to a true value, the display code will instantly
warp to the chosen location regardless of the scroll speed setting in
Preferences.