fix undefined node crash

This commit is contained in:
Vanessa Ezekowitz 2014-08-24 11:51:43 -04:00
parent 42a364b818
commit bbc530a067

View File

@ -253,17 +253,20 @@ local function go_next(pos, velocity, stack)
for _, vect in ipairs(can_go) do for _, vect in ipairs(can_go) do
local npos = vector.add(pos, vect) local npos = vector.add(pos, vect)
local node = minetest.get_node(npos) local node = minetest.get_node(npos)
local tubedevice = minetest.get_item_group(node.name, "tubedevice") local reg_node = minetest.registered_nodes[node.name]
local tube_def = minetest.registered_nodes[node.name].tube if reg_node then
local tube_priority = (tube_def and tube_def.priority) or 100 local tube_def = reg_node.tube
if tubedevice > 0 and tube_priority >= max_priority then local tubedevice = minetest.get_item_group(node.name, "tubedevice")
if not tube_def or not tube_def.can_insert or local tube_priority = (tube_def and tube_def.priority) or 100
tube_def.can_insert(npos, node, stack, vect) then if tubedevice > 0 and tube_priority >= max_priority then
if tube_priority > max_priority then if not tube_def or not tube_def.can_insert or
max_priority = tube_priority tube_def.can_insert(npos, node, stack, vect) then
next_positions = {} if tube_priority > max_priority then
max_priority = tube_priority
next_positions = {}
end
next_positions[#next_positions + 1] = {pos = npos, vect = vect}
end end
next_positions[#next_positions + 1] = {pos = npos, vect = vect}
end end
end end
end end