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
73983c7032
Lua: Fix nil-safety issues in location_set
...
Fixes #6231
(cherry picked from commit 1f32466782
)
2021-10-29 11:56:43 +11:00
Celtic Minstrel
4ab4b64ed7
Fix color_adjust requiring all keys
...
Fixes #6191
2021-10-18 03:07:25 +02:00
Celtic Minstrel
98b91c9d0f
AI: [micro_ai]side= can now take a list
...
Closes #6023
2021-09-04 22:20:28 -04:00
Celtic Minstrel
ff6894cee8
Lua API: Add a wesnoth.type() function
...
This checks both the Lua type and the metatable type to return a single unified result.
2021-09-04 22:20:28 -04:00
Celtic Minstrel
e9465fa03e
Lua API: Add alternative version of map function to be used on arrays
2021-09-04 22:20:28 -04:00
Celtic Minstrel
b22c3b595c
Lua API: Fix functional.map returning the wrong answer if used on a table that contains numeric keys but is not strictly an array
2021-09-04 22:20:28 -04:00
Celtic Minstrel
bedc25fb56
Lua API: location_set:to_pairs now returns named tuples
2021-09-04 22:20:28 -04:00
Celtic Minstrel
35fce3fa3b
Lua API: Fix an error in the terrain hex API
...
Attempting to access a non-string key was an error.
2021-09-04 22:20:28 -04:00
Celtic Minstrel
4837452dd7
Lua API: Add new location_set function to convert to or from a Lua map
...
This enables a location set to be passed to map functions in the functional module.
2021-09-04 22:20:28 -04:00
Celtic Minstrel
440dbbd0ad
Lua API: The value function is now optional in functional.choose[_map]
...
By default, the functions now use the value taken directly from the map or array.
In addition, if a string or other non-functional value is passed, it's used as a key on the value.
2021-09-04 22:20:28 -04:00
Celtic Minstrel
2c040ecaa7
Lua: Fix console pretty-print output not showing zero or negative keys in tables
2021-09-04 22:20:28 -04:00
Celtic Minstrel
9daa10a9f2
Lua: Fix deprecated end_text references in core
2021-08-23 09:22:08 -04:00
Celtic Minstrel
23bfa4c896
fix whitespace
2021-07-30 19:22:57 -04:00
Celtic Minstrel
44da16d66a
Lua API: Use the new location_set complement in the place_shroud deprecation wrapper
2021-07-30 19:22:57 -04:00
Celtic Minstrel
300b4492b8
Lua API: Ensure unit test assertions specify a message string
2021-07-30 19:22:57 -04:00
Celtic Minstrel
08e3a31979
Lua API: When creating a location set from triples, also support tables with x, y, and value keys
2021-07-30 19:22:57 -04:00
Celtic Minstrel
c59c3b9273
Lua API: Use a named tuple when converting a location set to triples
2021-07-30 19:22:57 -04:00
Celtic Minstrel
7d7b58e31e
Lua API: Add an absolute complement option to location_set
...
- ls:invert(w,h,[border_size]) takes an absolute complement as if the map were the given size
- ls:invert(map) takes an absolute complement relative to the specified map
- ~ls is only available in the game kernel and takes an absolute complement relative to the real map
2021-07-30 19:22:57 -04:00
Celtic Minstrel
eb1bd1af6c
Lua API: Add wesnoth.map.filter_tags for the mapgen kernel
...
This was supposed to be added for 1.16, but it was forgotten; anyone wishing to use it in 1.16 will have to copy it from World Conquest.
2021-07-30 19:22:57 -04:00
Celtic Minstrel
5951a63d3e
Lua API: Fix wesnoth.map.find(filter, unit) ignoring the unit
2021-07-30 19:22:57 -04:00
Celtic Minstrel
858f37e20e
Lua API: Fix the deprecation wrappers for place_shroud and remove_shroud
...
- The "all" special case moved to place_shroud, as it should be
- Shroud data string handling fixed
Fixes #5885
2021-07-30 19:22:57 -04:00
Celtic Minstrel
30a3619202
Lua API: Fix bug in wesnoth.map.iter_adjacent
...
Fixes #5972
2021-07-30 19:22:57 -04:00
Celtic Minstrel
5f450542f5
WFL/Lua: Add lerp and clamp functions
2021-07-30 19:22:57 -04:00
Celtic Minstrel
284f7149e3
WML API: [story]title= is now optional even in ActionWML
...
Make it default to the scenario name, as it would for scenario-level [story].
2021-07-13 14:10:07 -04:00
Celtic Minstrel
82a98fd96e
Lua API: Revive mp_settings.active_mods and mp_settings.era_id
...
These were removed without deprecation in 0efd35acbc
This adds them back as deprecated.
Fixes #5941
2021-07-13 14:10:07 -04:00
Celtic Minstrel
aed779fb6a
Lua API: Deprecate the helper.lua module itself
2021-07-07 01:32:05 -04:00
Celtic Minstrel
4ec60b99d9
Lua: Update all mainline references to the helper module
2021-07-07 01:32:05 -04:00
Celtic Minstrel
8b05449bbc
Lua API: Deprecate helper.set_wml_action_metatable
...
wml.fire now supports the same syntax - both of the following work:
- wml.fire("message", {message = "Hello World"})
- wml.fire.message{message = "Hello World"}
2021-07-07 01:32:05 -04:00
Celtic Minstrel
771f472dd7
Lua API: Add wesnoth.map.iter_adjacent
...
This replaces helper.adjacent_tiles
2021-07-07 01:32:05 -04:00
Celtic Minstrel
47951c4700
Lua API: Add wesnoth.sides.iter
...
This replaces both helper.get_sides and helper.all_teams
2021-07-07 01:32:05 -04:00
Celtic Minstrel
1e42f80c13
Lua API: Use the named tuple idiom for WML tags
...
Instead of this:
for i,t in ipairs(cfg) do
if t[1] == 'foo' then
do_something(t[2])
end
end
You can now write this:
for i,t in ipairs(cfg) do
if t.tag == 'foo' then
do_something(t.value)
end
end
2021-07-07 01:32:05 -04:00
Celtic Minstrel
b4809e9ded
fix whitespace
2021-07-02 18:51:48 -04:00
Celtic Minstrel
7c2d0c1c5d
Lua API: Fix location_set.of_pairs including the location in the value
...
This is the real cause of the breakage in 5a9c24c4e7
and d04bd2bf5d
.
A returned location now has both x/y and 1/2, so the location_set logic removed the x/y but kept the 1/2, causing it to break when converted to a config.
This makes it use rawget when the value is a table, which fixes it.
2021-07-02 16:55:42 -04:00
Celtic Minstrel
f5de3cca18
Lua API: Add a mode argument to locaton_set:to_wml_var
...
It has the same semantics as the mode in wml_utils.vwriter.init.
2021-07-02 14:04:54 -04:00
Celtic Minstrel
695eb8356d
Lua API: Better error checking when converting a location set to a WML variable
2021-07-02 14:04:54 -04:00
Celtic Minstrel
c6f4e8db28
Lua API: Use string indexing here
2021-07-02 14:04:54 -04:00
Celtic Minstrel
0b309a0d6a
Lua API: Move wesnoth.as_text into core
...
This means it's now usable in map generation or plugin scripts.
2021-07-02 14:04:54 -04:00
Celtic Minstrel
c1304fb441
Lua: Add location_set.of_raw to ease working with AI functions that return raw location sets
2021-07-02 14:04:53 -04:00
Gunter Labes
02585e5aff
Call actually existing function
...
Fixes 7b2ceb8
.
2021-06-30 14:28:29 +02:00
Celtic Minstrel
3b556b3c4b
Improve a deprecation message
2021-06-29 09:35:15 -04:00
Celtic Minstrel
3c9639f603
Fix another deprecation message
2021-06-29 09:23:58 -04:00
Celtic Minstrel
43e7dadbfc
Fix [modify_side]reset_maps|view
...
Addresses #5897
2021-06-25 20:01:31 -04:00
Celtic Minstrel
0ae61a8de8
Fix wesnoth.map.place_area
...
It would've been fine if I didn't need to support the deprecated mode...
2021-06-24 19:51:03 -04:00
Celtic Minstrel
6ab0234c59
Take the super-simple approach to fixing [time_area]
...
Instead of trying to split the input config into two parts, just pass the same config as both arguments. The filter will ignore the [time] tags and the time area will ignore everything else.
2021-06-24 13:50:40 -04:00
Celtic Minstrel
b955388ad2
[time_area] fixup
2021-06-24 09:22:53 -04:00
Celtic Minstrel
3bcc18ad96
A cleaner interface for wesnoth.map.place_area
2021-06-24 00:51:13 -04:00
Celtic Minstrel
0ef4a86b7e
Fix wml.remove_children
2021-06-24 00:51:13 -04:00
Pentarctagon
0b4f820a46
Fix whitespace.
2021-06-23 10:30:39 -05:00
Celtic Minstrel
8bcfbed34e
Implement shroud API deprecation wrappers that handle shroud data strings
...
Addresses #5885
2021-06-23 09:55:26 -04:00