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

@ -44,10 +44,10 @@ while true do
end
end
while true do
sound()
if math.random(100) > 97 then
--sound()
if math.random(100) > 97 or true then
sfx.success()
sleep(random(1,4))
sleep(math.random(1,4))
end
end
parallel.waitForAll(sound,sound,sound,sound,sound)

File diff suppressed because it is too large Load diff

View file

@ -8,12 +8,12 @@ return {
amount = 50,
},
{
name = "still_milk",
amount = 0,
name = "molten_brass",
amount = 192,
},
{
name = "lava",
amount = 1325,
amount = 1450,
},
{
name = "molten_copper",

View file

@ -13,6 +13,7 @@ isFluid = {
molten_bronze = true,
molten_tin = true,
molten_zinc = true,
molten_brass = true,
compound_mixture = true,
}
@ -65,6 +66,15 @@ function getFluidAmount(type)
return 0
end
function getFluidAmountInTanks(type, tanks)
for _, fluid in pairs(tanks) do
if stripModname(fluid.name) == type then
return fluid.amount
end
end
return 0
end
function pumpToDevices(enable)
goTo(vector.new(4, 0, -1))
-- clutches invert the signal

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

View file

@ -232,8 +232,9 @@ steps:
spout molten_rose_gold:111
molten_rose_gold
yield 111
steps:
alloy molten_copper molten_gold
alloy molten_copper:111 molten_gold:111
rose_gold_ingot
steps:
@ -458,3 +459,44 @@ deploy cogwheel
deploy large_cogwheel
deploy desh_nugget
oxygen_tank
steps:
craft bronze_sheet iron_rod nil bronze_sheet bronze_sheet nil bronze_sheet bronze_sheet
iron_rod
yield 2
base iron_ingot
steps:
rolling_mill
brass_casing
base copper_casing
intermediate incomplete_brass_casing
repeat 3
steps:
deploy brass_rod
spout molten_brass:12
deploy brass_sheet
press
brass_sheet
base brass_ingot
steps:
press
brass_rod
base brass_ingot
yield 2
steps:
rolling_mill
molten_brass
base brass_ingot
yield 111
steps:
melt
mechanical_crafter
steps:
craft electron_tube nil nil brass_casing nil nil precision_mechanism

View file

@ -10,7 +10,7 @@ keep_stocked = {
flint = 10
}
resetAllFluidDevices()
--resetAllFluidDevices()
goHome()
print("known recipes:\n")

View file

@ -1,34 +0,0 @@
chest = peripheral.wrap("front")
local function bake()
for i = 2,16 do
turtle.select(i)
turtle.drop()
end
turtle.suck()
items = chest.list()
local pretty = require "cc.pretty"
pretty.pretty_print(items)
for k,v in pairs(items) do
if v.name == "minecraft:wheat" then
chest.pushItems("front",k,64,1)
end
end
turtle.drop()
turtle.select(2)
count = chest.getItemDetail(1).count/3
turtle.suck(count)
turtle.select(5)
turtle.suck(count)
turtle.select(6)
turtle.suck(count)
for i = 1, count do
turtle.select(1)
turtle.placeDown()
turtle.craft()
turtle.select(3)
turtle.drop()
end
end
bake()

View file

@ -1,6 +1,6 @@
{
"computer": 22,
"disk": 2,
"computer": 23,
"disk": 3,
"peripheral.create:fluid_tank": 2,
"peripheral.create:item_vault": 0,
"peripheral.create:chute": 0,