reduce badness

This commit is contained in:
Crispy 2025-06-02 00:47:39 +02:00
parent 61eefcba8c
commit c91761f3a1
9 changed files with 846 additions and 2333 deletions

View file

@ -161,19 +161,34 @@ function alloy(parts, product)
connectTank(fluid.name)
pumpToDevices(true)
goTo(mixer_pos, "south")
-- TODO wait for 1B or tank content is in the mixer
sleep(5)
-- wait for 1B or tank content is in the mixer
expected_amount = math.min(getFluidAmount(fluid.name), 1000)
print("waiting for", expected_amount, fluid.name, "in mixer")
while getFluidAmountInTanks(fluid.name, pFront("tanks")) < expected_amount do
sleep(0.1)
end
pumpToDevices(false)
end
goTo(mixer_pos, "south")
-- TODO wait for alloy to be done
sleep(10)
-- wait for alloy to be done
local is_done = false
while not is_done do
local mixer_tanks = pFront("tanks")
for _, part in pairs(parts) do
if getFluidAmountInTanks(part.name, mixer_tanks) == 0 then
is_done = true
end
end
end
created_amount = 0
for _, fluid in pairs(pFront("tanks")) do
if fluid.amount > 0 then
connectTankOrAssign(stripModname(fluid.name))
pumpToTanks(true)
sleep(10)
goTo(mixer_pos, "south")
while getFluidAmountInTanks(fluid.name, pFront("tanks")) > 0 do
sleep(0.2)
end
pumpToTanks(false)
if stripModname(fluid.name) == product then
fluidInvAdd(product, fluid.amount)
@ -241,16 +256,10 @@ function mix(extra_items, product, yield)
end
end
until not inputs_remaining
if product == "still_milk" then
repeat
is_done = false
for _, t in pairs(pFront("tanks")) do
if stripModname(t.name) == "still_milk" then
is_done = t.amount >= yield
break
end
end
until is_done
if isFluid[product]then
while getFluidAmountInTanks(product, pFront("tanks")) < yield do
sleep(0.1)
end
end
for i = 10, 18 do
@ -262,7 +271,10 @@ function mix(extra_items, product, yield)
if tank.amount > 0 then
connectTankOrAssign(stripModname(tank.name))
pumpToTanks(true)
sleep(8)
goTo(mixer_pos, "south")
while getFluidAmountInTanks(tank.name, pFront("tanks")) > 0 do
sleep(0.1)
end
pumpToTanks(false)
end
end