Commit graph

84096 commits

Author SHA1 Message Date
Celtic Minstrel
cb1853b4bc Lua API: Add __dir metamethod to side objects 2024-09-15 15:27:39 -04:00
Celtic Minstrel
c7ad093ac5 Lua API: Avoid trying to iterate a userdata in location_set.of_pairs
Fixes #9345
2024-09-15 15:27:39 -04:00
Celtic Minstrel
78360a582e Lua API: Add __dir metamethod to wesnoth.unit_types, wesnoth.unit_types.TYPE, wesnoth.unit_types.TYPE.variations 2024-09-15 15:27:39 -04:00
Celtic Minstrel
b977496dcb Lua API: Add a mechanism for userdata to declare that they are "table-like" for the purpose of the __dir metamethod
This can serve as a hint that you can dig down into them.

Use the mechanism for wesnoth.colors, wesnoth.game_config, and wesnoth.current.
2024-09-15 15:27:39 -04:00
Celtic Minstrel
a690d780cb Lua API: Add __dir metamethod to wesnoth.game_events
The purpose of this is to show all potential hooks in the output, not just the hooks that are currently assigned.

This alse adds an __index metamethod that returns no-op versions of each callback, so that the __dir output correctly shows them as functions.
2024-09-15 15:27:39 -04:00
Celtic Minstrel
6f0567df8f Lua API: Add __dir metamethod for wesnoth.game_config 2024-09-15 15:27:39 -04:00
Celtic Minstrel
03924aac1d Lua API: Remove deprecated wesnoth.game_config attributes 2024-09-15 15:27:39 -04:00
Celtic Minstrel
1079d2541d Lua API: Exclude campaign, era, and mp_settings from scenario __dir as appropriate 2024-09-15 15:27:39 -04:00
Celtic Minstrel
5bbca1a1c9 Lua API: Exclude color ranges with numeric names from the __dir output
In general they are not supposed to have numeric names, but several with numeric names exist for backwards compatibility.
2024-09-15 15:27:39 -04:00
Celtic Minstrel
d7eba7b950 Lua API: Add __dir metafunction to schedule objects
This covers both wesnoth.current.schedule and the objects returned by wesnoth.map.get_area()

Also, the wesnoth.schedule module is no longer treated like the schedule metatable, since none of the functions in the module take a schedule as the first argument. This may be reverted in the future.

The attribute registration system has also been extended to permit registry tables to conditionally add certain keys.
2024-09-15 15:27:39 -04:00
Celtic Minstrel
facf4eefda Lua API: Add __dir metamethod to wesnoth.scenario 2024-09-15 15:27:39 -04:00
Celtic Minstrel
dd5dbf96c8 Lua API: Add __dir metamethod to wesnoth.current 2024-09-15 15:27:39 -04:00
Celtic Minstrel
fcd66c25a3 Lua API: Add __dir metamethod to wesnoth.interface.game_display 2024-09-15 15:27:39 -04:00
Celtic Minstrel
c32ae8146e Lua API: Add __dir metamethod to unit variables and unit statuses 2024-09-15 15:27:39 -04:00
Celtic Minstrel
d4278fa1be Lua API: Add __dir metamethod to units metatable
This implements a new system for registering attributes, adapted from the system for widget attributes.
2024-09-15 15:27:39 -04:00
Celtic Minstrel
ab022c09ae Lua API: Add unit:rebuild
Fixes #9314
2024-09-15 15:27:39 -04:00
Celtic Minstrel
6d8a17aa8d Lua API: Add mathx.lerp_index and wesnoth.game_config.palettes 2024-09-15 15:27:39 -04:00
Celtic Minstrel
752f251a93 WFL: Add lerp_index and get_palette functions
The latter exposes access to the [color_palette] tags in game_config, as well as the colour scales.
2024-09-15 15:27:39 -04:00
Celtic Minstrel
fc86cb0b93 WFL: Add replace_all, starts_with, and ends_with string functions.
The latter two are also added to the Lua stringx module.
2024-09-15 15:27:39 -04:00
Celtic Minstrel
1b63da9974 Lua API: Named tuples no longer all have the same __metatable
Now the __metatable contains the list of member names.

