fix: lastbil med eget lad vælges ikke som tømmevogn under høst (v1.62.19)

This commit is contained in:
2026-10-04 20:47:50 +02:00
parent f9c169ae46
commit a64a307ef8
3 changed files with 11 additions and 1 deletions
+9
View File
@@ -353,6 +353,13 @@ function ADFieldWork.distanceToNetworkUncached(adEnv, x, z)
return ok and best ~= math.huge and best or nil
end
-- Tømmevogn under høst: traktor med vogn eller puljevogn — ikke en lastbil med eget lad (Courseplays mejetærsker
-- registrerer den ikke som tømmevogn; in-game 4/10: Lizard-tiplastbilen holdt ved F5 uden at blive tømt i)
function ADFieldWork.unloaderAccepts(vehicle)
if vehicle == nil then return false end
return not (vehicle.spec_motorized ~= nil and vehicle.spec_trailer ~= nil)
end
local function acceptFor(field, info, role)
if role == "harvester" then
local fruit = info.fruitIndex
@@ -363,6 +370,8 @@ local function acceptFor(field, info, role)
return function(candidate)
return (candidate.hasSeeds or candidate.seedsOnPallets) and fruitIndex ~= nil and candidate.seedFruits[fruitIndex] == true
end
elseif role == "unloader" then
return function(candidate) return ADFieldWork.unloaderAccepts(candidate.vehicle) end
elseif role == "weeder" then
local large = (info.weed or 0) > ADFieldModel.WEED_MECHANICAL_MAX
return function(candidate) return not (large and candidate.mechanical) end