Commit graph

1122 commits

Author SHA1 Message Date
Celtic Minstrel
5a27cd5b1b Also correct the dperecation message regarding the previous commit
[ci skip]
2019-11-29 00:36:47 -05:00
Celtic Minstrel
c7e84f487c Correct old names for some deprecated (renamed) unit functions
Fixes #4608
2019-11-29 00:33:36 -05:00
Celtic Minstrel
b7a358c4af Fix a typo 2019-11-23 15:25:06 -05:00
Celtic Minstrel
859ab37254 Lua: Fix deprecate_api changing the behaviour of tables with an __index metamethod 2019-11-23 14:44:25 -05:00
Celtic Minstrel
3734bce276 Lua: Replace uses of deprecated (moved) sides functions 2019-11-23 14:41:03 -05:00
Celtic Minstrel
930e39422a Lua side proxy now has starting_location member (replaces wesnoth.get_starting_location()) 2019-11-23 14:37:41 -05:00
Celtic Minstrel
153680400d Unify the Lua and WFL interfaces to the movement type
See changelog for details.
2019-11-23 00:59:36 -05:00
jostephd
4b3a7c0800
core.lua: Link to #4584 in a comment near the new warning 2019-11-22 19:19:53 +00:00
Celtic Minstrel
981fa93a40 Make ilua output iterable userdata as tables
This means anything with __len and __pairs metamethods.
2019-11-17 14:23:59 -05:00
Celtic Minstrel
ece5490fd9 Improve ilua's table output for tables that have both an array part and additional keys
Previously for such tables it would just show the array part and ignore the rest.
2019-11-17 14:23:59 -05:00
Celtic Minstrel
d53ac4b496 Fix ilua not honouring __tostring functions for tables
This gives ilua full access to the debug module so that it can determine whether the table's metatable contains __tostring
2019-11-17 14:23:59 -05:00
Celtic Minstrel
12bb52fd4e Warn if trying to deprecate a table whose metatable is masked 2019-11-17 14:23:58 -05:00
Celtic Minstrel
212a91113c Convert wesnoth.sides to a module and move several functions to it
The old names still work but are deprecated.

In addition, all the moved functions now accept either a side number or a side userdata as the first parameter.
2019-11-17 11:35:56 -05:00
Celtic Minstrel
c27863b6f5 Alias wesnoth.interface.scroll_to_hex to wesnoth.units.scroll_to 2019-11-16 17:12:27 -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
597ed24170 Remove the helper.deprecate function, which isn't used anywhere 2019-11-16 13:11:58 -05:00
Celtic Minstrel
24b11221cf Use wml.array_variables instead of wml.array_access.get/set 2019-11-16 13:09:04 -05:00
Celtic Minstrel
498a3e98c4 Lua: Flip functions moved to the gui module
This means that they are now added to the gui module by default in C++, and only duplicated to the Wesnoth module in Lua.
2019-11-16 12:57:50 -05:00
Celtic Minstrel
0ee05637d9 Lua: Replace uses of deprecated (moved) interface functions 2019-11-16 12:35:20 -05:00
Celtic Minstrel
f016ac7183 Lua: Flip functions moved to the interface module, as well as the theme_items table
This means that they are now added to the interface  module by default in C++, and only duplicated to the Wesnoth module in Lua.

Some additional functions were moved:
- wesnoth.scroll -> wesnoth.interface.scroll
- wesnoth.zoom -> wesnoth.interface.zoom
- wesnoth.get_mouseover_tile -> wesnoth.interface.get_hovered_hex
- wesnoth.color_adjust -> wesnoth.interface.color_adjust
- wesnoth.set_menu_item -> wesnoth.interface.set_menu_item
- wesnoth.clear_menu_item -> wesnoth.interface.clear_menu_item

Added wesnoth.units.get_hovered as an alias of wesnoth.interface.get_displayed_unit
2019-11-16 12:24:31 -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
6a87f5d48d Remove Lua implementation of wesnoth.units.find_on_recall
Since there's already a native C++ version we might as well just use it.
2019-11-15 22:39:08 -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
4dc986f028 Lua: Flip functions moved to the units module
This means that they are now added to the units module by default in C++, and only duplicated to the Wesnoth module in Lua.

Some additional functions were moved:
- wesnoth.create_unit -> wesnoth.units.create
- wesnoth.get_units -> wesnoth.units.find
- wesnoth.get_unit -> wesnoth.units.get

Deprecated wesnoth.get_recall_units in favour of wesnoth.get_units, which has gained the ability to match units on the recall list if x="recall" or y="recall" appears in the filter at toplevel.

The wesnoth.units module now acts like a metatable for unit userdata, meaning that any functions (or attributes) added to the module will be visible through any unit.
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
1ac4cb4f5a Lua: Replace uses of deprecated (moved) GUI2 functions 2019-11-13 00:51:26 -05:00
Celtic Minstrel
36dc3200c5 Lua: Flip functions moved to the wml module
This means that they are now added to the WML module by default in C++, and only duplicated to the Wesnoth module in Lua.
2019-11-13 00:40:29 -05:00
Celtic Minstrel
c602110e72 Support [variables] in [modify_side]
This allows merging in changes to side variables and may alleviate the lack of [set_variables] support for side variables
2019-11-13 00:22:50 -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
Charles Dang
0d60a884c3 Simplify a few wesnoth.*_unit calls
[ci skip]
2019-10-15 20:22:09 +11:00
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