Fix crash from missing node types.

This commit is contained in:
Duane 2016-07-12 21:20:55 -05:00
parent 4ad818a922
commit 8eedc5afc3
4 changed files with 13 additions and 2 deletions

View file

@ -108,6 +108,9 @@ for _, name in pairs(elixir_ingredients) do
if not item then if not item then
item = minetest.registered_nodes[name] item = minetest.registered_nodes[name]
end end
if not item then
break
end
if item then if item then
if item.groups then if item.groups then
groups = table.copy(item.groups) groups = table.copy(item.groups)

View file

@ -2,7 +2,7 @@
-- GOBLINS -- GOBLINS
--------------------------------------------------------------- ---------------------------------------------------------------
local spawn_frequency = 250 -- 250 local spawn_frequency = 500 -- 500
local dig_freq = 5 -- 5 local dig_freq = 5 -- 5
local trap_freq = 25 -- 25 local trap_freq = 25 -- 25
local torch_freq = 2 -- 2 local torch_freq = 2 -- 2

View file

@ -120,6 +120,10 @@ local nodes = {{'default:sandstone', 'default:sandstone_block'}, {'default:wood'
for _, node in pairs(nodes) do for _, node in pairs(nodes) do
local node_name = node[1] local node_name = node[1]
local comp = node[2] or node_name local comp = node[2] or node_name
if not minetest.registered_items[node_name] or (not minetest.registered_items[comp] and not comp:find('^fun_caves')) then
break
end
local node_texture = minetest.registered_items[node_name].tiles local node_texture = minetest.registered_items[node_name].tiles
if type(node_texture) == 'table' then if type(node_texture) == 'table' then
node_texture = node_texture[1] node_texture = node_texture[1]
@ -197,6 +201,10 @@ local function default_rightclick(pos, node, clicker, itemstack, pointed_thing)
end end
for _, node in pairs(mass_nodes) do for _, node in pairs(mass_nodes) do
if not minetest.registered_items[node] then
break
end
minetest.override_item(node, {on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) minetest.override_item(node, {on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
local tool = itemstack:get_name() local tool = itemstack:get_name()
if not mass_tools[tool] then if not mass_tools[tool] then

View file

@ -355,7 +355,7 @@ fun_caves.treegen = function(minp, maxp, data, p2data, area, node)
end end
if data[ivm] ~= node['air'] and data[ivm] ~= node['fun_caves:weightless_water'] then if data[ivm] ~= node['air'] and data[ivm] ~= node['fun_caves:weightless_water'] then
if math_random(100) == 1 then if math_random(200) == 1 then
data[ivm] = node['fun_caves:sap'] data[ivm] = node['fun_caves:sap']
elseif math_random(1000) == 1 then elseif math_random(1000) == 1 then
data[ivm] = node['fun_caves:tree_mineral'] data[ivm] = node['fun_caves:tree_mineral']