Merge pull request 'Several fixes for applying bone meal to grass (Fix #900)' (#1894) from NO11/MineClone2:bone_meal into master
Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/1894new_mapgen_api
commit
f233fb5d30
|
@ -288,16 +288,16 @@ local function apply_bone_meal(pointed_thing)
|
||||||
return true
|
return true
|
||||||
elseif minetest.get_item_group(n.name, "grass_block") == 1 then
|
elseif minetest.get_item_group(n.name, "grass_block") == 1 then
|
||||||
-- Grass Block: Generate tall grass and random flowers all over the place
|
-- Grass Block: Generate tall grass and random flowers all over the place
|
||||||
for i = -2, 2 do
|
for i = -7, 7 do
|
||||||
for j = -2, 2 do
|
for j = -7, 7 do
|
||||||
pos = pointed_thing.above
|
for y = -1, 1 do
|
||||||
pos = {x=pos.x+i, y=pos.y, z=pos.z+j}
|
pos = vector.offset(pointed_thing.above, i, y, j)
|
||||||
n = minetest.get_node(pos)
|
n = minetest.get_node(pos)
|
||||||
local n2 = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z})
|
local n2 = minetest.get_node(vector.offset(pos, 0, -1, 0))
|
||||||
|
|
||||||
if n.name ~= "" and n.name == "air" and (minetest.get_item_group(n2.name, "grass_block_no_snow") == 1) then
|
if n.name ~= "" and n.name == "air" and (minetest.get_item_group(n2.name, "grass_block_no_snow") == 1) then
|
||||||
-- Randomly generate flowers, tall grass or nothing
|
-- Randomly generate flowers, tall grass or nothing
|
||||||
if math.random(1,100) <= 90 then
|
if math.random(1, 100) <= 90 / ((math.abs(i) + math.abs(j)) / 2)then
|
||||||
-- 90% tall grass, 10% flower
|
-- 90% tall grass, 10% flower
|
||||||
mcl_dye.add_bone_meal_particle(pos, {amount = 4})
|
mcl_dye.add_bone_meal_particle(pos, {amount = 4})
|
||||||
if math.random(1,100) <= 90 then
|
if math.random(1,100) <= 90 then
|
||||||
|
@ -325,6 +325,7 @@ local function apply_bone_meal(pointed_thing)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
return true
|
return true
|
||||||
|
|
||||||
-- Double flowers: Drop corresponding item
|
-- Double flowers: Drop corresponding item
|
||||||
|
|
Loading…
Reference in New Issue