Commit graph

1516 commits

Author SHA1 Message Date
VorTechnix
9f85a7ca0d
Update init.lua 2024-10-23 16:12:19 -07:00
VorTechnix
cbfd695d72
created wea_core.path 2024-10-23 16:11:43 -07:00
VorTechnix
97e8bd1361
added format.file_path 2024-10-23 15:19:25 -07:00
VorTechnix
8f54522e20
Create file_path.lua 2024-10-23 15:18:35 -07:00
VorTechnix
449f12d5d7
//reset refactor 2024-10-22 22:00:53 -07:00
VorTechnix
ec32f944ed
small refactor 2024-10-22 06:46:23 -07:00
VorTechnix
a7f98e07e1
Update .gitignore 2024-10-21 09:45:05 -07:00
e8ad24e8bd
run_command: formatting 2024-10-18 21:15:06 +01:00
VorTechnix
698ca09336
implement options.override 2024-10-18 11:49:58 -07:00
VorTechnix
1de0402a02
no more need for craft want setting 2024-10-18 10:38:55 -07:00
VorTechnix
98b3e9d391
fixed test dir path 2024-10-17 21:16:02 -07:00
VorTechnix
2354e51ba6
moved handle_fn_result 2024-10-17 17:01:39 -07:00
3d205fadb7
Merge branch 'dev' of github.com:sbrl/Minetest-WorldEditAdditions into dev 2024-10-17 23:44:57 +01:00
3d1c1b8674
run_command: accept 1 (bool) return value from main func() 2024-10-17 23:44:31 +01:00
VorTechnix
f6b072237b
tweak to test handling 2024-10-17 11:12:53 -07:00
VorTechnix
67e1e957d4
tidy up init.lua 2024-10-17 09:11:04 -07:00
VorTechnix
8ef1d348d2
added anti-nil safety measure 2024-10-17 09:06:10 -07:00
VorTechnix
9efaecc13a
first usage of handle_fn_result 2024-10-17 09:02:49 -07:00
VorTechnix
0915a83151
notify suppression test 2024-10-17 08:51:18 -07:00
VorTechnix
0076010f35
WE compatibility for Notify 2024-10-17 08:50:57 -07:00
VorTechnix
ae5d18248f
sorted init and added handle_fn_result 2024-10-17 08:49:14 -07:00
VorTechnix
0ffdb47b54
more doc refixes 2024-10-16 19:57:55 -07:00
VorTechnix
63bdbdfac9
switched to unpack method 2024-10-16 19:53:10 -07:00
VorTechnix
c86319d94e
wea_c.notify main changeover 2024-10-16 19:22:34 -07:00
VorTechnix
644510a9ca
documentation redo... again 2024-10-16 19:22:09 -07:00
VorTechnix
440dae68a1
Notify.suppress_for_function now actually returns results! 2024-10-16 19:13:22 -07:00
5331b32159
register_command: add since 1.15 for async support 2024-10-17 03:11:46 +01:00
bed5ec3add
Merge branch 'dev' of github.com:sbrl/Minetest-WorldEditAdditions into dev 2024-10-17 02:40:31 +01:00
74377c7285
safe_function: update docs, add todo ref implementing wea_core.safe_after() 2024-10-17 02:40:07 +01:00
VorTechnix
a5affb1ea7
unbreak worldedit.player_notify 2024-10-16 18:34:31 -07:00
6ea9a5acc8
//subdivide: upgrade to use new async & notify core APIs 2024-10-17 02:26:44 +01:00
6ef17fed27
core/notify: fix crash in suppression system
`local globalstate` is initialised to have the field `suppressed_players`, but the non-existent field `suppress` is requested, resulting in operations on nil rather than the expected table. This causes the aforementioned crash.

This commit fixes this issue.
2024-10-17 02:25:31 +01:00
8a2c26d395
Merge branch 'dev' of github.com:sbrl/Minetest-WorldEditAdditions into dev 2024-10-17 02:01:10 +01:00
52c30a8dd1
safe_function: fix docblock docs 2024-10-17 02:01:04 +01:00
1ae48f3a52
run_command: implement support for async functions.
Also update //for to make use of this new functionality.

//subdivide is still on the todo list.

The new functionality works by adding the new property `async = false` to command definition tables registered via wea_core.register_command()`. When `true`, if and only if the command's MAIN FUNC ONLY returns no values at all then it will consider an async operation to be in progress.

This delays `run_command` from emitting the `post-execute` event on `wea_core`.

Additionally, all async commands have a callback function injected as the first argument to their main `func` (ref main cmd definition table). This callback function -- if no arguments are returned by the main `func` -- must be called once the async operation is complete with same args you would normally return from `func` -- that is `success, result_message`. These will then be handled as normal and sent to the player as appropriate, as well as finally emitting the `post-execute` event.

BUG: There is a potential issue in this implementation, in that if i.e. `minetest.after()` is used to delay async execution then this will break out of the `xpcall()` protection in place to prevent crashes. To this end, if you implement an async function you need to be very careful, and do a manual `wea_core.safe_function()` call yourself!
2024-10-17 01:54:32 +01:00
VorTechnix
6ecbeccd54
doc update 2024-10-16 17:04:37 -07:00
a06136812f
split_shell: use @example 2024-10-17 00:34:42 +01:00
1677c68a7b
update some commands to the new notification system
....there's a bug in run_command tho with respect to return value handling
2024-10-17 00:27:33 +01:00
36a6bf6b49
weac.notify: fix __call
When you do weac.notify(player_name, "info", "msg"), Lua auto-inserts a `self` table which refers to the main `Notify` table there.

This is because `local function call()` is registered via `setmetatable(Notify, ...)`, which auto-inserts `self` as the 1st argument.

To this end, this command adds a dummy 1st argument `_self` to capture this extra table to avoid all args being shifted by 1.
2024-10-17 00:21:42 +01:00
547cdb943a
CHANGELOG: note addition of new notification system 2024-10-16 23:52:06 +01:00
a45c119945
run_command: update result_message handling from execution to be more exhaustive 2024-10-16 23:49:40 +01:00
VorTechnix
ecafb69486
switched run_command to wea core notify 2024-10-16 15:15:47 -07:00
c352446226
Merge branch 'dev' of github.com:sbrl/Minetest-WorldEditAdditions into dev 2024-10-16 20:19:11 +01:00
bfc22ae6dd
website: fix missing target_dir error 2024-10-16 20:18:51 +01:00
VorTechnix
41577de416
doc updates 2024-10-16 12:04:20 -07:00
VorTechnix
112364e767
refactor of test registry 2024-10-15 17:32:14 -07:00
VorTechnix
66dcd6bbd7
added suppression 2024-10-15 17:31:40 -07:00
565dc81994
website: update moondoc, fix Lua API docs sitename 2024-10-16 01:22:01 +01:00
fbb3d5096c
tokenise_commands: use @example 2024-10-16 01:00:01 +01:00
9101d32bd5
website: update dependencies 2024-10-15 22:37:29 +01:00