Automate Blaze Cake keep stock
This commit is contained in:
@@ -54,6 +54,15 @@ reserviert. Fuer fertige Blaze Cakes fehlt noch eine adressierbare Filling-Stati
|
||||
mit 250 mB Lava pro Base. Eine Charge umfasst wegen der Stackgroesse von Eggs
|
||||
genau 16 Bases.
|
||||
|
||||
V1.7 automatisiert auch den letzten Schritt: Blaze Cake Bases werden an die
|
||||
Filling-Station `Blazecake` geschickt und dort mit der fest angeschlossenen
|
||||
Lava-Versorgung zu fertigen Blaze Cakes gefuellt. Im AUTO-Modus haelt der
|
||||
Scheduler 64 Blaze Cakes vor. Der Auftrag darf insgesamt 64 Cakes umfassen,
|
||||
arbeitet wegen der Egg-Stackgroesse jedoch durchgehend in sicheren 16er-Chargen.
|
||||
Sobald eine Charge im Lager angekommen ist, startet ohne zusaetzliche
|
||||
60-Sekunden-Wartezeit die naechste; nur nach der letzten Charge gilt der normale
|
||||
Nachlauf.
|
||||
|
||||
## Create-Fabrik: Peripherie erkennen
|
||||
|
||||
Das rein lesende Diagnoseprogramm herunterladen und starten:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
-- ATM10 Create factory scheduler V1
|
||||
-- Persistent jobs, dependency planning, progress-aware retries and diagnostics.
|
||||
|
||||
local VERSION = "1.6.1"
|
||||
local VERSION = "1.7.0"
|
||||
local REFRESH_SECONDS = 1
|
||||
local CONFIRM_SECONDS = 6
|
||||
local DRAIN_SECONDS = 60
|
||||
@@ -148,6 +148,19 @@ local RECIPES = {
|
||||
{ item = "create:cinder_flour", count = 16 },
|
||||
},
|
||||
output = "create:blaze_cake_base", outputCount = 16, targetCount = 16,
|
||||
batchOutput = 16,
|
||||
-- Deterministic 1:1 output: once every requested Base is back in stock,
|
||||
-- the dependent Filling job can be released immediately.
|
||||
completionDrainSeconds = 0,
|
||||
},
|
||||
fill_blaze_cake = {
|
||||
label = "16 BLAZE CAKES", station = "Blazecake", address = "Blazecake",
|
||||
input = "create:blaze_cake_base", inputCount = 16,
|
||||
output = "create:blaze_cake", outputCount = 16, targetCount = 16,
|
||||
-- Eggs and Blaze Cake Bases are produced/routed in safe 16-item batches.
|
||||
-- A larger AUTO order continues with the next batch as soon as the
|
||||
-- previous 16 finished Cakes have returned to the stock network.
|
||||
batchOutput = 16,
|
||||
},
|
||||
zinc_nuggets = {
|
||||
label = "576 ZINC NUGGETS", planner = "zinc_nuggets",
|
||||
@@ -165,13 +178,14 @@ local ACTION_ORDER = {
|
||||
"mixer_alloy", "mixer_cogwheel", "mixer_large_cogwheel",
|
||||
"casing_andesite", "casing_copper", "casing_brass", "casing_railway", "precision_mechanism",
|
||||
"press_gold", "press_iron", "press_copper", "press_brass", "press_zinc", "press_steel",
|
||||
"press_blaze_cake_base",
|
||||
"press_blaze_cake_base", "fill_blaze_cake",
|
||||
}
|
||||
|
||||
local KEEP_STOCK = {
|
||||
{ recipeId = "mixer_cogwheel", item = "create:cogwheel", target = 64 },
|
||||
{ recipeId = "mixer_large_cogwheel", item = "create:large_cogwheel", target = 64 },
|
||||
{ recipeId = "iron_nuggets", item = "minecraft:iron_nugget", target = 64 },
|
||||
{ recipeId = "fill_blaze_cake", item = "create:blaze_cake", target = 64 },
|
||||
}
|
||||
|
||||
local METAL_PLANS = {
|
||||
@@ -206,6 +220,7 @@ local PRODUCER_BY_ITEM = {
|
||||
["alltheores:steel_plate"] = "press_steel",
|
||||
["create:cinder_flour"] = "crush_netherrack",
|
||||
["create:blaze_cake_base"] = "press_blaze_cake_base",
|
||||
["create:blaze_cake"] = "fill_blaze_cake",
|
||||
}
|
||||
|
||||
local function epoch()
|
||||
@@ -670,19 +685,23 @@ local function dispatchNormal(job, missingOutput)
|
||||
local selectedStation = chooseStation(recipe, job)
|
||||
if not selectedStation then job.status = "WAITING" return false end
|
||||
|
||||
-- Some processes have a hard per-package limit. Blaze Cake production is
|
||||
-- capped at 16 because Eggs only stack to 16. The overall job may still
|
||||
-- target 64 and is continued batch by batch by updateNormal().
|
||||
local plannedOutput = math.min(missingOutput, recipe.batchOutput or missingOutput)
|
||||
local inputPlan = {}
|
||||
if recipe.inputs then
|
||||
local outputCount = math.max(1, recipe.outputCount or 1)
|
||||
for _, ingredient in ipairs(recipe.inputs) do
|
||||
inputPlan[#inputPlan + 1] = {
|
||||
item = ingredient.item,
|
||||
count = math.ceil(missingOutput * ingredient.count / outputCount),
|
||||
count = math.ceil(plannedOutput * ingredient.count / outputCount),
|
||||
}
|
||||
end
|
||||
else
|
||||
local desiredInput
|
||||
if recipe.completion == "activity" then desiredInput = recipe.inputCount
|
||||
else desiredInput = math.ceil(missingOutput / (recipe.outputCount / recipe.inputCount)) end
|
||||
else desiredInput = math.ceil(plannedOutput / (recipe.outputCount / recipe.inputCount)) end
|
||||
inputPlan[1] = { item = recipe.input, count = desiredInput }
|
||||
end
|
||||
|
||||
@@ -717,6 +736,8 @@ local function dispatchNormal(job, missingOutput)
|
||||
|
||||
job.lastBatchInputs = sentInputs
|
||||
job.lastBatchInput = nil
|
||||
job.batchStartProgress = recipe.output and produced(job, recipe.output) or nil
|
||||
job.batchExpectedOutput = recipe.batchOutput and plannedOutput or nil
|
||||
job.activeStation, job.status = selectedStation, "RUNNING"
|
||||
job.waitingFor, job.dependencyJobId, job.lastDependencyLog = nil, nil, nil
|
||||
clearMEWait(job)
|
||||
@@ -738,6 +759,8 @@ end
|
||||
|
||||
local function updateNormal(job)
|
||||
local recipe = RECIPES[job.recipeId]
|
||||
local completionDrainSeconds = recipe.completionDrainSeconds
|
||||
if completionDrainSeconds == nil then completionDrainSeconds = DRAIN_SECONDS end
|
||||
local watched = recipe.outputs or { recipe.output }
|
||||
observeItems(job, watched)
|
||||
if recipe.completion == "activity" then
|
||||
@@ -749,7 +772,7 @@ local function updateNormal(job)
|
||||
for _, item in ipairs(watched) do total = total + produced(job, item) end
|
||||
job.progress = total
|
||||
if total > 0 and job.status ~= "DRAINING" then beginDrain(job) end
|
||||
if job.status == "DRAINING" and epoch() - job.lastProgressAt >= DRAIN_SECONDS then finishJob(job)
|
||||
if job.status == "DRAINING" and epoch() - job.lastProgressAt >= completionDrainSeconds then finishJob(job)
|
||||
elseif job.status == "RUNNING" and epoch() - job.lastProgressAt >= DRAIN_SECONDS then retryOrFail(job, 1, "Kein Output angekommen") end
|
||||
return
|
||||
end
|
||||
@@ -758,7 +781,16 @@ local function updateNormal(job)
|
||||
local missing = math.max(0, job.targetCount - current)
|
||||
if missing <= 0 then
|
||||
if job.status ~= "DRAINING" then beginDrain(job) end
|
||||
if epoch() - job.lastProgressAt >= DRAIN_SECONDS then finishJob(job) end
|
||||
if epoch() - job.lastProgressAt >= completionDrainSeconds then finishJob(job) end
|
||||
return
|
||||
end
|
||||
if recipe.batchOutput and job.status == "RUNNING"
|
||||
and current >= (job.batchStartProgress or 0) + (job.batchExpectedOutput or recipe.batchOutput) then
|
||||
job.activeStation, job.status = nil, "WAITING"
|
||||
job.batchStartProgress, job.batchExpectedOutput = nil, nil
|
||||
job.phaseStartedAt, job.lastProgressAt, job.warned = epoch(), epoch(), false
|
||||
logEvent("#" .. job.id .. " Charge fertig; Rest " .. formatNumber(missing), colors.cyan)
|
||||
saveState()
|
||||
return
|
||||
end
|
||||
if job.status == "WAITING" or job.status == "WAITING_INPUT" or job.status == "WAITING_ME" then dispatchNormal(job, missing)
|
||||
|
||||
Reference in New Issue
Block a user