bonemeal: Try bonemealing everything that isn't an air block

fixes #49
This commit is contained in:
Starbeamrainbowlabs 2021-05-11 22:17:10 +01:00
parent 81f3a87180
commit f9eb67b4cc
Signed by: sbrl
GPG Key ID: 1BE5172E637709C2
2 changed files with 13 additions and 19 deletions

View File

@ -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 `//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)
- `//bonemeal`: Try bonemealing everything that isn't an air block (#49)
## v1.11: The big data update (25th January 2021)

View File

@ -25,27 +25,20 @@ function worldeditadditions.bonemeal(pos1, pos2, strength, chance)
local candidates = 0
for z = pos2.z, pos1.z, -1 do
for x = pos2.x, pos1.x, -1 do
local found_air = false
for y = pos2.y, pos1.y, -1 do
if data[area:index(x, y, z)] ~= node_id_air then
if found_air then
-- We've found an air block previously, so this node definitely has air above it
if math.random(0, chance - 1) == 0 then
bonemeal:on_use(
{ x = x, y = y, z = z },
strength,
nil
)
nodes_bonemealed = nodes_bonemealed + 1
end
candidates = candidates + 1
found_air = false
if not worldeditadditions.is_airlike(data[area:index(x, y, z)]) then
-- It's not an air node, so let's try to bonemeal it
if math.random(0, chance - 1) == 0 then
bonemeal:on_use(
{ x = x, y = y, z = z },
strength,
nil
)
nodes_bonemealed = nodes_bonemealed + 1
end
else
found_air = true
candidates = candidates + 1
end
end
end