added UAS Parse

This commit is contained in:
VorTechnix 2024-09-18 21:00:51 -07:00
parent ea25e36f3c
commit 90f2fcb2ab
No known key found for this signature in database
GPG key ID: 091E91A69545D5BA
4 changed files with 43 additions and 2 deletions

View file

@ -19,6 +19,7 @@ Note to self: See the bottom of this file for the release template text.
- Added `//sgrow` and `//sshrink` commands to enlarge and shrink selection regions and aliased them over WorldEdit equivalents (`//expand`, `//outset` and `//contract`, `//inset` respectively).
- Added Unified Axis Syntax (UAS) parser. - Implementation by @VorTechnix
- See [UAS System reference] for details. (Note to self hook up hyperlink)
- Added `//uasparse` command to show the vectors produced by a given UAS expression. - Implementation by @VorTechnix
### Bugfixes and changes
- Don't warn on failed registration of `//flora` → [`//bonemeal`](https://worldeditadditions.mooncarrot.space/Reference/#bonemeal) if the `bonemeal` mod isn't installed (e.g. in MineClone2) - thanks @VorTechnix in #106

View file

@ -1118,6 +1118,16 @@ This command is intended for debugging and development purposes, but if you're i
//ndef glass
```
### `//uasparse <unified axis syntax>`
Short for *Unified Axis Syntax Parse*. Parses the given UAS expression and prints the resulting vectors to the chat window.
```weacmd
//uasparse front right 5
//uasparse y 12 h -2
//uasparse left 3 up 5 -front 7
//uasparse -z 12 -y -2 x -2
```
## Selection

View file

@ -73,6 +73,7 @@ The detailed explanations have moved! Check them out [here](https://worldeditadd
- [`//count`](https://worldeditadditions.mooncarrot.space/Reference/#count)
- [`//basename <name>`](https://worldeditadditions.mooncarrot.space/Reference/#basename)
- [`//ngroups <node_name> [v[erbose]]`](https://worldeditadditions.mooncarrot.space/Reference/#ngroups)
- [`//uasparse <unified axis syntax>`](https://worldeditadditions.mooncarrot.space/Reference/#uasparse) _(new in v1.15)_
### Selection
- [~~`//scol`~~ DEPRECATED](https://worldeditadditions.mooncarrot.space/Reference/#scol)
@ -80,10 +81,10 @@ The detailed explanations have moved! Check them out [here](https://worldeditadd
- [~~`//scube`~~ DEPRECATED](https://worldeditadditions.mooncarrot.space/Reference/#scube)
- [`//scloud <0-6|stop|reset>`](https://worldeditadditions.mooncarrot.space/Reference/#scloud)
- [`//scentre`](https://worldeditadditions.mooncarrot.space/Reference/#scentre)
- [`//sgrow <unified axis syntax>`](https://worldeditadditions.mooncarrot.space/Reference/#sgrow)
- [`//sgrow <unified axis syntax>`](https://worldeditadditions.mooncarrot.space/Reference/#sgrow) _(new in v1.15)_
- [`//srel <unified axis syntax>`](https://worldeditadditions.mooncarrot.space/Reference/#srel)
- [`//smake <operation:odd|even|equal> <mode:grow|shrink|average> [<target=xz> [<base>]]`](https://worldeditadditions.mooncarrot.space/Reference/#smake)
- [`//sshrink <unified axis syntax>`](https://worldeditadditions.mooncarrot.space/Reference/#sshrink)
- [`//sshrink <unified axis syntax>`](https://worldeditadditions.mooncarrot.space/Reference/#sshrink) _(new in v1.15)_
- [`//sstack`](https://worldeditadditions.mooncarrot.space/Reference/#sstack)
- [`//spush`](https://worldeditadditions.mooncarrot.space/Reference/#spush)
- [`//spop`](https://worldeditadditions.mooncarrot.space/Reference/#spop)

View file

@ -0,0 +1,29 @@
local wea_c = worldeditadditions_core
-- local Vector3 = wea_c.Vector3
-- ██ ██ █████ ███████ ██████ █████ ██████ ███████ ███████
-- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
-- ██ ██ ███████ ███████ ██████ ███████ ██████ ███████ █████
-- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
-- ██████ ██ ██ ███████ ██ ██ ██ ██ ██ ███████ ███████
worldeditadditions_core.register_command("uasparse", {
params = "<unified axis syntax>",
description = "Returns min and max vectors for given inputs",
privs = { worldedit = true },
-- require_pos = 2,
parse = function(params_text)
local ret = wea_c.split(params_text)
if #ret < 1 then return false, "UASPARSE: No params found!"
else return true, ret end
end,
func = function(name, params_text)
local facing = wea_c.player_dir(name)
local min, max = wea_c.parse.directions(params_text, facing)
if not min then
return false, max
else
return true, "Min: "..min.." Max: "..max
end
end
})