Commit graph

95 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
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
0ca3842b40
fix busted error 2024-10-14 20:59:42 +01:00
ea1c17a6e3
safe_function: only log error when there's actually an error 2024-10-14 20:48:55 +01:00
b6c41395f6
core: tidy up new safe_function implementation; bugfix 2024-10-14 20:46:26 +01:00
00b1aed1ff
abstract new xpcall wrapper into new API function safe_function 2024-10-14 19:25:53 +01:00
938a617dc3
run_command: add prototype wrapper around command parsing. 2024-10-14 18:51:33 +01:00
cd22c710b2
start working on implementing some kind of system to catch error messages
....it works, but:
- We can't capture stack traces like this
- It's messy
- We need to implement an escape/encodeURIComponent function ourselves from scratch 'cause the one I ripped from Stack Overflow sucks
2024-10-12 01:04:27 +01:00
f3f0e8966d
run_command: prepend the name of the command in case of error. 2024-10-01 21:27:30 +01:00
5fd0c3dad3
core/pos: implement set_multi as a convenient alternative to multiple set() calls
/cc @VorTechnix & https://github.com/sbrl/Minetest-WorldEditAdditions/pull/112/files?diff=unified&w=1
2024-09-30 22:01:22 +01:00
48af3e3127
run_command: fix crashes
...oops, should have tested that last commit
2024-09-13 02:58:24 +01:00
0561e02845
pos_marker_manage: fix crash 2024-09-13 02:54:38 +01:00
8c4d503f1f
turn wea_core into an EventEmitter; emit command execution pipeline events
These are subject to feedback and change - please let me know if they are named sensibly or not!
2024-09-13 02:52:35 +01:00
f09e10ae49
document register_command 2024-09-13 02:51:36 +01:00
977dcc6a93
pos_marker_manage: add some checks to update_entity event listener
For #105 because I can't reproduce the issue.
2024-08-18 20:33:57 +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
c1fce81bc3
post_marker_wall: @module → @namespace 2023-12-31 17:08:36 +00:00
7d29453699
plug in new //rotate+ logic
...but it doesn't work yet
currently it crashes with a variety of interesting and colourful error messages
working on debugging it now, but it's gonna take a moment
2023-12-13 23:05:00 +00:00
b92cc434db
core/run_command: be more robust in case of programming errors 2023-12-13 23:04:09 +00:00
873ff4bef8
Bugfix: don't error out on //flora → //bonemeal alias if bonemeal mod isn't installed
Also add worldeditadditions_core.command_exists to check both WEA and WEW for whether a command exists or not
2023-12-13 22:15:27 +00:00
b42c8f2641
Bugfix: fix crash in pos_marker_wall/delete 2023-08-20 16:46:30 +01:00
f590304995
post_marker: comment debug logging 2023-08-19 13:49:13 +01:00
f4471dfa8e
Does this finally fix the zombie marker wall bug?
only time will tell.
2023-08-19 00:58:58 +01:00
76c02cd42f
update more comments 2023-08-03 14:37:05 +01:00
fadf4ed06c
Merge branch 'fix-markerdupes' into dev 2023-08-01 00:35:44 +01:00
125638a079
pos_marker, pos_marker_wall: default to 1 hp 2023-08-01 00:27:07 +01:00
7be2fb125e
add more debug logging 2023-08-01 00:16:36 +01:00
6231132055
pos_marker: debug logging; set health = 0 2023-08-01 00:14:43 +01:00
564785ddf6
When any segment of the marker wall is punched, unmark the entire wall
Fixes #102
2023-07-31 18:22:00 +01:00
1c90e03d3e
When any segment of the marker wall is punched, unmark the entire wall
Fixes #102
2023-07-31 18:20:06 +01:00
dacbeaf81d
comment debug logging 2023-07-18 00:42:42 +01:00
5505575cf9
Fix regions not remembering their state and being unresettable
This fix means that wwe require minetest 5.2 as a minimum rather than 5.1
ref https://rubenwardy.com/minetest_modding_book/en/quality/common_mistakes.html#be-careful-when-storing-objectrefs-ie-players-or-entities
2023-07-18 00:35:07 +01:00
5baa72cf6f
core/run_command: guard against invalid potential_changes 2023-07-11 19:12:04 +01:00
5c632df658
Override basic selection commands
//mark
//unmark
//pos1 //1
//pos2 //2
//reset
Also add //pos <index>
2023-07-10 20:17:28 +01:00
693fc145d5
pos: avoid calling worldedit.marker_update unless necessary 2023-07-10 19:25:48 +01:00
f2214150f2
Update minetest.chatcommands → minetest.registered_chatcommands 2023-07-09 19:49:38 +01:00
3bfc62be24
Make //unmark WEA-aware
Backwards compatibility with WE is maintained.
2023-07-09 19:44:31 +01:00
e916057133
safe_region: update comment
We need @value
2023-07-07 01:31:06 +01:00
8981bc4baa
weac.pos: update comments 2023-07-02 17:48:43 +01:00
61403108d6
disable a bunch of debug logging 2023-07-01 02:46:08 +01:00
92fd201b42
pos_marker_lua: add last_reset to properly clear huge regions 2023-07-01 01:11:56 +01:00
b3f7ae9d7c
pos_marker_wall: add support for customising sides displayed
...it's not exposed in the UI yet tho.
2023-06-30 02:08:46 +01:00
277da67dda
marker wall: got it! 2023-06-29 01:49:15 +01:00
a173edfbc4
wall markers: it shouldn't work, but it does
....I'll take it!
2023-06-29 01:22:50 +01:00
c622fb554f
Hook in the new marker wall system
it works!
now for the other walls.
2023-06-29 00:39:55 +01:00
f7530da608
initial pos marker wall for +x only
it's not hooked up yet.
2023-06-27 21:45:48 +01:00
61e04952e0
move pos marker textures. will this help #90? 2023-06-27 20:16:04 +01:00
141ea2f0a7
For compatibility, ensure that we also clear the legacy worldedit region too 2023-06-27 20:00:07 +01:00
53bbe14c63
update cloud wand to use new wea_c.pos interface 2023-06-27 19:39:57 +01:00