summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xitem_transport.lua23
1 files changed, 13 insertions, 10 deletions
diff --git a/item_transport.lua b/item_transport.lua
index 02ef5f8..c378d6e 100755
--- a/item_transport.lua
+++ b/item_transport.lua
@@ -253,17 +253,20 @@ local function go_next(pos, velocity, stack)
for _, vect in ipairs(can_go) do
local npos = vector.add(pos, vect)
local node = minetest.get_node(npos)
- local tubedevice = minetest.get_item_group(node.name, "tubedevice")
- local tube_def = minetest.registered_nodes[node.name].tube
- local tube_priority = (tube_def and tube_def.priority) or 100
- if tubedevice > 0 and tube_priority >= max_priority then
- if not tube_def or not tube_def.can_insert or
- tube_def.can_insert(npos, node, stack, vect) then
- if tube_priority > max_priority then
- max_priority = tube_priority
- next_positions = {}
+ local reg_node = minetest.registered_nodes[node.name]
+ if reg_node then
+ local tube_def = reg_node.tube
+ local tubedevice = minetest.get_item_group(node.name, "tubedevice")
+ local tube_priority = (tube_def and tube_def.priority) or 100
+ if tubedevice > 0 and tube_priority >= max_priority then
+ if not tube_def or not tube_def.can_insert or
+ tube_def.can_insert(npos, node, stack, vect) then
+ if tube_priority > max_priority then
+ max_priority = tube_priority
+ next_positions = {}
+ end
+ next_positions[#next_positions + 1] = {pos = npos, vect = vect}
end
- next_positions[#next_positions + 1] = {pos = npos, vect = vect}
end
end
end