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 `//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)

View file

@ -25,12 +25,9 @@ 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(
@ -42,10 +39,6 @@ function worldeditadditions.bonemeal(pos1, pos2, strength, chance)
end end
candidates = candidates + 1 candidates = candidates + 1
found_air = false
end
else
found_air = true
end end
end end
end end