mirror of
https://github.com/mt-mods/pipeworks.git
synced 2025-01-04 03:57:37 +01:00
A few fixes
This commit is contained in:
parent
f697b94dae
commit
61d7bde79a
@ -268,21 +268,13 @@ local function go_next(pos,velocity,stack)
|
|||||||
if minetest.registered_nodes[node.name].tube and
|
if minetest.registered_nodes[node.name].tube and
|
||||||
minetest.registered_nodes[node.name].tube.can_insert and
|
minetest.registered_nodes[node.name].tube.can_insert and
|
||||||
minetest.registered_nodes[node.name].tube.can_insert(npos,node,stack,vect) then
|
minetest.registered_nodes[node.name].tube.can_insert(npos,node,stack,vect) then
|
||||||
local i=1
|
local i = #chests + 1
|
||||||
repeat
|
|
||||||
if chests[i]==nil then break end
|
|
||||||
i=i+1
|
|
||||||
until false
|
|
||||||
chests[i]={}
|
chests[i]={}
|
||||||
chests[i].pos=npos
|
chests[i].pos=npos
|
||||||
chests[i].vect=vect
|
chests[i].vect=vect
|
||||||
end
|
end
|
||||||
elseif tubelike == 1 then
|
elseif tubelike == 1 then
|
||||||
local i=1
|
local i = #tubes + 1
|
||||||
repeat
|
|
||||||
if tubes[i]==nil then break end
|
|
||||||
i=i+1
|
|
||||||
until false
|
|
||||||
tubes[i]={}
|
tubes[i]={}
|
||||||
tubes[i].pos=npos
|
tubes[i].pos=npos
|
||||||
tubes[i].vect=vect
|
tubes[i].vect=vect
|
||||||
@ -292,19 +284,7 @@ local function go_next(pos,velocity,stack)
|
|||||||
if tubes[1] == nil then
|
if tubes[1] == nil then
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
local i=1
|
n = (meta:get_int("tubedir")%(#tubes)) + 1
|
||||||
repeat
|
|
||||||
if tubes[i]==nil then break end
|
|
||||||
i=i+1
|
|
||||||
until false
|
|
||||||
n=meta:get_int("tubedir")+1
|
|
||||||
repeat
|
|
||||||
if n>=i then
|
|
||||||
n=n-i+1
|
|
||||||
else
|
|
||||||
break
|
|
||||||
end
|
|
||||||
until false
|
|
||||||
if pipeworks.enable_cyclic_mode then
|
if pipeworks.enable_cyclic_mode then
|
||||||
meta:set_int("tubedir",n)
|
meta:set_int("tubedir",n)
|
||||||
end
|
end
|
||||||
@ -313,19 +293,7 @@ local function go_next(pos,velocity,stack)
|
|||||||
velocity.z = tubes[n].vect.z*vel.speed
|
velocity.z = tubes[n].vect.z*vel.speed
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
local i=1
|
n = (meta:get_int("tubedir")%(#chests))+1
|
||||||
repeat
|
|
||||||
if chests[i]==nil then break end
|
|
||||||
i=i+1
|
|
||||||
until false
|
|
||||||
n=meta:get_int("tubedir")+1
|
|
||||||
repeat
|
|
||||||
if n>=i then
|
|
||||||
n=n-i+1
|
|
||||||
else
|
|
||||||
break
|
|
||||||
end
|
|
||||||
until false
|
|
||||||
if pipeworks.enable_cyclic_mode then
|
if pipeworks.enable_cyclic_mode then
|
||||||
meta:set_int("tubedir",n)
|
meta:set_int("tubedir",n)
|
||||||
end
|
end
|
||||||
@ -503,5 +471,3 @@ minetest.register_entity("pipeworks:tubed_item", {
|
|||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user