80952 Commits

Author SHA1 Message Date
Iris Morelle
c11d0365f3
config: Add copy_or_remove_attributes()
Unlike copy_attributes(), this erases attributes in the destination that
don't exist in the source.
2022-07-19 08:42:40 +02:00
Celtic Minstrel
0923a67d9b Update changelog 2022-07-19 02:22:48 -04:00
Celtic Minstrel
22ad4d7137 A few missing details in wesnoth.game_events.add LuaDoc 2022-07-19 02:10:29 -04:00
Celtic Minstrel
715cf3864e Add missing tag in the schema 2022-07-19 02:10:02 -04:00
Celtic Minstrel
5001999e0b Some cleanup of the events API
- Add default name for wesnoth.game_events.add when it's a menu item
- Add error message when both ID and name are empty
2022-07-18 21:56:42 -04:00
Celtic Minstrel
81d56508c7 Support {filter_type = "variable_path"}
This creates a filter that's read dynamically from the specified WML variable.
2022-07-18 21:56:42 -04:00
Celtic Minstrel
d1f846d9da Support "formula" in the filter table
Although it's already possible to pass {formula = "whatever"},
this change allows mixing that with the simplified syntax,
such as {formula = "whatever", side = {side = 3}}
2022-07-18 21:56:42 -04:00
Celtic Minstrel
a0fbb87677 Fix WML errors showing as Lua errors 2022-07-18 21:56:42 -04:00
Celtic Minstrel
7e234f8833 Replace deprecated usages of on_event() 2022-07-18 21:56:42 -04:00
Celtic Minstrel
501936affb Support primary_attack and secondary_attack in wesnoth.game_events.fire
These are taken as synonyms of the actual internal tag names, [first] and [second]. So, first is interchangeable with primary_attack and second is interchangeable with secondary_attack.
2022-07-18 21:56:42 -04:00
Celtic Minstrel
8eb7a70a63 Add luadoc for the new event functions 2022-07-18 21:56:42 -04:00
Celtic Minstrel
72249b1bb3 Fix non-serializable events being serialized as an empty [event] tag 2022-07-18 21:56:42 -04:00
Celtic Minstrel
865eface07 Include non-serializable events in the gamestate inspector
Since they're non-serializable, the code can't be shown, but the fact that unspecified Lua code is present will be shown.
2022-07-18 21:56:42 -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
59c5d5ba66 Fix dynamic filters behaviour change 2022-07-18 21:56:42 -04:00
Celtic Minstrel
42889232ea Update schema for the new [event] options 2022-07-18 21:56:42 -04:00
Celtic Minstrel
19c62a083e Update [remove_event] to use new API 2022-07-18 21:56:42 -04:00
Celtic Minstrel
8a72206f02 Unit tests for the new filter options 2022-07-18 21:56:42 -04:00
Celtic Minstrel
245cd57d24 Unit tests for each way of assigning an action to an event handler 2022-07-18 21:56:42 -04:00
Celtic Minstrel
d03116f829 Adding an event handler via the positional call style now defaults to a repeating event
This is a somewhat controversial change!

PROS:
- This makes wesnoth.game_events.add a drop-in replacement for the on_event function
- If you're registering events in preload, most of them WILL be repeating events

CONS:
- This makes the default depend on the call style; in positional style, it defaults to repeating, and in named-argument style, it defaults to non-repeating
- This makes the default different from the WML default of non-repeating events
2022-07-18 21:56:42 -04:00
Celtic Minstrel
3435c56f69 Improve the handling of event serialization when Lua code is attached
- Don't try to serialize an event with a Lua filter (ie, add{filter = function() end})
- Write the serialization warning to in-game chat, but ONLY if the event was registered after preload
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
ae5a27c996 Support passing an arbitrary Lua function as the filter when the event is registered from Lua. 2022-07-18 21:56:42 -04:00
Celtic Minstrel
63ecdf5781 Add [event]filter_formula= for WFL event filtering 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
11e5700848 Events are now a Lua function instead of WML
The function is specified by [event]code= and will be passed the entire contents of the [event] tag (including the code itself).