This means that wesnoth.type won't treat named tuples with different members as the same thing – not evne if they're the same length. Which is probably a good thing!
2024-09-15 15:27:39 -04:00
Celtic Minstrel
2a26a68025 Some updates to Lua map location operations
* Rename the vector operations to hex_vector (to emphasize that they are NOT standard vector ops) and document them as official API
* Add new get_hexes_at_radius, which returns an unfilled ring (as opposed to get_hexes_in_radius which returns a filled circle)
* Expose the new cubic coordinate conversions
2024-09-15 15:27:39 -04:00
Celtic Minstrel
6547d224e0 Remove map_location::get_in_basis_N_NE
It was ONLY used in one place, to calculate rotate_right_around_center, and was likely not a very efficient way of calculating that anyway. I've included a different implementation of rotate_right_around_center that uses cubic coordinates.
2024-09-15 15:27:39 -04:00
Celtic Minstrel
81e612b75b Fix copy-paste error 2024-09-15 15:27:39 -04:00
Celtic Minstrel
ca52118ff0 Lua/WFL: Expose healthy and fearless attributes 2024-09-15 15:27:39 -04:00
Charles Dang
0af60e6fcc Display: use split_view when parsing overlay teams
We have references to existing strings here. No need to make copies with `split`.
2024-09-15 12:23:02 -04:00
Charles Dang
ccdc8b17f4 Fixup 3af690331a
Its not Lua.
2024-09-15 12:22:45 -04:00
Gunter Labes
654a199d5f
Use proper apostrophe 2024-09-15 13:13:29 +02:00
Charles Dang
3af690331a Lua API: remove deprecated unit.side and terrain.owner 2024-09-15 01:43:11 -04:00
Charles Dang
78676a27ad Use structured bindings for config attribute ranges in most places 2024-09-15 00:16:51 -04:00
Charles Dang
857799da37 Config: remove <ctime> and <iterator> includes 2024-09-15 00:16:51 -04:00
Charles Dang
6df2653c61 Config: use structured bindings 2024-09-15 00:16:51 -04:00
Charles Dang
a9e6af20d3 Config: avoid second lookup when adding child nodes 2024-09-15 00:16:51 -04:00
Charles Dang
7332e124eb Config: remove string and const char* overloads for operator[]
Since these just construct a string_view from their arguments, we can just let the implicit conversion happen.
2024-09-15 00:16:51 -04:00
Charles Dang
c34a18da47 Config: fix a couple functions not taking string_view args 2024-09-15 00:16:51 -04:00
gfgtdf
ff9ccabbee
Fix #9190 error in Lua mapgen 2024-09-15 03:24:05 +02:00
Oleksii
094918c5ac
LoW: some fixes for S10, S22 (#9128)
* fixes for S10, S22
* fixes for #7137 #8359 #8360
* fixes for #7137 #8359 #8360
* fixes for #7137 #8359 #8360
2024-09-14 15:00:02 -05:00
ZombieKnight
4f7ae435dd
Make status orb work with custom max/min_range (#9255)
This code sets orb color to can-still-make-an-action if unit has no moves left,
and has a visible enemy within max and min range of a weapon.  This also affects
if the unit is selectable with 'N' (units that can move or attack).

Currently, it doesn't affect the mainline much, as no unit has a weapon
max/min_range different from 1, most notice-able, it marks units with no attack
as incapable of action, after having no moves left.

The purpose of this is part of getting real-ranged attacks into the mainline.
2024-09-14 19:07:54 +02:00
Gunter Labes
ed354c1d41
Remove pointless closure 2024-09-14 18:22:32 +02:00
Nils Kneuper
ee7d026daf updated Bengali translation 2024-09-14 12:02:16 +02:00
Nils Kneuper
64cc8af1d7 updated Czech translation 2024-09-14 00:47:59 +02:00
Nils Kneuper
934385ed08 updated Ukrainian translation 2024-09-14 00:46:58 +02:00
Nils Kneuper
6f09098adc updated Italian translation 2024-09-14 00:45:53 +02:00
Nils Kneuper
bcc1c68359 updated Chinese (Simplified) translation 2024-09-14 00:44:55 +02:00
Gunter Labes
c53cb1d6fb
Add missing tags to game config schema 2024-09-13 21:59:04 +02:00
Gunter Labes
41729833c8
Include the unknown condition in the error message 2024-09-13 21:50:17 +02:00
Gunter Labes
0681b41323
Update wesnothd synopsis 2024-09-13 21:43:28 +02:00
Steve Cotton
7f8e3344cf Add a second unit test for TEST_FORCE_CHANCE_TO_HIT
It should work even when the macro appears in the same event as the
attack; this tests that.

The new one uses the COMMON_KEEP macro, but I've left the existing
one unchanged, except for the renaming.
2024-09-13 19:15:56 +02:00
Subhraman Sarkar
14732806c9 Preferences: move the Apply button and disable it unless needed
this also makes it obvious that the Apply button is used only for UI theme selection, and is not a global Apply button
2024-09-11 15:07:49 -04:00
Wedge009
b316ee518b
Extend case-insensitive filtering beyond ASCII characters (#9332)
This updates filtering for:
* Game Load dialogue
* MP lobby
* In-game label and unit search
* Add-ons client (now used consistently)
2024-09-11 14:42:45 -04:00
Gunter Labes
ad85d62f7d
Remove useless comment 2024-09-11 11:58:55 +02:00