Fix centrifuge distribution code
This commit is contained in:
parent
b9dc5a5d35
commit
c277dc9623
@ -201,9 +201,14 @@ function moveTo(x, y)
|
||||
end
|
||||
|
||||
function resupplyItem(slot, num)
|
||||
module = peripheral.wrap("right")
|
||||
|
||||
turtle.select(slot)
|
||||
while (turtle.getItemCount(slot) < num) do
|
||||
turtle.suck(num - turtle.getItemCount(slot))
|
||||
items = turtle.getItemCount(slot)
|
||||
while (items < num) do
|
||||
module.suckSneaky(1, num - items)
|
||||
sleep(1)
|
||||
items = turtle.getItemCount(slot)
|
||||
end
|
||||
end
|
||||
|
||||
@ -246,15 +251,17 @@ function supplyCentrifuge()
|
||||
module = peripheral.wrap("right")
|
||||
|
||||
-- drop cells from below (side 0)
|
||||
turtle.select(slot_cells_cur)
|
||||
drop = cells_drop
|
||||
if (turtle.getItemCount(slot_cells_cur) < drop) then
|
||||
drop = drop - turtle.getItemCount(slot_cells_cur)
|
||||
module.dropSneakyUp(0)
|
||||
slot_cells_cur = slot_cells_cur + 1
|
||||
if (cells_drop > 0) then
|
||||
turtle.select(slot_cells_cur)
|
||||
drop = cells_drop
|
||||
if (turtle.getItemCount(slot_cells_cur) < drop) then
|
||||
drop = drop - turtle.getItemCount(slot_cells_cur)
|
||||
module.dropSneakyUp(0)
|
||||
slot_cells_cur = slot_cells_cur + 1
|
||||
turtle.select(slot_cells_cur)
|
||||
end
|
||||
module.dropSneakyUp(0, drop)
|
||||
end
|
||||
module.dropSneakyUp(0, drop)
|
||||
|
||||
-- drop input from above (side 1)
|
||||
turtle.select(slot_input_cur)
|
||||
@ -357,16 +364,19 @@ function setupSlots(cells, input, output_1, output_2, output_3, output_4)
|
||||
end
|
||||
|
||||
function enterSupplyLoop()
|
||||
module = peripheral.wrap("right")
|
||||
|
||||
while true do
|
||||
print("Resupplying...")
|
||||
resupplyAll()
|
||||
|
||||
-- go to first centrifuge and wait to start
|
||||
-- go to first centrifuge and wait to start (by checking ingredient)
|
||||
moveTo(1, 0)
|
||||
turtle.select(16)
|
||||
while turtle.suckUp() do
|
||||
while module.suckSneakyUp(1, input_drop) do
|
||||
putBack = turtle.getItemCount(16)
|
||||
turtle.dropUp(putBack)
|
||||
sleep(1)
|
||||
module.dropSneakyUp(1, putBack)
|
||||
sleep(5)
|
||||
end
|
||||
|
||||
@ -411,4 +421,5 @@ function platinumLoop()
|
||||
end
|
||||
|
||||
print("Centrifuges even item distribution program")
|
||||
platinumLoop()
|
||||
|
||||
redstoneLoop()
|
||||
|
@ -201,9 +201,14 @@ function moveTo(x, y)
|
||||
end
|
||||
|
||||
function resupplyItem(slot, num)
|
||||
module = peripheral.wrap("right")
|
||||
|
||||
turtle.select(slot)
|
||||
while (turtle.getItemCount(slot) < num) do
|
||||
turtle.suck(num - turtle.getItemCount(slot))
|
||||
items = turtle.getItemCount(slot)
|
||||
while (items < num) do
|
||||
module.suckSneaky(1, num - items)
|
||||
sleep(1)
|
||||
items = turtle.getItemCount(slot)
|
||||
end
|
||||
end
|
||||
|
||||
@ -246,15 +251,17 @@ function supplyCentrifuge()
|
||||
module = peripheral.wrap("right")
|
||||
|
||||
-- drop cells from below (side 0)
|
||||
turtle.select(slot_cells_cur)
|
||||
drop = cells_drop
|
||||
if (turtle.getItemCount(slot_cells_cur) < drop) then
|
||||
drop = drop - turtle.getItemCount(slot_cells_cur)
|
||||
module.dropSneakyUp(0)
|
||||
slot_cells_cur = slot_cells_cur + 1
|
||||
if (cells_drop > 0) then
|
||||
turtle.select(slot_cells_cur)
|
||||
drop = cells_drop
|
||||
if (turtle.getItemCount(slot_cells_cur) < drop) then
|
||||
drop = drop - turtle.getItemCount(slot_cells_cur)
|
||||
module.dropSneakyUp(0)
|
||||
slot_cells_cur = slot_cells_cur + 1
|
||||
turtle.select(slot_cells_cur)
|
||||
end
|
||||
module.dropSneakyUp(0, drop)
|
||||
end
|
||||
module.dropSneakyUp(0, drop)
|
||||
|
||||
-- drop input from above (side 1)
|
||||
turtle.select(slot_input_cur)
|
||||
@ -357,16 +364,19 @@ function setupSlots(cells, input, output_1, output_2, output_3, output_4)
|
||||
end
|
||||
|
||||
function enterSupplyLoop()
|
||||
module = peripheral.wrap("right")
|
||||
|
||||
while true do
|
||||
print("Resupplying...")
|
||||
resupplyAll()
|
||||
|
||||
-- go to first centrifuge and wait to start
|
||||
-- go to first centrifuge and wait to start (by checking ingredient)
|
||||
moveTo(1, 0)
|
||||
turtle.select(16)
|
||||
while turtle.suckUp() do
|
||||
while module.suckSneakyUp(1, input_drop) do
|
||||
putBack = turtle.getItemCount(16)
|
||||
turtle.dropUp(putBack)
|
||||
sleep(1)
|
||||
module.dropSneakyUp(1, putBack)
|
||||
sleep(5)
|
||||
end
|
||||
|
||||
@ -411,4 +421,5 @@ function redstoneLoop()
|
||||
end
|
||||
|
||||
print("Centrifuges even item distribution program")
|
||||
|
||||
redstoneLoop()
|
||||
|
Loading…
x
Reference in New Issue
Block a user