Commit graph

19 commits

Author SHA1 Message Date
Celtic Minstrel
9183ee6791 Move the other game_events deprecations into the game_events file 2023-10-15 17:43:22 -04:00
Toranks
2de929e026
Typo hander > handler (#7464) 2023-03-20 19:36:52 -05:00
Celtic Minstrel
e08451517a Fixup some event deprecations
No functionality change, just documentation
2022-07-26 00:08:00 -04:00
Celtic Minstrel
5a184bbb40 Split wesnoth.game_events.add into multiple functions
Basically this means each of the call modes of the old function is now a separate function.

- add_repeating and add_menu take an ID and a function
- add_wml takes variable substitution setting and a config
- add takes the full options table
2022-07-18 21:56:42 -04:00
Celtic Minstrel
8aa2ee74a2 Move the event firing functions to wesnoth.game_events
* These functions take the full event data config as the final argument, rather than just the weapon info subconfigs.
* The [fire_event] tag now supports a [data] tag that can add additional data to the event, for example damage_inflicted. The [primary_attack]  and [secondary_attack] tags are still supported and are not deprecated.
* wesnoth.current.event_context now has a data child which holds the full event data. It still duplicates common info (weapons and damage inflicted) in the same way as before.
2022-07-18 21:56:42 -04:00
Celtic Minstrel
8cd1332630 Enable setting an arbitrary Lua function as an event handler.
Unlike the old wesnoth.game_events.on_event hook and the "convenient" on_event() wrapper for it, this new functionality supports all of the features of WML events, with the sole exception of serialization, since it's not possible to reliably serialize a Lua function.

This commit also divorces menu items from the event that they trigger. The undocumented wesnoth.interface.set_menu_item function no longer adds an event for the menu item; the caller needs to separately register an event using the new functionality.
2022-07-18 21:56:42 -04:00
Celtic Minstrel
a76aa9bddc
Add wesnoth.interface.add_floating_label as a replacement for wesnoth.print (#5837)
This returns a label handle which allows you to remove, reposition, or replace the label later.

In addition to all the features of wesnoth.print, you can now specify where the label appears onscreen, as well as a fadeout time separate from the duration.

You can also anchor the text to an edge or corner instead of centering in on the screen,
specify the maximum width it can occupy as an absolute width or a percentage,
and specify a background colour and transparency.

It includes a demo scenario that demonstrates many of the capabilities of the API.
To play the demo scenario, run with -toverlay_text_demo or select it from the in-game test list.
2022-04-10 13:00:29 -04:00
Celtic Minstrel
e1300e29b0
Lua API: Add inline documentation for pretty much everything and convert existing docs (#6483)
The new format is EmmyLua-based and can be used with (at least) Visual Studio Code.
2022-02-17 13:43:31 -05:00
Celtic Minstrel
91f6bf93a4 Fix a broken deprecation and replace some deprecated uses
Fixes #5877
2021-06-20 00:59:59 -04:00
Celtic Minstrel
bb21464a0a Lua: Move the gamestate_inspector deprecation to a different file 2021-06-19 17:30:22 -04:00
Celtic Minstrel
7f162cbd24 Lua: Rename find_vacant_tile to find_vacant_hex for naming consistency 2021-06-19 17:09:31 -04:00
Celtic Minstrel
bfa7e918e4 Move several functions to the wesnoth.interface module 2021-06-19 12:09:46 -05:00
Celtic Minstrel
eab8645e90 Fix incorrect deprecation wrapper for wesnoth.color_adjust
The source function wasn't public API, but it can't hurt to make it work.
2021-05-13 19:22:31 -04:00
Celtic Minstrel
0970880910 whitespace fixes 2021-05-11 14:52:22 -04:00
Celtic Minstrel
c88e60b98e Now color_adjust takes three arguments instead of a config
Consider it part of the public API now.
2021-05-11 14:52:19 -04:00
Steve Cotton
24e2f8f767 Whitespace fixes for no newline at end of file
The new CI script whitespace-checking script changes these, but not on Linux.
2021-05-03 11:52:40 +02:00
Pentarctagon
d203b061f9
Whitespace cleanup of lua files. 2021-04-25 15:11:09 -05:00
Celtic Minstrel
a2d7a26365
Fix several Lua issues, mostly unintentional globals (#5587) 2021-03-06 17:01:53 -05:00
Celtic Minstrel
862668911a Split core.lua up by module to make things easier to find
Core is now a directory instead of a file. The Lua kernel automatically loads all files in that directory when it starts up.
2021-02-20 21:32:29 -05:00