mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-12-03 20:43:50 +01:00
//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
This commit is contained in:
parent
dc39dbff08
commit
b56bd0d84b
@ -10,6 +10,7 @@ Note to self: See the bottom of this file for the release template text.
|
||||
- This is not a hotfix to avoid endless small releases fixing the bug, as it's clear it's much more difficult to fix on all systems than initially expected
|
||||
- Added [`//nodeapply`](https://worldeditadditions.mooncarrot.space/Reference/#nodeapply), a generalisation of [`//airapply`](https://worldeditadditions.mooncarrot.space/Reference/#airapply) that works with a defined list of nodes. Check out [the reference](https://worldeditadditions.mooncarrot.space/Reference/#nodeapply) - it has some cool tricks to it! (thanks for suggesting, @kliv91 from the Discord server!)
|
||||
- Added [`//ngroups`](https://worldeditadditions.mooncarrot.space/Reference/#ngroups), which lists the groups that a given node is a member of. Useful when paired with [`//nodeapply`](https://worldeditadditions.mooncarrot.space/Reference/#nodeapply)!
|
||||
- Added [`//rotate+`](https://worldeditadditions.mooncarrot.space/Reference/#rotate) rotate regions through arbitrary series of potentially non-axis-aligned rotations.
|
||||
|
||||
### 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
|
||||
|
@ -284,6 +284,50 @@ For those interested, WorldEditAdditions uses the [chaikin curve algorithm](http
|
||||
-->
|
||||
|
||||
|
||||
### `//rotate+ <axis> <degrees> [<axis> <degrees> ...] [origin|o [<pos_number>]]`
|
||||
Rotates the defined region using the specified list of rotation operations, optionally around the defined rotation origin. For example, the following:
|
||||
|
||||
```weacmd
|
||||
//rotate+ y 45
|
||||
```
|
||||
|
||||
...will rotate the defined region around it's centre by 45° on the Y (vertical) axis.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> There is a known issue in which holes appear in previously flat surfaces when rotating through non-axis-aligned rotations. The cause for this is currently unclear.
|
||||
>
|
||||
> If you can shed any light on this issue or make any suggestions, please get in touch.
|
||||
|
||||
We can also extend this to rotate on multiple axes:
|
||||
|
||||
```weacmd
|
||||
//rotate+ z 90 y 45
|
||||
```
|
||||
|
||||
The rotations will be processed in order as specified from left to right. The following relative keywords are currently supported in place of an absolute axis name:
|
||||
|
||||
Keyword | Meaning
|
||||
------------|--------------------
|
||||
`right` | Rotates around the Y axis to the right - aka clockwise.
|
||||
`left` | Rotates around the Y axis to the left - aka anticlockwise.
|
||||
|
||||
A custom rotation origin can be specified too. This is done via the `origin` keyword and takes the form of specifying a position to rotate around instead of the default (picking the centre point between pos1 and pos2). For example:
|
||||
|
||||
```weacmd
|
||||
//rotate+ x 20 origin 3
|
||||
```
|
||||
|
||||
....will rotate 20° on the X axis around position 3. See the [multi-point wand](#multipoint) for more information on setting positions other than pos1 and pos2.
|
||||
|
||||
The `origin` keyword's argument is optional, and if no position number is specified defaults to position 3.
|
||||
|
||||
```weacmd
|
||||
//rotate+ y 90 x 45 origin
|
||||
//rotate+ y 90 x 45 o
|
||||
//rotate+ x 60 origin 5 z 20
|
||||
```
|
||||
|
||||
|
||||
### `//floodfill [<replace_node> [<radius>]]`
|
||||
Floods all connected nodes of the same type starting at _pos1_ with `<replace_node>` (which defaults to `water_source`), in a sphere with a radius of `<radius>` (which defaults to 50).
|
||||
|
||||
@ -1518,7 +1562,7 @@ It has the range of the _Far Wand_ mentioned above too, so you can select nodes
|
||||
Note that punching out the positions **does not unset them**. Use `//reset` to reset the defined region.
|
||||
|
||||
|
||||
### Multi-Point Wand
|
||||
### MultiPoint Wand
|
||||
The third type of wand provided by WorldEditAdditions is completely different, in that it allows you to select up to **999 points** at once! It looks like this: ![A picture of the multi-point wand](https://raw.githubusercontent.com/sbrl/Minetest-WorldEditAdditions/main/worldeditadditions_farwand/textures/worldeditadditions_multiwand.png)
|
||||
|
||||
It is important to note that (at present) the points selected by this wand **are not compatible with normal points**. This will change in the future, but requires a lot of work to implement.
|
||||
|
@ -47,6 +47,7 @@ worldeditadditions_core.register_command("rotate+", {
|
||||
mode = mode_store
|
||||
mode_store = nil
|
||||
elseif mode == "AXIS" then
|
||||
-- TODO: Somehow move this parsing ----> main func to get player reference to allow for relative stuff
|
||||
success, axis_next = wea_c.parse.axes_rotation.axis_name(part)
|
||||
if not success then return success, axis_next end
|
||||
mode = "ANGLE"
|
||||
|
@ -43,9 +43,11 @@ local function parse_rotation_axis_name(str, player)
|
||||
if str:find("x", 1, true) then vector.x = 1
|
||||
elseif str:find("y", 1, true) then vector.y = 1
|
||||
elseif str:find("z", 1, true) then vector.z = 1
|
||||
elseif str:find("left", 1, true) then vector.z = -1
|
||||
elseif str:find("left", 1, true)
|
||||
or str:find("l$") then vector.y = -1
|
||||
elseif str:find("right", 1, true)
|
||||
or str:find("yaw") then vector.z = 1
|
||||
or str:find("r$")
|
||||
or str:find("yaw") then vector.y = 1
|
||||
elseif type(player) ~= "nil" then
|
||||
local player_rotation_h = calc_rotation_text(player:get_look_horizontal())
|
||||
|
||||
@ -53,12 +55,12 @@ local function parse_rotation_axis_name(str, player)
|
||||
|
||||
if str:find("front", 1, true)
|
||||
or str:find("f$")
|
||||
or str:find("pitch") then
|
||||
or str:find("pitch", 1, true) then
|
||||
vector = rot_axis_left(player_rotation_h)
|
||||
elseif str:find("back", 1, true)
|
||||
or str:find("b$") then
|
||||
vector = rot_axis_left(player_rotation_h) * -1
|
||||
elseif str:find("roll") then
|
||||
elseif str:find("roll", 1, true) then
|
||||
vector = player_rotation_h
|
||||
else
|
||||
return false, "Error: Could not understand rotational axis keyword '"..str.."'."
|
||||
|
Loading…
Reference in New Issue
Block a user