(brain-o in how I was handling unknown/bad nodes being passed to it. this
works better and lets the code do its job properly).
--a function for determining which side of the node we are on
local function nodeside(node, tubedir)
- if not tubedir or
- not node or
- not (type(node.param2) == "number" and node.param2 > 0 and node.param2 < 23) then
- return "back"
- end
+ if node and (node.param2 < 0 or node.param2 > 23) then node.param2 = 0 end
--get a vector pointing back
local backdir = minetest.facedir_to_dir(node.param2)