Commit graph

36 commits

Author SHA1 Message Date
Pentarctagon
a5e7986b3e Updates for newer luacheck. 2022-08-06 03:03:17 -05:00
Steve Cotton
69ee817955
Remove the fast path of [modify_unit] (#6223)
Always use the "slow path", because it stores and unstores the unit, triggering
the desired side effects of unstoring a unit.

Fixes issue #5133, and tests that with the new unit test.

Fixes bug #4978, that changing the facing wasn't updating the display.

This corresponds to 1.16's commit 13c5d8a96e,
that commit merely disabled the fast path to be a minimal change.
2021-11-05 21:39:38 +01:00
Celtic Minstrel
a0ee38a49a
Use to-be-closed variables to scope WML variables in tag definitions (#5536) 2021-02-15 21:11:56 -05:00
gfgtdf
116687c983
fix #5184 [modify_unit]profile 2020-10-04 03:06:33 +02:00
Celtic Minstrel
d9b5e3c4df Replace uses of wml_utils.split with stringx.split 2019-12-04 08:46:04 -05:00
Celtic Minstrel
732b7942bb Replace all references to deprecated functions in the helper module
(and remove the require if this meant it was no longer used)
2019-12-02 01:10:34 -05:00
Celtic Minstrel
e0cf8c5982 Fix syntax error (trying to write Lua like C++) 2019-11-16 17:01:43 -05:00
Celtic Minstrel
cd6283f8db Add a few more tags to the [modify_unit] optimized path 2019-11-16 15:14:09 -05:00
Celtic Minstrel
1f36590e80 Add a few more attributes to the [modify_unit] optimized path 2019-11-16 15:14:09 -05:00
Celtic Minstrel
2cc7fe6450 Revert "Add [modify_unit]rebuild=no"
This reverts commit 51d6402453.

After discussion with @gfgtdf it was determined that this is not a useful feature after all, since it was in fact the default behaviour for the optimized path.
2019-11-16 15:14:09 -05:00
Celtic Minstrel
aaa2dc4ece Rollback possibility of wesnoth.get_units matching recall list units
Now it's renamed to wesnoth.units.find_on_map.

wesnoth.units.find implements the case of finding units on either the map or a recall list.
2019-11-15 22:39:09 -05:00
Celtic Minstrel
977f05d77f Lua: Replace uses of deprecated (moved) unit functions
Also backtracked the removal of wesnoth.get_recall_units, which is now available as wesnoth.units.find_on_recall - it's just more convenient than passing x=recall to wesnoth.units.find
2019-11-15 22:39:08 -05:00
Celtic Minstrel
3772e633fa Fix [modify_unit] optimized path producing an error on a recall list unit
Addresses #4556
2019-11-15 22:39:08 -05:00
Celtic Minstrel
fda3c9af75 [modify_unit]: fix handling of unrenamable in the optimized path 2019-11-13 07:39:20 -05:00
Celtic Minstrel
51d6402453 Add [modify_unit]rebuild=no 2019-11-13 01:00:36 -05:00
Celtic Minstrel
06a3799b46 Add handling of [modify_unit][effect] on the optimized path 2019-11-13 00:53:19 -05:00
Celtic Minstrel
8374306009 Add six more known attributes to the [modify_unit] optimized path 2019-11-12 23:03:55 -05:00
Celtic Minstrel
f6b6854c8d Support [set/clear_variable] inside [modify_unit/side] 2019-11-11 22:29:26 -05:00
Celtic Minstrel
4db2d36af2 Fix [modify_unit] 2019-11-10 17:20:37 -05:00
Celtic Minstrel
f765e0b862 [modify_unit]: support variation in the optimized path 2019-11-10 14:23:34 -05:00
Celtic Minstrel
818aabdbc5 Don't duplicate the split function logic in [modify_unit] 2019-11-10 13:26:24 -05:00
gfgtdf
7621b9b63e
fix [modify_unit] cannot set attributes to false #4325 2019-09-08 19:50:56 +02:00
gfgtdf
fbdd926e14 improve [modify_unit] [status] implementation 2019-08-24 22:19:58 +02:00
gfgtdf
671f1efc40 formatting 2019-08-24 22:19:58 +02:00
gfgtdf
7ea1377945
fix modify_unit optimisation for recall units. 2019-01-13 20:00:25 +01:00
ProditorMagnus
e3da41335e fix modify_unit split_to_array function 2018-11-11 17:30:28 +01:00
gfgtdf
3c63b1e6de optimize modify_unit
now modify_unit no longer causes the full rebuild of the unit unless it
is really needed, this is not only faster, it also prepares a future
optimisation in reducing the units size in savegame files.
2018-11-10 22:26:59 +01:00
mattsc
0e017d9f7c Lua code: replace deprecated wesnoth.set_variable() calls
(cherry-picked from commit ce7faae4f4)
2018-10-07 03:21:07 +00:00
mattsc
05d5afa6a9 Lua code: replace deprecated wesnoth.get_variable() calls
(cherry-picked from commit f1764d182f)
2018-10-07 03:21:06 +00:00
Charles Dang
0103959c36 Cleaned up deprecated API usage in core Lua
[ci skip]
2018-03-13 16:55:36 +11:00
Celtic Minstrel
8d4cf3cf62 Shorten requires where possible 2017-05-03 02:42:25 -04:00
Gregory A Lundberg
82c3b0114d Add mode=replace to [modify_unit]
When specified, replace rather than merge the [unit] sub-tags. Does not effect [object], [trait], [effect] or [advancement].

For example:
    [modify_unit]
        [filter]
            id=Deoran
        [/filter]
        mode=replace

        [filter_recall]
            [not]
                id="Sir Gerrick"
            [/not]
        [/filter_recall]
    [/modify_unit]

will replace the current contents of [filter_recall] with the given contents. Without mode=replace, the contents would be appended to the previous contents.
2016-08-24 19:35:06 -05:00
Celtic Minstrel
6dab777f66 Accept [effect] in [modify_unit] 2016-08-02 00:01:48 -04:00
Celtic Minstrel
af58b33aca [modify_unit] now supports dvs for modifications
This means [object], [advancement], and [trait] tags within [modify_unit]
can now use delayed_variable_substitution=yes.

This is currently needed for adding teleport, backstab, and leadership abilities.
2016-05-18 20:48:48 -04:00
Celtic Minstrel
d3374d3670 WML tags fixup 2016-04-04 20:10:52 -04:00
Celtic Minstrel
a791909544 Split the more complicated WML tags into separate Lua files 2016-04-04 17:03:38 -04:00