A few fixes

This commit is contained in:
Novatux 2013-12-21 08:46:55 +01:00
parent f697b94dae
commit 61d7bde79a
1 changed files with 34 additions and 68 deletions

View File

@ -268,21 +268,13 @@ local function go_next(pos,velocity,stack)
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(npos,node,stack,vect) then
local i=1
repeat
if chests[i]==nil then break end
i=i+1
until false
local i = #chests + 1
chests[i]={}
chests[i].pos=npos
chests[i].vect=vect
end
elseif tubelike == 1 then
local i=1
repeat
if tubes[i]==nil then break end
i=i+1
until false
local i = #tubes + 1
tubes[i]={}
tubes[i].pos=npos
tubes[i].vect=vect
@ -292,19 +284,7 @@ local function go_next(pos,velocity,stack)
if tubes[1] == nil then
return 0
else
local i=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
n = (meta:get_int("tubedir")%(#tubes)) + 1
if pipeworks.enable_cyclic_mode then
meta:set_int("tubedir",n)
end
@ -313,19 +293,7 @@ local function go_next(pos,velocity,stack)
velocity.z = tubes[n].vect.z*vel.speed
end
else
local i=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
n = (meta:get_int("tubedir")%(#chests))+1
if pipeworks.enable_cyclic_mode then
meta:set_int("tubedir",n)
end
@ -503,5 +471,3 @@ minetest.register_entity("pipeworks:tubed_item", {
end
})