fix: CP-bredde genberegnes før start; kontrakt køres igen til den er færdig (1.62.219)

This commit is contained in:
2026-10-10 19:38:33 +02:00
parent 0618dd64f5
commit 606d08ac57
6 changed files with 62 additions and 3 deletions
+15
View File
@@ -52,6 +52,21 @@ function ADContracts.preferLeased(candidates, isLeased)
return #leased > 0 and leased or candidates
end
-- Skal kontraktmarken køres igen? Courseplay kan melde færdig, før kontrakten er det (spillets markkant fandt kun en
-- del af marken, in-game 10/10 F40: 67 %). completion = mission:getCompletion() (1 = klar), passes = gentagelser.
ADContracts.MAX_PASSES = 3
function ADContracts.needsAnotherPass(completion, passes)
return type(completion) == "number" and completion < 0.999 and (passes or 0) < ADContracts.MAX_PASSES
end
-- Kontraktens fremdrift (0-1+, 1 = klar) eller nil.
function ADContracts.completionOf(field)
local mission = field ~= nil and field.contractMission or nil
if mission == nil or mission.getCompletion == nil then return nil end
local ok, value = pcall(mission.getCompletion, mission)
return ok and type(value) == "number" and value or nil
end
-- tracked/running = {[nøgle] = {fieldId, ...}} -> startede, afsluttede (lister {key, ...})
function ADContracts.diff(tracked, running)
local started, ended = {}, {}