Synchronize dependency output handoff

This commit is contained in:
2026-07-18 21:37:39 +02:00
parent 5c3b092727
commit 090fec482a
2 changed files with 35 additions and 2 deletions
+5
View File
@@ -29,6 +29,11 @@ verwenden in ATM10 `alltheores:gold_plate`. Ihre lokalen Deployer-, Chute- und
Vault-Puffer werden durch Factory Gauges versorgt; der globale Keep-Stock fuellt
verbrauchte Cogwheels und Iron Nuggets parallel wieder auf.
V1.3.2 synchronisiert Vorauftrag und Hauptauftrag explizit: Das erzeugte Material
wird erst freigegeben, nachdem der Vorauftrag seine Ankunft registriert hat. So
kann ein nachfolgender Auftrag den neuen Bestand nicht mehr im selben Tick
wegnehmen und dadurch einen falschen Retry oder Fehler ausloesen.
## Create-Fabrik: Peripherie erkennen
Das rein lesende Diagnoseprogramm herunterladen und starten:
+30 -2
View File
@@ -1,7 +1,7 @@
-- ATM10 Create factory scheduler V1
-- Persistent jobs, dependency planning, progress-aware retries and diagnostics.
local VERSION = "1.3.1"
local VERSION = "1.3.2"
local REFRESH_SECONDS = 1
local CONFIRM_SECONDS = 6
local DRAIN_SECONDS = 60
@@ -97,7 +97,7 @@ local RECIPES = {
output = "create:railway_casing", outputCount = 64, targetCount = 64,
},
precision_mechanism = {
label = "16 GOLD SHEETS -> PRECISION", station = "precisionmechanism", address = "precisionmechanism",
label = "16 GOLD PLATES -> PRECISION", station = "precisionmechanism", address = "precisionmechanism",
input = "alltheores:gold_plate", inputCount = 16,
outputs = { "create:precision_mechanism" }, completion = "activity",
},
@@ -443,6 +443,33 @@ end
local newJob
local function dependencyReleased(job)
if not job.dependencyJobId then return true end
local dependency = findJobById(job.dependencyJobId)
if not dependency then
job.dependencyJobId, job.waitingFor = nil, nil
return true
end
if dependency.status == "FAILED" or dependency.status == "CANCELLED" then
failJob(job, "Vorauftrag #" .. dependency.id .. " fuer "
.. prettyItemName(job.waitingFor or "Input") .. " ist " .. dependency.status)
return false
end
-- The parent may consume the result as soon as the child has registered its
-- complete arrival. Waiting for the whole drain timer is unnecessary, but
-- releasing it before this point makes the parent hide the child's output.
local target = math.max(1, dependency.targetCount or 1)
local registered = (dependency.progress or 0) >= target
if dependency.status ~= "DONE" and not registered then
job.status, job.activeStation = "WAITING_INPUT", nil
return false
end
job.dependencyJobId, job.waitingFor, job.lastDependencyLog = nil, nil, nil
return true
end
local function waitForDependency(job, item, required)
local producerId = PRODUCER_BY_ITEM[item]
if not producerId or producerId == job.recipeId then
@@ -480,6 +507,7 @@ end
local function dispatchNormal(job, missingOutput)
local recipe = RECIPES[job.recipeId]
if not dependencyReleased(job) then return false end
local selectedStation = chooseStation(recipe, job)
if not selectedStation then job.status = "WAITING" return false end