forked from mtcontrib/bonemeal
add additional nil checks for servers with luajit issues
This commit is contained in:
parent
c621448df3
commit
f3ad4abff1
4
init.lua
4
init.lua
@ -265,14 +265,18 @@ local function check_soil(pos, nodename, strength)
|
|||||||
pos2.y = pos2.y + 1
|
pos2.y = pos2.y + 1
|
||||||
|
|
||||||
if math.random(1, 5) == 5 then
|
if math.random(1, 5) == 5 then
|
||||||
|
if decor and #decor > 0 then
|
||||||
-- place random decoration (rare)
|
-- place random decoration (rare)
|
||||||
local dnum = #decor or 1
|
local dnum = #decor or 1
|
||||||
nod = decor[math.random(1, dnum)] or ""
|
nod = decor[math.random(1, dnum)] or ""
|
||||||
|
end
|
||||||
else
|
else
|
||||||
|
if grass and #grass > 0 then
|
||||||
-- place random grass (common)
|
-- place random grass (common)
|
||||||
local dgra = #grass or 1
|
local dgra = #grass or 1
|
||||||
nod = #grass > 0 and grass[math.random(1, dgra)] or ""
|
nod = #grass > 0 and grass[math.random(1, dgra)] or ""
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if nod and nod ~= "" then
|
if nod and nod ~= "" then
|
||||||
def = minetest.registered_nodes[nod]
|
def = minetest.registered_nodes[nod]
|
||||||
|
Loading…
Reference in New Issue
Block a user