feat: intet græsarbejde om vinteren; stillestående opsamler stoppes (v1.62.71)
This commit is contained in:
@@ -216,11 +216,13 @@ end
|
||||
function ADFieldJobs.decide(field, info, assignments, now, env)
|
||||
local hasMarker = info ~= nil and info.markerId ~= nil
|
||||
local raining = env ~= nil and env.raining == true
|
||||
local period = env ~= nil and env.period or nil
|
||||
local kind = field.kind or (info ~= nil and info.kind) or "mowable"
|
||||
if field.stage == "ready" then
|
||||
if not ADFieldModel.shouldStart(field) then return {action = "none"} end
|
||||
if not hasMarker then return {action = "wait"} end
|
||||
local first = ADFieldModel.workStages(field.plan, info.kind, info.needs)[1]
|
||||
if ADFieldModel.isOutOfSeason(first, period) then return {action = "wait", reason = "winter"} end
|
||||
if raining and first ~= nil and ADFieldModel.isWeatherSensitive(first, field.plan, info.kind) then
|
||||
return {action = "wait", reason = "rain"}
|
||||
end
|
||||
@@ -281,6 +283,7 @@ function ADFieldJobs.decide(field, info, assignments, now, env)
|
||||
end
|
||||
if not hasMarker then return {action = "wait"} end
|
||||
if (field.retryAt or 0) > now then return {action = "none"} end
|
||||
if ADFieldModel.isOutOfSeason(field.stage, period) then return {action = "wait", reason = "winter"} end
|
||||
if raining and ADFieldModel.isWeatherSensitive(field.stage, field.plan, kind) then
|
||||
return {action = "wait", reason = "rain"}
|
||||
end
|
||||
@@ -453,14 +456,23 @@ function ADFieldJobs.notify(text, critical)
|
||||
end)
|
||||
end
|
||||
|
||||
-- Vejret lige nu (regn), læst en gang pr. tick.
|
||||
-- Opsamler der står stille med Courseplay aktiv uden at blive fyldt så længe, har intet at samle op (in-game 7/10:
|
||||
-- F13's læssevogne stod stille i januar efter genindlæsning, og marken stod som "kører").
|
||||
ADFieldJobs.COLLECTOR_STALL_MS = 3 * 60 * 1000
|
||||
function ADFieldJobs.collectorStalled(s)
|
||||
return s.role == "collector" and type(s.stillMs) == "number" and s.stillMs >= ADFieldJobs.COLLECTOR_STALL_MS
|
||||
end
|
||||
|
||||
-- Vejret lige nu (regn) og årets periode, læst en gang pr. tick.
|
||||
function ADFieldJobs.environment()
|
||||
local ok, raining = pcall(function()
|
||||
local weather = g_currentMission.environment.weather
|
||||
return weather ~= nil and weather.getIsRaining ~= nil and weather:getIsRaining() or false
|
||||
end)
|
||||
local okPeriod, period = pcall(function() return g_currentMission.environment.currentPeriod end)
|
||||
return {
|
||||
raining = ok and raining == true,
|
||||
period = okPeriod and type(period) == "number" and period or nil,
|
||||
-- kan afgrøden (navn) sås i den aktuelle periode?
|
||||
plantable = function(name)
|
||||
local fruit = g_fruitTypeManager ~= nil and g_fruitTypeManager:getFruitTypeByName(name) or nil
|
||||
|
||||
Reference in New Issue
Block a user