If code= is omitted, a default is supplied which runs ActionWML; however, internally it is still a function rather than a list of ActionWML commands.
2022-07-18 21:56:42 -04:00
Pentarctagon
30df6fe4ff
Remove another stderr usage. 2022-07-18 16:59:54 -05:00
doofus-01
bc94f37f76
Update changelog.md 2022-07-17 14:14:58 -07:00
doofus-01
58403574d5
ghost sprite updates (#6881)
* base image for ghost that is not part of standing anim

* nightgaunt animations
2022-07-17 14:13:28 -07:00
Pentarctagon
a24ad70c21
Update macOS minimum OS and SDL2 versions. 2022-07-17 15:26:28 -05:00
Martin Hrubý (hrubymar10)
698f93f68e
Update Xcode project for new MCS 2022-07-17 19:58:45 +02:00
Nils Kneuper
a589941ccd updated Arabic translation 2022-07-17 10:50:52 +02:00
Steve Cotton
f2ef939352 Fix whitespace 2022-07-16 18:32:03 +02:00
Pentarctagon
265d3972da
Well clearly this doesn't do anything... 2022-07-16 09:59:55 -05:00
Tommy
8238a1d8d5 Update changelog for rendering engine changes, and a few other things
I put a longer-than-usual description of rendering engine changes,
with a list of closed issues tacked on the end.

I also added items for screen_fade and a couple other things that were
resolved since 1.17.5.
2022-07-16 22:11:38 +12:00
Nils Kneuper
fbdeb679cb updated Swedish translation 2022-07-16 10:59:10 +02:00
Nils Kneuper
5ba363ca2b updated Japanese translation 2022-07-16 10:57:44 +02:00
Nils Kneuper
322dd7a345 updated Italian translation 2022-07-16 10:56:30 +02:00
Tommy
7b9474d89f Disable some floating label errors until they can be addressed
They don't seem to cause any visible problems, but still shouldn't
be happening.
2022-07-16 14:41:38 +12:00
Tommy
269f0c4f5b story_viewer: Hide the game display when shown mid-scenario
Prevents some buggy behaviour similar to #3421.
2022-07-16 12:45:10 +12:00
Descacharrado
91983c8c87 TSG S4 Fixed replay OOS on victory event 2022-07-15 11:52:36 -05:00
Tommy
8144c06389
Add new [screen_fade] WML action (#6864)
* Add new [screen_fade] WML action

It takes (for now) the arguments:
 * red, green, blue = values between 0 and 255
 * alpha = value between 0 and 255
 * duration = time in ms over which to fade

The game display is faded to the given colour over the duration.
It will be left with an overlay of that colour and alpha until
a screen_fade to 0 alpha is performed.
2022-07-15 09:32:19 -04:00
Tommy
2ad0a2f297 Prevent the game from displaying until story screen has finished
Should fix #6867 and #3421.
2022-07-16 01:24:25 +12:00
Tommy
0d8612bb4f Fix listbox order-by selection 2022-07-15 13:39:31 +12:00
Tommy
90224728c1 Fix "def" label width in default theme
Fixes #6872
2022-07-15 13:38:51 +12:00
Tommy
0c49dff30e Fix CI unit test failure 2022-07-14 20:30:20 +12:00
Tommy
29204418db Fix Load Map dialog in the editor 2022-07-14 19:16:39 +12:00
Celtic Minstrel
bd05566de0 Don't include <iostream> in every single file
We don't want std::cerr to be used at all, and std::cout is only for certain special
cases such as command-line responses.

Therefore, log.hpp should not include <iostream>.
2022-07-14 02:13:33 -04:00
Tommy
a7d1e8e03c draw: Rename set_clip to override_clip to make usage clear
Also fixed a couple incorrect usages.
2022-07-14 17:56:54 +12:00
Tommy
5c3d959ae0 help: Properly clip text area when drawing 2022-07-14 17:38:07 +12:00