1
0
mirror of https://codeberg.org/tenplus1/bonemeal.git synced 2024-11-13 03:30:18 +01:00

add additional nil checks for servers with luajit issues

This commit is contained in:
tenplus1 2019-11-26 12:34:53 +00:00
parent c621448df3
commit f3ad4abff1

View File

@ -265,13 +265,17 @@ local function check_soil(pos, nodename, strength)
pos2.y = pos2.y + 1
if math.random(1, 5) == 5 then
-- place random decoration (rare)
local dnum = #decor or 1
nod = decor[math.random(1, dnum)] or ""
if decor and #decor > 0 then
-- place random decoration (rare)
local dnum = #decor or 1
nod = decor[math.random(1, dnum)] or ""
end
else
-- place random grass (common)
local dgra = #grass or 1
nod = #grass > 0 and grass[math.random(1, dgra)] or ""
if grass and #grass > 0 then
-- place random grass (common)
local dgra = #grass or 1
nod = #grass > 0 and grass[math.random(1, dgra)] or ""
end
end
if nod and nod ~= "" then