Disallow pushing into invalid faces

This commit is contained in:
Cam B 2021-01-20 14:52:05 +00:00
parent c0f2ffc99a
commit 8f896b65c4

@ -431,6 +431,14 @@ end
function tubelib.push_items(pos, side, items, player_name) function tubelib.push_items(pos, side, items, player_name)
local npos, nside, name = get_dest_node(pos, side) local npos, nside, name = get_dest_node(pos, side)
if npos == nil then return end if npos == nil then return end
local _,node = Tube:get_node(pos)
local dir = side_to_dir(side, node.param2)
local node, _, valid = Tube:get_secondary_node(pos, dir)
if node and not valid then
return false
end
if tubelib_NodeDef[name] and tubelib_NodeDef[name].on_push_item then if tubelib_NodeDef[name] and tubelib_NodeDef[name].on_push_item then
return tubelib_NodeDef[name].on_push_item(npos, nside, items, player_name) return tubelib_NodeDef[name].on_push_item(npos, nside, items, player_name)
elseif name == "air" then elseif name == "air" then