mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-25 08:33:00 +00:00
Fix directionality in worldedit region update when scaling down
This commit is contained in:
parent
b2b3f5bec5
commit
4368f74e30
3 changed files with 14 additions and 1 deletions
|
@ -38,6 +38,7 @@ The detailed explanations have moved! Check them out [here](https://github.com/s
|
||||||
### Misc
|
### Misc
|
||||||
- [`//replacemix <target_node> [<chance>] <replace_node_a> [<chance_a>] [<replace_node_b> [<chance_b>]] [<replace_node_N> [<chance_N>]] ....`](https://github.com/sbrl/Minetest-WorldEditAdditions/blob/master/Chat-Command-Reference.md#replacemix-target_node-chance-replace_node_a-chance_a-replace_node_b-chance_b-replace_node_n-chance_n-)
|
- [`//replacemix <target_node> [<chance>] <replace_node_a> [<chance_a>] [<replace_node_b> [<chance_b>]] [<replace_node_N> [<chance_N>]] ....`](https://github.com/sbrl/Minetest-WorldEditAdditions/blob/master/Chat-Command-Reference.md#replacemix-target_node-chance-replace_node_a-chance_a-replace_node_b-chance_b-replace_node_n-chance_n-)
|
||||||
- [`//floodfill [<replace_node> [<radius>]]`](https://github.com/sbrl/Minetest-WorldEditAdditions/blob/master/Chat-Command-Reference.md#floodfill-replace_node-radius-floodfill)
|
- [`//floodfill [<replace_node> [<radius>]]`](https://github.com/sbrl/Minetest-WorldEditAdditions/blob/master/Chat-Command-Reference.md#floodfill-replace_node-radius-floodfill)
|
||||||
|
- [`//scale <axis> <scale_factor> | <factor_x> [<factor_y> <factor_z> [<anchor_x> <anchor_y> <anchor_z>]]`]()
|
||||||
|
|
||||||
### Terrain
|
### Terrain
|
||||||
- [`//overlay <node_name_a> [<chance_a>] <node_name_b> [<chance_b>] [<node_name_N> [<chance_N>]] ...`](https://github.com/sbrl/Minetest-WorldEditAdditions/blob/master/Chat-Command-Reference.md#overlay-node_name_a-chance_a-node_name_b-chance_b-node_name_n-chance_n-)
|
- [`//overlay <node_name_a> [<chance_a>] <node_name_b> [<chance_b>] [<node_name_N> [<chance_N>]] ...`](https://github.com/sbrl/Minetest-WorldEditAdditions/blob/master/Chat-Command-Reference.md#overlay-node_name_a-chance_a-node_name_b-chance_b-node_name_n-chance_n-)
|
||||||
|
|
|
@ -49,6 +49,8 @@ function worldeditadditions.scale(pos1, pos2, scale, anchor)
|
||||||
pos2 = stats.pos2
|
pos2 = stats.pos2
|
||||||
end
|
end
|
||||||
|
|
||||||
|
pos1, pos2 = worldedit.sort_pos(pos1, pos2)
|
||||||
|
|
||||||
stats_total.pos1 = pos1
|
stats_total.pos1 = pos1
|
||||||
stats_total.pos2 = pos2
|
stats_total.pos2 = pos2
|
||||||
|
|
||||||
|
|
|
@ -43,8 +43,18 @@ function worldeditadditions.scale_down(pos1, pos2, scale, anchor)
|
||||||
|
|
||||||
local node_id_air = minetest.get_content_id("air")
|
local node_id_air = minetest.get_content_id("air")
|
||||||
|
|
||||||
|
local pos1_small = vector.new(pos1)
|
||||||
|
local pos2_small = vector.new(pos2)
|
||||||
|
|
||||||
local stats = { updated = 0, scale = scale_down, pos1 = pos1, pos2 = vector.add(pos1, size_small) }
|
if anchor.x < 1 then pos1_small.x = pos2_small.x - size_small.x
|
||||||
|
else pos2_small.x = pos1_small.x + size_small.x end
|
||||||
|
if anchor.y < 1 then pos1_small.y = pos2_small.y - size_small.y
|
||||||
|
else pos2_small.y = pos1_small.y + size_small.y end
|
||||||
|
if anchor.z < 1 then pos1_small.z = pos2_small.z - size_small.z
|
||||||
|
else pos2_small.z = pos1_small.z + size_small.z end
|
||||||
|
|
||||||
|
|
||||||
|
local stats = { updated = 0, scale = scale_down, pos1 = pos1_small, pos2 = pos2_small }
|
||||||
-- Zero out the area we're scaling down into
|
-- Zero out the area we're scaling down into
|
||||||
for i in area:iterp(pos1, pos2) do
|
for i in area:iterp(pos1, pos2) do
|
||||||
data_copy[i] = node_id_air
|
data_copy[i] = node_id_air
|
||||||
|
|
Loading…
Reference in a new issue