Minetest-WorldEditAdditions/worldeditadditions_commands/commands
Starbeamrainbowlabs 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
..
extra update some commands to the new notification system 2024-10-17 00:27:33 +01:00
measure migrated mtools to WEA pos system 2024-10-07 15:40:34 -07:00
meta run_command: implement support for async functions. 2024-10-17 01:54:32 +01:00
nodes Add //ndef 2024-05-25 15:10:09 +01:00
selectors Fixed CLRF Issues (I hope) 2024-10-07 16:11:35 -07:00
test refactor of test registry 2024-10-15 17:32:14 -07:00
wireframe Fix crashes in wireframe commands 2022-09-19 18:59:45 +01:00
bonemeal.lua next batch of upgraded commands 2022-09-18 21:39:48 +01:00
convolve.lua port everything else 2022-09-19 01:16:22 +01:00
copy.lua //move+, //copy+: add integrated airapply 2023-07-02 01:52:25 +01:00
count.lua Revert "//count: deliberately introduce a crash for testing purposes" 2024-10-14 20:56:20 +01:00
dome.lua finish upgrading top-level commands 2022-09-18 21:30:28 +01:00
ellipsoid2.lua finish upgrading top-level commands 2022-09-18 21:30:28 +01:00
ellipsoid.lua //ellipsoid: fix crash 2022-09-19 18:10:06 +01:00
erode.lua finish upgrading top-level commands 2022-09-18 21:30:28 +01:00
fillcaves.lua finish upgrading top-level commands 2022-09-18 21:30:28 +01:00
floodfill.lua finish upgrading top-level commands 2022-09-18 21:30:28 +01:00
forest.lua more crash fixes 2022-09-19 19:42:22 +01:00
hollow.lua //hollow: upgrade; fix nodes_needed 2022-09-18 21:05:13 +01:00
layers.lua //layers: upgrade 2022-09-18 21:05:03 +01:00
line.lua Upgrade more old vector stuff in the corners 2022-09-19 18:54:53 +01:00
maze.lua //maze3d: fix crash 2024-10-14 20:58:50 +01:00
metaball.lua update some commands to the new notification system 2024-10-17 00:27:33 +01:00
move.lua //move+, //copy+: add integrated airapply 2023-07-02 01:52:25 +01:00
noise2d.lua upgrade 7 more commands 2022-09-18 20:58:28 +01:00
orient.lua Initial //orient implementation 2024-06-04 22:49:41 +01:00
overlay.lua start working on converting everything to the new utils location 2022-09-18 17:59:57 +01:00
replacemix.lua start working on converting everything to the new utils location 2022-09-18 17:59:57 +01:00
revolve.lua Finish initial implementation of //revolve 2023-02-12 01:40:29 +00:00
rotate.lua Initial //orient implementation 2024-06-04 22:49:41 +01:00
scale.lua //scale, //subdivide, //spop: use new position api 2023-07-02 02:02:42 +01:00
sculpt.lua //sculpt: put height at the end 2023-07-01 02:38:14 +01:00
set.lua Fix some luacheck errors 2024-10-02 01:17:41 +01:00
spiral2.lua start working on converting everything to the new utils location 2022-09-18 17:59:57 +01:00
spline.lua //spline: update params description 2022-09-25 22:55:50 +01:00
torus.lua fixup 2022-09-19 17:34:53 +01:00
uasparse.lua Fixed CLRF Issues (I hope) 2024-10-07 16:11:35 -07:00
walls.lua test geometry commands 2022-09-19 18:30:43 +01:00