Extra error checking.

This commit is contained in:
Duane 2016-07-15 02:58:33 -05:00
parent aa999e2ed5
commit bf26b8bee1
25 changed files with 897 additions and 314 deletions

View file

@ -29,7 +29,7 @@ if mobs and mobs.mod == "redo" then
end
end
local function savage_gathering(self)
if not fun_caves.custom_ready(self) then
if not (self and fun_caves.custom_ready(self)) then
return
end
@ -45,7 +45,10 @@ if mobs and mobs.mod == "redo" then
local p = soil[math.random(#soil)]
p.y = p.y + 1
minetest.add_node(p, {name = 'farming:seed_wheat', param2 = 1})
minetest.get_node_timer(p):start(math.random(166, 286))
local timer = minetest.get_node_timer(p)
if timer then
timer:start(math.random(166, 286))
end
end
end
@ -115,6 +118,10 @@ end
local function build_hut(data, area, node, pos, turf)
if not (data and area and node and pos and turf and type(data) == 'table') then
return
end
local door = {x = ({2,7})[math.random(2)], z = ({2,7})[math.random(2)]}
for z = 1, 8 do
@ -151,6 +158,10 @@ local function build_hut(data, area, node, pos, turf)
end
fun_caves.village = function(minp, maxp, data, p2data, area, node, biome, heightmap)
if not (minp and maxp and data and p2data and area and node and type(data) == 'table' and type(p2data) == 'table') then
return
end
if not biome or math.random(10) ~= 1 then
return
end