fix: egen gylle sælges ved oprydning når gylle som gødning er fra (1.62.372)

This commit is contained in:
2026-10-19 12:08:46 +02:00
parent 686e52ed96
commit 109ba7eb35
5 changed files with 20 additions and 5 deletions
+14 -2
View File
@@ -56,6 +56,15 @@ end
-- Delvis tømning (spillerens efterladte vogn, AD-tur ved fuldt mål): mindst så meget fri plads i lageret
ADFlowWagons.PARTIAL_DUMP_MIN = 20000
-- Må lasten sælges ved oprydning? Alt andet end en udbringers last: ja. En udbringers last: kun gårdens egen gylle/
-- digestat/møg, og kun når "Gylle som gødning" er slået fra (brugerønske 19/10 12:07: "den skal bare sælge det så længe
-- optionen med sælg alt gylle er slået til — hvis vi brugte det til gødning på marken ville det være en anden sag").
-- s = {applicator, ownProduct, slurryFertilizer}
function ADFlowWagons.mayBeSold(s)
if not s.applicator then return true end
return s.ownProduct == true and s.slurryFertilizer ~= true
end
-- Glem traktorens vogn: ny tabel uden den.
function ADFlowWagons.forget(wagons, tractorId)
if (wagons or {})[tractorId] == nil then return wagons end
@@ -702,8 +711,11 @@ local function startDump(adEnv, vehicle, state)
local okUnits, units = pcall(adEnv.AutoDrive.getAllDischargeableUnits, vehicle)
for _, unit in ipairs(okUnits and units or {}) do table.insert(implements, unit.object) end
for _, implement in ipairs(ADHitch.directImplementsOf(vehicle)) do table.insert(implements, implement.object) end
local applicator = ADFlowWagons.isApplicatorSet(implements)
if (not ok or marker == nil) and applicator then
local fillTypeName = g_fillTypeManager ~= nil and fillType ~= nil and g_fillTypeManager:getFillTypeNameByIndex(fillType) or nil
local ownProduct = ADFieldFertilizer ~= nil and ADFieldFertilizer.OWN_FILL_TYPES ~= nil and ADFieldFertilizer.OWN_FILL_TYPES[fillTypeName] == true
local sellable = ADFlowWagons.mayBeSold({applicator = ADFlowWagons.isApplicatorSet(implements), ownProduct = ownProduct,
slurryFertilizer = ADFieldFertilizer ~= nil and ADFieldFertilizer.isEnabled ~= nil and ADFieldFertilizer.isEnabled()})
if (not ok or marker == nil) and not sellable then
why = "udbringerens last sælges ikke"
elseif (not ok or marker == nil) and ADFieldWork.findSaleMarker ~= nil then
local okAny, anyStore = pcall(ADLoadSwap.anyStoreAccepts, adEnv, vehicle, fillType, nil)