if an item should reverse dir (e.g. full destination),
and it's not going back into a tube, reject it and pop out as an item
This commit is contained in:
parent
0e8a82fdba
commit
3a77d1dd8e
@ -251,8 +251,8 @@ luaentity.register_entity("pipeworks:tubed_item", {
|
||||
local rev_node = minetest.get_node(vector.round(vector.add(self.start_pos,rev_dir)))
|
||||
local tube_present = minetest.get_item_group(rev_node.name,"tubedevice") == 1
|
||||
if not found_next then
|
||||
local drop_pos = minetest.find_node_near(vector.add(self.start_pos, velocity), 1, "air")
|
||||
if pipeworks.drop_on_routing_fail or not tube_present then
|
||||
drop_pos = minetest.find_node_near(vector.add(self.start_pos, velocity), 1, "air")
|
||||
if drop_pos then
|
||||
-- Using add_item instead of item_drop since this makes pipeworks backward
|
||||
-- compatible with Minetest 0.4.13.
|
||||
@ -262,9 +262,17 @@ luaentity.register_entity("pipeworks:tubed_item", {
|
||||
return
|
||||
end
|
||||
else
|
||||
print("[Pipeworks] Warning - tubed item had to reverse direction at "..minetest.pos_to_string(self.start_pos))
|
||||
velocity = vector.multiply(velocity, -1)
|
||||
self:setvelocity(velocity)
|
||||
if minetest.get_item_group(rev_node.name,"tube") == 1 then
|
||||
print("[Pipeworks] Warning - tubed item had to reverse direction at "..minetest.pos_to_string(self.start_pos))
|
||||
velocity = vector.multiply(velocity, -1)
|
||||
self:setvelocity(velocity)
|
||||
else
|
||||
if drop_pos then
|
||||
minetest.add_item(drop_pos, stack)
|
||||
self:remove()
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user