mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-26 09:03:01 +00:00
parent
81f3a87180
commit
f9eb67b4cc
2 changed files with 13 additions and 19 deletions
|
@ -10,6 +10,7 @@ Note to self: See the bottom of this file for the release template text.
|
||||||
- Add `//srect` (_select rectangle_), `//scol` (_select column_), `//scube` (_select cube_) - thanks, @VorTechnix!
|
- Add `//srect` (_select rectangle_), `//scol` (_select column_), `//scube` (_select cube_) - thanks, @VorTechnix!
|
||||||
- Add `//scloud` (_select point cloud_), `//scentre` (_select centre node(s)_), `//srel` (_select relative_) - thanks, @VorTechnix!
|
- Add `//scloud` (_select point cloud_), `//scentre` (_select centre node(s)_), `//srel` (_select relative_) - thanks, @VorTechnix!
|
||||||
- Significantly refactored backend utility functions (more to come in future updates)
|
- Significantly refactored backend utility functions (more to come in future updates)
|
||||||
|
- `//bonemeal`: Try bonemealing everything that isn't an air block (#49)
|
||||||
|
|
||||||
|
|
||||||
## v1.11: The big data update (25th January 2021)
|
## v1.11: The big data update (25th January 2021)
|
||||||
|
|
|
@ -25,27 +25,20 @@ function worldeditadditions.bonemeal(pos1, pos2, strength, chance)
|
||||||
local candidates = 0
|
local candidates = 0
|
||||||
for z = pos2.z, pos1.z, -1 do
|
for z = pos2.z, pos1.z, -1 do
|
||||||
for x = pos2.x, pos1.x, -1 do
|
for x = pos2.x, pos1.x, -1 do
|
||||||
local found_air = false
|
|
||||||
|
|
||||||
for y = pos2.y, pos1.y, -1 do
|
for y = pos2.y, pos1.y, -1 do
|
||||||
if data[area:index(x, y, z)] ~= node_id_air then
|
if not worldeditadditions.is_airlike(data[area:index(x, y, z)]) then
|
||||||
if found_air then
|
-- It's not an air node, so let's try to bonemeal it
|
||||||
-- We've found an air block previously, so this node definitely has air above it
|
|
||||||
|
|
||||||
if math.random(0, chance - 1) == 0 then
|
if math.random(0, chance - 1) == 0 then
|
||||||
bonemeal:on_use(
|
bonemeal:on_use(
|
||||||
{ x = x, y = y, z = z },
|
{ x = x, y = y, z = z },
|
||||||
strength,
|
strength,
|
||||||
nil
|
nil
|
||||||
)
|
)
|
||||||
nodes_bonemealed = nodes_bonemealed + 1
|
nodes_bonemealed = nodes_bonemealed + 1
|
||||||
end
|
|
||||||
|
|
||||||
candidates = candidates + 1
|
|
||||||
found_air = false
|
|
||||||
end
|
end
|
||||||
else
|
|
||||||
found_air = true
|
candidates = candidates + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue