forked from mtcontrib/pipeworks
Fix item transport code
This commit is contained in:
parent
e5344edf98
commit
75db2c5307
@ -123,7 +123,6 @@ minetest.register_node("pipeworks:filter", {
|
||||
local frompos = {x=pos.x - dir.x, y=pos.y - dir.y, z=pos.z - dir.z}
|
||||
local fromnode=minetest.get_node(frompos)
|
||||
if not fromnode then return end
|
||||
local frominv
|
||||
local idef = minetest.registered_nodes[fromnode.name]
|
||||
-- assert(idef)
|
||||
local tube = idef.tube
|
||||
@ -133,8 +132,9 @@ minetest.register_node("pipeworks:filter", {
|
||||
local frommeta = minetest.get_meta(frompos)
|
||||
local frominvname = tube.input_inventory
|
||||
local frominv = frommeta:get_inventory()
|
||||
local sname
|
||||
for _,filter in ipairs(inv:get_list("main")) do
|
||||
local sname=filter:get_name()
|
||||
sname = filter:get_name()
|
||||
if sname ~= "" then
|
||||
-- XXX: that's a lot of parameters
|
||||
grabAndFire(frominv, frominvname, frompos, fromnode, sname, tube, idef, dir)
|
||||
@ -190,7 +190,6 @@ minetest.register_node("pipeworks:mese_filter", {
|
||||
local dir = facedir_to_right_dir(node.param2)
|
||||
local frompos = {x=pos.x - dir.x, y=pos.y - dir.y, z=pos.z - dir.z}
|
||||
local fromnode=minetest.get_node(frompos)
|
||||
local frominv
|
||||
local idef = minetest.registered_nodes[fromnode.name]
|
||||
-- assert(idef)
|
||||
local tube = idef.tube
|
||||
@ -200,8 +199,9 @@ minetest.register_node("pipeworks:mese_filter", {
|
||||
local frommeta = minetest.get_meta(frompos)
|
||||
local frominvname = minetest.registered_nodes[fromnode.name].tube.input_inventory
|
||||
local frominv = frommeta:get_inventory()
|
||||
local sname
|
||||
for _,filter in ipairs(inv:get_list("main")) do
|
||||
local sname=filter:get_name()
|
||||
sname = filter:get_name()
|
||||
if sname ~= "" then
|
||||
grabAndFire(frominv, frominvname, frompos, fromnode, sname, tube, idef, dir, true)
|
||||
end
|
||||
@ -235,11 +235,6 @@ local function go_next(pos,velocity,stack)
|
||||
local tubes = {}
|
||||
local cnode = minetest.get_node(pos)
|
||||
local cmeta = minetest.get_meta(pos)
|
||||
local node
|
||||
local meta
|
||||
local tubelike
|
||||
local tube_receiver
|
||||
local len = 1
|
||||
local n
|
||||
local can_go
|
||||
local speed = math.abs(velocity.x + velocity.y + velocity.z)
|
||||
@ -253,7 +248,7 @@ local function go_next(pos,velocity,stack)
|
||||
end
|
||||
vel.speed=speed
|
||||
if minetest.registered_nodes[cnode.name] and minetest.registered_nodes[cnode.name].tube and minetest.registered_nodes[cnode.name].tube.can_go then
|
||||
can_go = minetest.registered_nodes[cnode.name].tube.can_go(pos,node,vel,stack)
|
||||
can_go = minetest.registered_nodes[cnode.name].tube.can_go(pos, cnode, vel, stack)
|
||||
else
|
||||
can_go = pipeworks.notvel(adjlist, vel)
|
||||
end
|
||||
@ -284,18 +279,18 @@ local function go_next(pos,velocity,stack)
|
||||
if tubes[1] == nil then
|
||||
return 0
|
||||
else
|
||||
n = (meta:get_int("tubedir")%(#tubes)) + 1
|
||||
n = (cmeta:get_int("tubedir")%(#tubes)) + 1
|
||||
if pipeworks.enable_cyclic_mode then
|
||||
meta:set_int("tubedir",n)
|
||||
cmeta:set_int("tubedir",n)
|
||||
end
|
||||
velocity.x = tubes[n].vect.x*vel.speed
|
||||
velocity.y = tubes[n].vect.y*vel.speed
|
||||
velocity.z = tubes[n].vect.z*vel.speed
|
||||
end
|
||||
else
|
||||
n = (meta:get_int("tubedir")%(#chests))+1
|
||||
n = (cmeta:get_int("tubedir")%(#chests))+1
|
||||
if pipeworks.enable_cyclic_mode then
|
||||
meta:set_int("tubedir",n)
|
||||
cmeta:set_int("tubedir",n)
|
||||
end
|
||||
velocity.x = chests[n].vect.x*speed
|
||||
velocity.y = chests[n].vect.y*speed
|
||||
|
Loading…
Reference in New Issue
Block a user