mirror of
https://codeberg.org/tenplus1/bonemeal.git
synced 2025-01-08 17:20:24 +01:00
bonemeal on dirt/sand only works for that type at one time
This commit is contained in:
parent
797bae9c46
commit
a4c4716c36
13
init.lua
13
init.lua
@ -213,12 +213,21 @@ local function check_soil(pos, nodename, strength)
|
|||||||
-- set radius according to strength
|
-- set radius according to strength
|
||||||
local side = strength - 1
|
local side = strength - 1
|
||||||
local tall = math.max(strength - 2, 0)
|
local tall = math.max(strength - 2, 0)
|
||||||
|
local floor = {"group:soil", "group:sand"}
|
||||||
|
local groups = minetest.registered_items[nodename]
|
||||||
|
and minetest.registered_items[nodename].groups or {}
|
||||||
|
|
||||||
|
-- only place decoration on one type of surface
|
||||||
|
if groups.soil then
|
||||||
|
floor = {"group:soil"}
|
||||||
|
elseif groups.sand then
|
||||||
|
floor = {"group:sand"}
|
||||||
|
end
|
||||||
|
|
||||||
-- get area of land with free space above
|
-- get area of land with free space above
|
||||||
local dirt = minetest.find_nodes_in_area_under_air(
|
local dirt = minetest.find_nodes_in_area_under_air(
|
||||||
{x = pos.x - side, y = pos.y - tall, z = pos.z - side},
|
{x = pos.x - side, y = pos.y - tall, z = pos.z - side},
|
||||||
{x = pos.x + side, y = pos.y + tall, z = pos.z + side},
|
{x = pos.x + side, y = pos.y + tall, z = pos.z + side}, floor)
|
||||||
{"group:soil", "group:sand"})
|
|
||||||
|
|
||||||
-- set default grass and decoration
|
-- set default grass and decoration
|
||||||
local grass = green_grass
|
local grass = green_grass
|
||||||
|
Loading…
Reference in New Issue
Block a user