Commit graph

394 commits

Author SHA1 Message Date
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
VorTechnix
112364e767
refactor of test registry 2024-10-15 17:32:14 -07:00
57d09a766b
Merge branch 'feature/pcall-protection' into dev 2024-10-15 20:15:17 +01:00
VorTechnix
2f1332739e
added notify_bad test 2024-10-14 19:14:18 -07:00
45711764da
//maze3d: fix crash 2024-10-14 20:58:50 +01:00
e0ba5d9810
Revert "//count: deliberately introduce a crash for testing purposes"
This reverts commit 39b3ef428d.
2024-10-14 20:56:20 +01:00
4bd278d6b9
//maze, //maze3d: update to WEA pos API
Ref https://worldeditadditions.mooncarrot.space/api/#worldeditadditions_core.pos
2024-10-14 20:50:31 +01:00
VorTechnix
a9a7a5a9f1
Fixed some problems 2024-10-13 15:01:53 -07:00
VorTechnix
cd8a034333
more tests 2024-10-13 14:23:34 -07:00
VorTechnix
c218242190
added //test 2024-10-13 13:54:02 -07:00
39b3ef428d
//count: deliberately introduce a crash for testing purposes
YOU DO NOT WANT THIS COMMIT!
TODO REVERT THIS COMMIT VIA REBASE WHEN DONE.
2024-10-12 01:05:38 +01:00
VorTechnix
269a73be48
Fixed CLRF Issues (I hope) 2024-10-07 16:11:35 -07:00
VorTechnix
29bac504b0
migrated mtools to WEA pos system 2024-10-07 15:40:34 -07:00
VorTechnix
9495dd7992
fixed aliases 2024-10-04 13:02:47 -07:00
d74427e017
Fix some luacheck errors
the others are because rotate.lua isn't finished
Unfortunately I don't have the time to fix it now, because it will require a lot of time
2024-10-02 01:17:41 +01:00
VorTechnix
e811090527
Position statements for command returns 2024-10-01 08:03:21 -07:00
VorTechnix
f4b3b09b26
Update init.lua Removed TODO 2024-10-01 07:58:08 -07:00
VorTechnix
df2af2df7d
Description Tweak for removed commands
Co-authored-by: Starbeamrainbowlabs <sbrl@starbeamrainbowlabs.com>
2024-10-01 07:48:32 -07:00
VorTechnix
a48576a7ab
Better errors?
Co-authored-by: Starbeamrainbowlabs <sbrl@starbeamrainbowlabs.com>
2024-10-01 06:53:32 -07:00
VorTechnix
f399d475cc
UASPARSE touchups
Co-authored-by: Starbeamrainbowlabs <sbrl@starbeamrainbowlabs.com>
2024-10-01 06:51:38 -07:00
VorTechnix
d6c452a221
hooked up UAS Parse 2024-09-18 21:01:46 -07:00
VorTechnix
d635bec9f3
params fix 2024-09-18 21:01:30 -07:00
VorTechnix
90f2fcb2ab
added UAS Parse 2024-09-18 21:00:51 -07:00
VorTechnix
aaa976c286
aliasing 2024-09-17 12:31:13 -07:00
VorTechnix
1a18d4c8d0
params modification for UAK 2024-09-17 12:31:02 -07:00
VorTechnix
a31e34f420
sfactor deprecation 2024-09-17 12:30:21 -07:00
VorTechnix
4c4fab189e
Update smake.lua 2024-09-15 17:04:57 -07:00
VorTechnix
38b55712cc
scentre, sshift stable + housekeeping 2024-09-15 09:15:22 -07:00
VorTechnix
d1c4f9bd19
finish deprecation 2024-09-13 10:47:42 -07:00
VorTechnix
f51ed36f9e
some optimization 2024-09-12 18:30:21 -07:00
VorTechnix
981bdc2b76
tested: stable enough 2024-09-12 17:45:19 -07:00
VorTechnix
23aae6959f
stabilizing fixes 2024-09-12 17:30:42 -07:00
VorTechnix
4ff01bba4e
new commands registered 2024-09-12 15:09:04 -07:00
VorTechnix
4dacd10597
sgrow, srel, sshrink UNSTABLE 2024-09-12 15:05:57 -07:00
VorTechnix
005615df02
spaces in aliases don't work 2024-09-12 09:09:07 -07:00
VorTechnix
8247a595b1
re-aliasing 2024-09-12 08:04:21 -07:00
VorTechnix
4ab8e7ca2c
Deprecate scol, scube & srect 2024-09-12 06:54:46 -07:00
02d95cec46
Initial //orient implementation
....unfortunately, it doesn't work yet.
Next up is a frankly ridiculous number of print()s to figure out what's going on here
2024-06-04 22:49:41 +01:00
c712b502e9
//rotate+: typo in description 2024-06-04 22:43:09 +01:00
34e8f53de6
//set+: remove debug logging 2024-05-25 15:25:29 +01:00
4728dad02a
Add //ndef 2024-05-25 15:10:09 +01:00
170ec01bed
Alias //napply to //nodeapply 2024-05-25 14:48:38 +01:00
ffdd1b65b3
Implement //set+
This is on the road to //orient and later stair/etc support in //rotate :D
2024-05-25 14:45:56 +01:00
2f98b86c5f
movetool, //speed: add optdepend on pova
pova is a physics_override manager mod, so it's important we have support for it to ensure we play nice with other mods
Ref https://content.minetest.net/packages/TenPlus1/pova/
2023-12-30 13:12:10 +00:00
0a9c125316
Implement //speed 2023-12-26 13:37:19 +00:00
b56bd0d84b
//rotate: fix some minor keyword issues, update reference & changelog
At some point we need to move the parser to allow for a `player` reference for relative keywords.... or else pass them through somehow
2023-12-16 01:11:25 +00:00
54c66e0dc9
//rotate: fix bug in which regions are accidentally cut off 2023-12-16 00:35:52 +00:00
0ac76bc694
//rotate: update pos1/pos2 to bound target region
...unfortunately this has exposed a nasty bug!
2023-12-16 00:01:34 +00: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