Commit graph

782 commits

Author SHA1 Message Date
josteph
21823d9332 Lua: Fix wesnoth.deprecate_api for the case of deprecating a table that had a metamethod other than __index/__newindex 2019-09-26 12:17:05 +00:00
josteph
56131f14c4 lua: Fix a bug when calling wesnoth.deprecate_api on a table that had a metatable.
The old metatable was used as the metatable of the new element's
metatable, which doesn't make any sense at all.

Fixes #4079
2019-09-26 12:17:05 +00:00
Steve Cotton
06dd9a140c Add [find_path] option "nearest_by", and simple_find_path test
Adding this is issue 2 of #4177, changing the behavior when [find_path]
is given a SLF which matches multiple hexes.

The map and tests here should be easy enough for manually editing them. It
duplicates some of the functionality of the existing characterize_pathfinding
tests, however those tests need their expected values to be calculated and
can't be changed by hand.

'''nearest_by''': {DevFeature1.15|2} possible values "movement_cost"
(default), "steps", "hexes". If the [destination] SLF matches multiple hexes,
the one that would need the least movement points to reach may not be the one
that's closest as measured by '''hexes''', or closest as measured by steps,
from the starting point.

Behavior in 1.14 depended on which hex was checked first.
2019-09-11 11:17:56 +02:00
gfgtdf
7621b9b63e
fix [modify_unit] cannot set attributes to false #4325 2019-09-08 19:50:56 +02:00
Celtic Minstrel
b08677c678 Fix erroneous comment 2019-08-30 23:23:10 -04:00
gfgtdf
ce5696f334 add duration= key to [unit_overlay] 2019-08-24 22:19:58 +02:00
gfgtdf
5442d922c4 add [unit_overlay] object_id= attribute
with this the object can be removed with [remove_object]
2019-08-24 22:19:58 +02:00
gfgtdf
2117ce8332 new tag [remove_trait] 2019-08-24 22:19:58 +02:00
gfgtdf
fbdd926e14 improve [modify_unit] [status] implementation 2019-08-24 22:19:58 +02:00
gfgtdf
308075ce67 formatting 2019-08-24 22:19:58 +02:00
gfgtdf
671f1efc40 formatting 2019-08-24 22:19:58 +02:00
gfgtdf
8a33ad0bf1 fix #4256 wesnoth.require with relative paths
now wesnoth.require is able to detect when the same file is
required two times using different names (like a/../a/b.lua
a/b.lua) and will only execute it once.

for this a new function wesnoth.canonical_path was added
2019-08-24 18:52:14 +02:00
gfgtdf
527f0a7580
fix [terrain_mask]
previously it would just ignore all [rule]s
2019-08-20 19:58:59 +02:00
Pentarctagon
93dff47a75 Make [option]'s message and description attributes equivalent.
Also removes the deprecation message for the message attribute.
2019-08-17 15:17:19 -05:00
Steve Cotton
b2cd1cf6c3 Handle unit overlays as modifications, allow [effect] to remove them
Possible fix for #4058, with the following logic:

* If non-empty, [unit]overlay= is handled by adding modifications
* unit::write will always output an empty overlay=
* The Lua API's get_units() will still provide the list of overlays
* [effect]apply_to=overlay can now remove as well as add overlays
* [remove_unit_overlay] is implemented with [effect]apply_to=overlay

Using [object]s with durations hasn't been tested, but expected effects:
* An expired add= followed by a non-expired remove= will simply cause the remove=
    to have no effect when std::remove(overlays_ ...) is called.
* A remove= followed by [remove_unit_overlay] cause the [remove_unit_overlay] to be a no-op,
    and the overlay will reappear when the first remove= expires. This edge case is already
	documented as unsupported on the wiki.
2019-08-10 23:25:04 +02:00
gfgtdf
daf054752a support item_name= in [store_items]
we use it in SotA16 to make the scenario more robust against
[modification]s that might add [item]s for decoration.
2019-03-20 20:27:33 +01:00
Celtic Minstrel
a50ec3f872 Support location_id in [role][auto_recall] 2019-03-03 11:56:34 -05:00
Celtic Minstrel
9d8d57b16d Fix WFL in [random_placement] not receiving the size variable 2019-03-03 11:56:34 -05:00
gfgtdf
7ea1377945
fix modify_unit optimisation for recall units. 2019-01-13 20:00:25 +01:00
gfgtdf
a32e49e32f
fix [item] z_order being lost after reload 2019-01-01 20:33:39 +01:00
Celtic Minstrel
ea9fddcd23 Support [disallow_end_turn]reason= and use it in the tutorial 2018-11-24 17:46:29 -05:00
Celtic Minstrel
0bf377ab9f
Lua API: Fix some deprecations of game-only functions
Fixes #3737
2018-11-22 08:55:53 -05:00
Celtic Minstrel
2f9bca43af
Fix erroneous deprecation 2018-11-15 23:12:55 -05:00
Jyrki Vesterinen
68f3a8e846 Lua fixes 2018-11-16 05:47:28 +02:00
Celtic Minstrel
6d7736e6e6 Deprecate helper.wml_error and move it to wml.error 2018-11-15 21:06:55 -05:00
Celtic Minstrel
8bcf749666 Lua API reorganization: units module deprecations 2018-11-15 21:06:55 -05:00
Celtic Minstrel
7c3fd9a612 Lua API reorganization: units module 2018-11-15 21:06:55 -05:00
Celtic Minstrel
3e79b3bde8 Lua API reorganization: GUI module deprecations 2018-11-15 21:06:55 -05:00
Celtic Minstrel
3ec9ce4b60 Lua API reorganization: GUI module 2018-11-15 21:06:55 -05:00
Celtic Minstrel
55a6c16810 Lua API reorganization: interface module deprecations 2018-11-15 21:06:55 -05:00
Celtic Minstrel
e3e80b4a99 Lua API reorganization: interface module 2018-11-15 21:06:55 -05:00
Celtic Minstrel
b94ccf9020 Rewrite helper.modify_unit to not use a WML variable 2018-11-11 20:03:05 -05:00
Celtic Minstrel
9885932011 Use wml.tag in helper.get_user_choice 2018-11-11 20:03:05 -05:00
Celtic Minstrel
40bf04ec8e Rewrite helper.move_unit_fake to not use a WML variable 2018-11-11 19:51:29 -05:00
Celtic Minstrel
20e85aa417 Lua API: Add wml.load and wml.parse functions 2018-11-11 16:01:08 -05:00
Celtic Minstrel
639787e1c9 Merge pull request #2562 from wesnoth/schema 2018-11-11 13:52:19 -05: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
Celtic Minstrel
c4f2e839ab
Fix [random_placement] executing the code for each element twice (fixes #3663) 2018-10-27 13:56:42 -04:00
Celtic Minstrel
96f154716a Fix misleading function name in [endlevel] definition
The name gave the impression that it returns an integer,
which is not guaranteed.
2018-10-23 22:49:18 -04:00
gfgtdf
eba882b957 implement [lua]name=, fixes #3381 2018-10-22 01:34:21 +02:00
gfgtdf
ae5c5c4043
fix missing comma 2018-10-17 00:13:27 +02:00
gfgtdf
1a7724e547 reset unit overlay & image_mods on advance_to
this fixes remove_modification for these effects, and also a bug where these effect would be applied twice after a unit advances.

fixes #3264
fixes #3220

This also changes the implementation of [unit_overlay] to use [effect]s now so tht changesdone via [unit_overlay] ae persistent as they were before.
2018-10-16 23:03:37 +02:00
jostephd
e766cdc7cc WML: Support [filter_side] in [item]. (#3533)
* WML: Support [filter_side] in [item].

If [filter_side] is present then "team_name" is ignored.

Fixes #1477.

* WML: Compare [item]team_name to [side]team_name using intersection.

Fixes problems with substrings and when one or the other is a
comma-separated list. See #3533

* WML: Rename [item][filter_side] to [item][filter_team]

* Add changelog entry

(cherry-picked from commit 3a3b752881)
2018-10-07 03:25:20 +00:00
V N
20177dbe5e prevent double execution of on_event.lua
makes it safe to dofile("on_event.lua")

(cherry-picked from commit 6010ffe98e)
2018-10-07 03:25:18 +00:00
gfgtdf
bc89512a5c add game_config.combat experience
and make [harm_unit] use these values instead of hardcoded 8*level for
killing and level for combat.

(cherry-picked from commit 3591e82586)
2018-10-07 03:25:00 +00:00
newfrenchy83
c1a70068d5 Lua API: implicitly clear animator after playing it (#3536)
This prevents the animator from holding a strong reference to the target unit, which was keeping the unit object alive and thus preventing the unit halo, if any, from disappearing.

(cherry-picked from commit 7d6e2b2a10)
2018-10-07 03:24:59 +00:00
newfrenchy83
98bec00fac [heal_unit]: clear the animation after playing it (#3526)
Fixes another case of unit halo remaining after death.

(cherry-picked from commit 3541629197)
2018-10-07 03:24:56 +00:00
Jyrki Vesterinen
ee3e842cbc [animate_unit]: clear the animation after playing it
This avoids a reference to the unit from being leaked, which prevented the
unit's halo (if any) from disappearing when the unit died.

Fixes #3509. Closes #3520.

(cherry-picked from commit e63bd35f9d)
2018-10-07 03:24:55 +00:00
gfgtdf
3c86e3bc8f fixup [terrain_mask]
(cherry-picked from commit 7d44782e5c)
2018-10-07 03:24:14 +00:00