Commit graph

1122 commits

Author SHA1 Message Date
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
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
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
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
Gunter Labes
41729833c8
Include the unknown condition in the error message 2024-09-13 21:50:17 +02:00
Celtic Minstrel
8baf95601d [LuaDoc] Mark filesystem.asset_type as an enumerator 2024-08-13 08:54:04 -04:00
Celtic Minstrel
faaeaadaa1 [Lua] Avoid missing field warning by reversing the order of the check 2024-08-13 08:54:04 -04:00
Celtic Minstrel
9e79a627c3 [Lua] Fix some accidental global warnings 2024-08-13 08:54:04 -04:00
Celtic Minstrel
dd24051c17 [Lua] Mark location_set.values as private 2024-08-13 08:54:04 -04:00
Celtic Minstrel
b6da8a705f [Lua] Avoid variable reuse as a different type 2024-08-13 08:54:04 -04:00
Celtic Minstrel
542581916f [Lua] Suppress some diagnostics and also recommend suppressing certain diagnostics globally 2024-08-13 08:54:04 -04:00
Toom
31658e2587
Set unit hitpoints to 0 during [kill] (#9164) 2024-08-10 09:20:12 -05:00
Tahsin Jahin Khalid
d467632398
[objectives.lua] improve clarity of error message (#8780) 2024-08-03 11:24:41 -05:00
Pentarctagon
5c3188581b
update CI to Ubuntu 24.04 (#9139) 2024-07-28 13:07:59 -05:00
Celtic Minstrel
a9948d3fff [Lua.MapGen] Accept both comma-separated lists and arrays for f.adjacent 2024-07-21 19:58:03 -04:00
Celtic Minstrel
19f3682bdf [Lua.Mapgen] Add a few more ways to pass a location set to f.find_in
These may be less efficient in some cases, and there's even a couple of degenerate cases, but it's definitely easier to use like this.

This also adds an example of the original method, using a string to reference a separate list.
2024-07-21 19:58:03 -04:00
Celtic Minstrel
a72ec39f79 [Lua] Make f.is_loc work either with a location object or with separate x,y parameters 2024-07-21 19:58:03 -04:00
Celtic Minstrel
95bfd07286 [Lua.MapGen] Exposed previously-unused wesnoth.map.filter_tags.onborder filter since it seems useful 2024-07-21 19:58:03 -04:00
Celtic Minstrel
ab008161f1 [Lua.MapGen] Add wesnoth.map.filter_tags.formula that takes a WFL formula to match against locations 2024-07-21 19:58:03 -04:00
Toom
dbbee82d9c validate [screen_fade] required parameters 2024-07-21 17:48:45 -05:00
Celtic Minstrel
c96196cd4d [Lua] Use game_events.add for feeding instead of add_repeating 2024-07-20 11:09:33 +02:00
Gunter Labes
944ed026a2 Use same default id in [remove_unit_overlay] as [unit_overlay] 2024-06-13 18:02:05 +02:00
Toom
9e08a78bf5
Reject [terrain] with unknown terrain type 2024-05-21 11:34:41 +02:00
Celtic Minstrel
058d0502e5 [Lua] Update obsolete use of [1],[2] to refer to locations, and simplify some code by leveraging the fact that any object with x,y qualifies as a location; also use moves_left for reachmaps instead of [3] 2024-05-19 12:54:35 -04:00
Celtic Minstrel
f5c4f2e841 [Lua] Update obsolete usage of [1],[2] to refer to a tag's name and contents 2024-05-19 12:54:35 -04:00
Celtic Minstrel
0f6fe67477 [Lua] Use wml.tag to construct WML tables 2024-05-19 12:54:35 -04:00
Celtic Minstrel
7aa5450a41 [Lua] Replace gui.show_inspector's undocumented config parameter with a string parameter that does the same thing.
It's still supported to pass a config, just in case anything relied on that.

This also updates the LuaDoc documentation at the same time.
2024-04-11 23:49:15 -04:00
Celtic Minstrel
d734bfb9e2 [Lua] Make wesnoth.read_location return its result in standard named tuple format 2024-04-11 23:48:21 -04:00
Celtic Minstrel
bb3c95ebbc [Lua] Remove nonexistent parameter 2024-02-26 13:24:38 -05:00
Celtic Minstrel
1fd17d94ba [Lua] Fix missing parameter warning when passing empty filter 2024-02-26 13:24:37 -05:00
Celtic Minstrel
1efc2fbe4d [Lua] Avoid reusing no-longer-needed variables for different meanings
This raises Lua warnings about mismatched types
2024-02-26 13:24:36 -05:00
Celtic Minstrel
f19b7829c7 [Lua] Fix call of nonexistent function 2024-02-26 13:24:36 -05:00
Celtic Minstrel
b506010a8f [LuaDoc] Correct some dumb errors 2024-02-13 19:29:21 -05:00
Celtic Minstrel
4b5a8e25e8 [LuaDoc] Suppress some diagnostics 2024-02-13 19:29:21 -05:00
Celtic Minstrel
6145c48d35 [LuaDoc] Fix incorrect declaration of unit.variables and side.variables - make them consistent with wml.variables 2024-02-13 19:29:20 -05:00
Celtic Minstrel
e644613cae [LuaDoc] mathx.random_choice can return nil if the input list is empty 2024-02-06 19:04:02 -05:00
Celtic Minstrel
a38e67da45 [LuaDoc] Title is optional for alert/confirm 2024-02-06 19:04:02 -05:00
Celtic Minstrel
f9c7336f1a [LuaDoc] Document location_set operators 2024-02-06 19:04:01 -05:00
Celtic Minstrel
c7741907c2 [LuaDoc] Fix several errors in the inline documentation 2024-02-06 19:04:00 -05:00
Celtic Minstrel
5a51a309a4 [LuaDoc] Fix several minor errors in the specification of API 2024-02-06 19:04:00 -05:00
Steve Cotton
6b516e8aa5 Fix deprecation warning when setting [endlevel]end_credits=
Change the Lua implementation to directly call the
non-deprecated function, this is related to 9daa10a9f2.

Clean up the C++ header files by removing the declarations of
functions that were removed in 3c8de46771.

Use [endlevel]end_credits=no in the test scenario (trigger it
by moving to hex 9,3). If you debug with :next_level without
triggering the moveto, "The End" will show; trigger the moveto
first, and it won't show the credits.
2024-02-02 16:04:27 +01:00
Toom
2056be55a3
Support [harm_unit]experience values kill/attack/defend/fight/yes/no (#8231) 2024-01-18 11:32:18 +01:00
gfgtdf
955a8bc445
use game_events.add in on_event.lua (#8082)
use game_events.add in on_event.lua

previously on_event.lua and game_events.add had separate priority lists, so that independent of the priority parameter (which both game_events.add and on_event.lua now support) on_event.lua events were always executed first. 

The set_undoable(true) call is there to match the previous behavior of on_event.lua where events implemented via on_event were undoable by default.
The higher default priority of 0.5 is there to match the previous behavior of on_event.lua where events implemented via on_event.lua were always run before wml events.
2023-12-15 21:28:45 +01:00
Gunter Labes
8b111a2a76 Avoid accessing data of potentially killed unit
Fixes #8019.
2023-11-12 22:12:17 +01:00
Celtic Minstrel
e3b3d08c3f Make wesnoth.allow_undo still work, even though it was explicitly internal and not meant to be used.
Fixes #8018
2023-11-04 22:40:18 -04:00
Celtic Minstrel
9183ee6791 Move the other game_events deprecations into the game_events file 2023-10-15 17:43:22 -04:00
Celtic Minstrel
857d7e120a Undeprecate on_event() for now 2023-10-14 19:26:36 -04:00
Celtic Minstrel
38ae304725 Move Lua undo API into experimental 2023-10-14 19:26:36 -04:00
Celtic Minstrel
10d67aa82a Implement a new Lua API to the undo system 2023-10-14 19:26:36 -04:00