Commit graph

66 commits

Author SHA1 Message Date
6ea9a5acc8
//subdivide: upgrade to use new async & notify core APIs 2024-10-17 02:26:44 +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
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
e6bf2a10ee
//nodeapply: fix crash on unknown node name
oops, we normalised the node name but then passed the un-normalised node name to NodeListMatcher >_<
2023-12-15 03:11:40 +00:00
757f6de3b5
nodeapply: fix luacheck errors 2023-11-28 00:32:47 +00:00
490db59843
//nodeapply: fix @groups support 2023-11-27 23:48:30 +00:00
28ed864c84
Added //nodeapply to filter cmd changes via a nodelist 2023-11-26 22:20:05 +00:00
aec204de8e
add //listentities 2023-08-01 00:07:10 +01:00
f2214150f2
Update minetest.chatcommands → minetest.registered_chatcommands 2023-07-09 19:49:38 +01:00
3194a2c53e
finish updating comments
@module is now banished to the history booked!

Phew, I'm pooped.
2023-07-07 01:25:42 +01:00
9b4a777a67
//scale, //subdivide, //spop: use new position api 2023-07-02 02:02:42 +01:00
7cb1160e65
//multi: fix luacheck error 2023-05-24 22:00:16 +01:00
VorTechnix
b88cec64d4 Fix bad logic in parts check 2023-05-24 13:03:41 -07:00
d9877b8c6c
more crash fixes 2022-09-19 19:42:22 +01:00
6102a1adf5
Upgrade meta commands 2022-09-18 22:37:26 +01:00
2b88fa867e
fix more warnings 2022-09-18 16:33:37 +01:00
8de49ac0af
register commands with worldeditadditions, not worldedit 2022-05-19 22:10:09 +01:00
b816133716
core: implement fetch_command_def
This rovides an abstraction to fetch a worldedit command's definition, 
regardless of where it was registered.

We would normally expect all commands to be registered in 
wea_c.registered_commands, but before we only do a one-off pass to 
import commands from worldedit should a new mod we aren't aware of 
register a command with worldedit and get loaded after us, we won't 
detect it - hencee  the need for this function.
2022-05-19 02:31:01 +01:00
VorTechnix
bc0658b545 Update init.lua 2021-09-05 09:35:07 -07:00
VorTechnix
a5960983e7 Merge branch 'main' into VorTechnix 2021-09-05 09:34:54 -07:00
2920f7081d
Add //noiseapply 2021-08-07 23:01:15 +01:00
6cd367915d
//airapply: fix rogue args_parsed 2021-08-07 22:37:45 +01:00
fcd4de3429
//airapply: fix nodes_needed 2021-08-07 22:35:32 +01:00
10a649e597
//airapply: error handling 2021-08-07 21:16:17 +01:00
VorTechnix
b20c8f9af1 Merge branch 'main' into VorTechnix 2021-08-01 07:03:31 -07:00
655d9ebac9
//many, //multi, parse_reference: various luacheck fixes 2021-07-30 20:07:08 +01:00
c14bb40f7e
//ellipsoidapply: undefined variable fixes 2021-07-30 20:03:31 +01:00
23e08c5693
//multi: luacheck fix 2021-07-30 20:03:16 +01:00
1c8d572bb8
//airapply: fix undefined variables 2021-07-30 20:01:38 +01:00
f7cda8c817
//subdivide: Fix referencing undefined global variable 2021-07-30 18:06:44 +01:00
VorTechnix
b795f3b169 dissabled macros -- too buggy 2021-07-29 15:49:37 -07:00
VorTechnix
5757ef892d added //macro 2021-07-28 18:13:15 -07:00
VorTechnix
0ecd6233ad Update for.lua 2021-07-28 18:06:26 -07:00
VorTechnix
43a59b68ff converted //for to step function 2021-07-28 13:35:52 -07:00
VorTechnix
1436974e9b added //for 2021-07-27 19:56:45 -07:00
VorTechnix
7f9c8796d0 meta link fix 2021-07-18 17:27:21 -07:00
VorTechnix
d94ebd7e54 separate init for meta commands 2021-07-18 13:12:45 -07:00
8b4ba8ccc1
airapply, ellipsoidapply: allow //multi to be a subcommand 2021-07-16 23:00:31 +01:00
57caddece7
airapply: fix header 2021-07-15 21:39:25 +01:00
0b379c48cb
Implement //airapply
For #56, but the docs aren't written yet so we'll wait on closing it 
until I've written them.
2021-07-15 02:17:14 +01:00
0b0595a1d3
Remove a whole bunch of stray debug print statements 2021-07-04 14:35:02 +01:00
db7b20d485
Refactor table functions into subtable of wea
Also, you can return a value from dofile()!!!!

This changes everything.
2021-06-28 00:56:29 +01:00
ffdef17761
//multi: add { curly brace } syntax support for grouping blocks of commands 2021-05-29 01:17:24 +01:00
e111decd3a
//multi: reduce code duplication 2021-05-28 21:10:23 +01:00
8877e356f0
refactor: refactor utils/strings.lua into multiple files 2021-03-20 01:48:56 +00:00
48619163d5
//multi: gracefully handle empty invocations; ensure args is always set
if it isn't found via the :find() call, then set it to an empty string.
This prevents crashes where the callee expects to be passed a string
2021-03-11 02:04:22 +00:00
ee3effd458
//subdivide: fix passing arguments to the command being executed 2021-02-21 15:19:21 +00:00
bl-ue
1d3c2a0416 Fix typos 2021-02-09 19:53:30 -05:00
555058b4ac
//subdivide: tweak update message display 2021-02-07 03:12:09 +00:00
1179ecb19a
//subdivide: cosmetic change to update messages 2021-02-07 02:59:41 +00:00