undo preventing machines from pushing to themselves; make detector only accept items on the input side

This commit is contained in:
flux 2019-09-12 22:53:29 +00:00
parent ebd9864ce0
commit 281f4b539b
2 changed files with 6 additions and 6 deletions

@ -139,7 +139,6 @@ local function get_dest_node(pos, side)
local dir = side_to_dir(side, node.param2) local dir = side_to_dir(side, node.param2)
local spos, sdir = Tube:get_connected_node_pos(pos, dir) local spos, sdir = Tube:get_connected_node_pos(pos, dir)
if not (spos and sdir) then return end if not (spos and sdir) then return end
if vector.equals(pos, spos) then return end
_,node = Tube:get_node(spos) _,node = Tube:get_node(spos)
local out_side = dir_to_side(tubelib2.Turn180Deg[sdir], node.param2) local out_side = dir_to_side(tubelib2.Turn180Deg[sdir], node.param2)
return spos, out_side, Name2Name[node.name] or node.name return spos, out_side, Name2Name[node.name] or node.name

@ -131,6 +131,7 @@ minetest.register_craft({
tubelib.register_node("tubelib_addons1:detector", {"tubelib_addons1:detector_active"}, { tubelib.register_node("tubelib_addons1:detector", {"tubelib_addons1:detector_active"}, {
on_push_item = function(pos, side, item) on_push_item = function(pos, side, item)
if side ~= "L" then return false end
local player_name = minetest.get_meta(pos):get_string("player_name") local player_name = minetest.get_meta(pos):get_string("player_name")
if tubelib.push_items(pos, "R", item, player_name) then if tubelib.push_items(pos, "R", item, player_name) then
switch_on(pos) switch_on(pos)