mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-21 15:03:00 +00:00
parent
09ee1ae3fa
commit
9be7854297
6 changed files with 57 additions and 19 deletions
|
@ -19,6 +19,7 @@ Note to self: See the bottom of this file for the release template text.
|
|||
- Implement custom region boxing UI, which replaces the WorldEdit region box when using WorldEditAdditions wands **work in progress**
|
||||
- Add [`//spline`](https://worldeditadditions.mooncarrot.space/Reference/#spline), for drawing curved lines with an arbitrary number of points **(uses the new multi-point wand)**
|
||||
- Add [`//revolve`](https://worldeditadditions.mooncarrot.space/Reference/#revolve), which makes multiple evenly-spaced rotated copies of the defined region **(uses the new multi-point wand)**
|
||||
- [`//copy+`](https://worldeditadditions.mooncarrot.space/Reference/#copy), [`//move+`](https://worldeditadditions.mooncarrot.space/Reference/#move): Added support for integrated `airapply` mode, which replaces nodes at the target only if they are air - append `airapply`/`aa` to the command to use
|
||||
|
||||
### Bugfixes
|
||||
- Cloud wand: fix typo in item description.
|
||||
|
|
|
@ -333,7 +333,7 @@ By adding 3 extra numbers for the x, y, and z axes respectively, we can control
|
|||
So in the above example, we scale in the positive x and z directions, and the negative y direction.
|
||||
|
||||
|
||||
### `//copy+ <axis:x|y|z|-x|-y|-z|?|front|back|left|right|up|down> <count> [<axis> <count> [...]]`
|
||||
### `//copy+ <axis:x|y|z|-x|-y|-z|?|front|back|left|right|up|down> <count> [<axis> <count> [...]] [aa|airapply]`
|
||||
Fully backwards-compatible with `//copy` from regular WorldEdit, but allows you to specify multiple axes at once in a single copy operation. Each successive axis in the list is specified in the form `<axis> <count>`, where:
|
||||
|
||||
- `<axis>` is the name of the axis to move the defined region along
|
||||
|
@ -356,6 +356,8 @@ All of the following values are valid axes:
|
|||
|
||||
Additionally all the absolute axis names (`x`/`y`/`z`/`-x`/`-y`/`-z`) may also be specified multiple times under the same count - e.g. `xy-z 6`.
|
||||
|
||||
Finally, if the word `airapply` (or `aa` for short) is present at the end of the command invocation it enables the integrated airapply mode, which replaces target nodes only if they are air-like.
|
||||
|
||||
```
|
||||
//copy+ x 6
|
||||
//copy+ y 10 z 4
|
||||
|
@ -364,12 +366,17 @@ Additionally all the absolute axis names (`x`/`y`/`z`/`-x`/`-y`/`-z`) may also b
|
|||
//copy+ xz 50 front 22
|
||||
//copy+ yx 25
|
||||
//copy+ -xz-y 10
|
||||
//copy+ y 45 aa
|
||||
//copy+ -y 15 z 5 airapply
|
||||
```
|
||||
|
||||
|
||||
### `//move+ <axis:x|y|z|-x|-y|-z|?|front|back|left|right|up|down> <count> [<axis> <count> [...]]`
|
||||
### `//move+ <axis:x|y|z|-x|-y|-z|?|front|back|left|right|up|down> <count> [<axis> <count> [...]] [aa|airapply]`
|
||||
Identical to [`//copy+`](#copy), but instead moves the defined region instead of copying it.
|
||||
|
||||
Note that the integrated `airapply` (`aa` for short) also works as in [`//copy+`](#copy), but remember that if a given target node is not *not* air-like and the integrated `airapply` mode is enabled, the source node is still moved from the source, but destroyed because it is can't be set at the target.
|
||||
|
||||
|
||||
```
|
||||
//move+ x 6
|
||||
//move+ y 10 z 4
|
||||
|
@ -378,6 +385,8 @@ Identical to [`//copy+`](#copy), but instead moves the defined region instead of
|
|||
//move+ xz 50 front 22
|
||||
//move+ yx 25
|
||||
//move+ -xz-y 10
|
||||
//move+ back 20 aa
|
||||
//move+ -z 45 y 3 airapply
|
||||
```
|
||||
|
||||
|
||||
|
|
|
@ -10,7 +10,8 @@ local Vector3 = wea_c.Vector3
|
|||
-- ██ ██ ██ ██ ██
|
||||
-- ██████ ██████ ██ ██
|
||||
|
||||
function worldeditadditions.copy(source_pos1, source_pos2, target_pos1, target_pos2)
|
||||
function worldeditadditions.copy(source_pos1, source_pos2, target_pos1, target_pos2, airapply)
|
||||
if airapply == nil then airapply = false end
|
||||
source_pos1, source_pos2 = Vector3.sort(source_pos1, source_pos2)
|
||||
target_pos1, target_pos2 = Vector3.sort(target_pos1, target_pos2)
|
||||
|
||||
|
@ -35,7 +36,13 @@ function worldeditadditions.copy(source_pos1, source_pos2, target_pos1, target_p
|
|||
local target = source - offset
|
||||
local target_i = area_target:index(target.x, target.y, target.z)
|
||||
|
||||
data_target[target_i] = data_source[source_i]
|
||||
local should_replace = true
|
||||
if airapply then
|
||||
should_replace = wea_c.is_airlike(data_target[target_i])
|
||||
end
|
||||
if should_replace then
|
||||
data_target[target_i] = data_source[source_i]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,11 +10,12 @@ local Vector3 = wea_c.Vector3
|
|||
-- ██ ██ ██ ██ ██ ██ ██ ██
|
||||
-- ██ ██ ██████ ████ ███████
|
||||
|
||||
function worldeditadditions.move(source_pos1, source_pos2, target_pos1, target_pos2)
|
||||
function worldeditadditions.move(source_pos1, source_pos2, target_pos1, target_pos2, airapply)
|
||||
---
|
||||
-- 0: Preamble
|
||||
---
|
||||
|
||||
if airapply == nil then airapply = false end
|
||||
source_pos1, source_pos2 = Vector3.sort(source_pos1, source_pos2)
|
||||
target_pos1, target_pos2 = Vector3.sort(target_pos1, target_pos2)
|
||||
|
||||
|
@ -45,9 +46,13 @@ function worldeditadditions.move(source_pos1, source_pos2, target_pos1, target_p
|
|||
local target = source:subtract(offset)
|
||||
local target_i = area_target:index(target.x, target.y, target.z)
|
||||
|
||||
|
||||
data_target[target_i] = data_source[source_i]
|
||||
|
||||
local should_replace = true
|
||||
if airapply then
|
||||
should_replace = wea_c.is_airlike(data_target[target_i])
|
||||
end
|
||||
if should_replace then
|
||||
data_target[target_i] = data_source[source_i]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,6 +3,12 @@ local wea = worldeditadditions
|
|||
local Vector3 = wea_c.Vector3
|
||||
|
||||
local function parse_stage2(name, parts)
|
||||
local do_airapply = false
|
||||
if parts[#parts] == "aa" or parts[#parts] == "airapply" then
|
||||
do_airapply = true
|
||||
table.remove(parts, #parts)
|
||||
end
|
||||
|
||||
local success, vpos1, vpos2 = wea_c.parse.axes(
|
||||
parts,
|
||||
wea_c.player_dir(name)
|
||||
|
@ -17,7 +23,7 @@ local function parse_stage2(name, parts)
|
|||
return false, "Refusing to copy region a distance of 0 nodes"
|
||||
end
|
||||
|
||||
return true, offset:floor()
|
||||
return true, offset:floor(), do_airapply
|
||||
end
|
||||
|
||||
-- ██████ ██████ ██████ ██ ██
|
||||
|
@ -26,7 +32,7 @@ end
|
|||
-- ██ ██ ██ ██ ██
|
||||
-- ██████ ██████ ██ ██
|
||||
worldeditadditions_core.register_command("copy+", { -- TODO: Make this an override
|
||||
params = "<axis:x|y|z|-x|-y|-z|?|front|back|left|right|up|down> <count> [<axis> <count> [...]]",
|
||||
params = "<axis:x|y|z|-x|-y|-z|?|front|back|left|right|up|down> <count> [<axis> <count> [...]] [aa|airapply]",
|
||||
description = "Copies the defined region to another location - potentially across multiple axes at once.",
|
||||
privs = { worldedit = true },
|
||||
require_pos = 2,
|
||||
|
@ -43,7 +49,7 @@ worldeditadditions_core.register_command("copy+", { -- TODO: Make this an overri
|
|||
func = function(name, parts)
|
||||
local start_time = wea_c.get_ms_time()
|
||||
|
||||
local success_a, copy_offset = parse_stage2(name, parts)
|
||||
local success_a, copy_offset, do_airapply = parse_stage2(name, parts)
|
||||
if not success_a then return success_a, copy_offset end
|
||||
|
||||
local source_pos1 = Vector3.clone(worldedit.pos1[name])
|
||||
|
@ -54,7 +60,8 @@ worldeditadditions_core.register_command("copy+", { -- TODO: Make this an overri
|
|||
|
||||
local success_b, nodes_modified = wea.copy(
|
||||
source_pos1, source_pos2,
|
||||
target_pos1, target_pos2
|
||||
target_pos1, target_pos2,
|
||||
do_airapply
|
||||
)
|
||||
if not success_b then return success_b, nodes_modified end
|
||||
|
||||
|
|
|
@ -3,6 +3,12 @@ local wea_c = worldeditadditions_core
|
|||
local Vector3 = wea_c.Vector3
|
||||
|
||||
local function parse_stage2(name, parts)
|
||||
local do_airapply = false
|
||||
if parts[#parts] == "aa" or parts[#parts] == "airapply" then
|
||||
do_airapply = true
|
||||
table.remove(parts, #parts)
|
||||
end
|
||||
|
||||
local success, vpos1, vpos2 = wea_c.parse.axes(
|
||||
parts,
|
||||
wea_c.player_dir(name)
|
||||
|
@ -17,7 +23,7 @@ local function parse_stage2(name, parts)
|
|||
return false, "Refusing to move region a distance of 0 nodes"
|
||||
end
|
||||
|
||||
return true, offset:floor()
|
||||
return true, offset:floor(), do_airapply
|
||||
end
|
||||
|
||||
-- ███ ███ ██████ ██ ██ ███████
|
||||
|
@ -26,7 +32,7 @@ end
|
|||
-- ██ ██ ██ ██ ██ ██ ██ ██
|
||||
-- ██ ██ ██████ ████ ███████
|
||||
worldeditadditions_core.register_command("move+", { -- TODO: Make this an override
|
||||
params = "<axis:x|y|z|-x|-y|-z|?|front|back|left|right|up|down> <count> [<axis> <count> [...]]",
|
||||
params = "<axis:x|y|z|-x|-y|-z|?|front|back|left|right|up|down> <count> [<axis> <count> [...]] [aa|airapply]",
|
||||
description = "Moves the defined region to another location - potentially across multiple axes at once.",
|
||||
privs = { worldedit = true },
|
||||
require_pos = 2,
|
||||
|
@ -43,7 +49,7 @@ worldeditadditions_core.register_command("move+", { -- TODO: Make this an overri
|
|||
func = function(name, parts)
|
||||
local start_time = wea_c.get_ms_time()
|
||||
|
||||
local success_a, copy_offset = parse_stage2(name, parts)
|
||||
local success_a, copy_offset, do_airapply = parse_stage2(name, parts)
|
||||
if not success_a then return success_a, copy_offset end
|
||||
|
||||
--- 1: Calculate the source & target regions
|
||||
|
@ -58,15 +64,18 @@ worldeditadditions_core.register_command("move+", { -- TODO: Make this an overri
|
|||
-----------------------------------------------------------------------
|
||||
local success_b, nodes_modified = wea.move(
|
||||
source_pos1, source_pos2,
|
||||
target_pos1, target_pos2
|
||||
target_pos1, target_pos2,
|
||||
do_airapply
|
||||
)
|
||||
if not success_b then return success_b, nodes_modified end
|
||||
|
||||
-- 3: Update the defined region
|
||||
-----------------------------------------------------------------------
|
||||
worldedit.pos1[name] = target_pos1
|
||||
worldedit.pos2[name] = target_pos2
|
||||
worldedit.marker_update(name)
|
||||
wea_c.pos.set1(name, target_pos1)
|
||||
wea_c.pos.set2(name, target_pos2)
|
||||
-- worldedit.pos1[name] = target_pos1
|
||||
-- worldedit.pos2[name] = target_pos2
|
||||
-- worldedit.marker_update(name)
|
||||
|
||||
local time_taken = wea_c.get_ms_time() - start_time
|
||||
|
||||
|
|
Loading…
Reference in a new issue