fix(fields): vin og oliven er aldrig slåafgrøder (et mod satte druer på MOWER-listen → F22 fik 'Silage + så' og en skårlægger) (v1.60.2.0)
This commit is contained in:
@@ -102,6 +102,16 @@ function ADFields.soilNeeds(levels, settings)
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Vin og oliven høstes med egen høster — aldrig slåafgrøder, selv om et mod har sat dem på MOWER-listen
|
||||||
|
-- (in-game 29/9: F22 hvide druer fik "Silage + så" og en skårlægger). Samme liste som ADCpBridge.VINE_FRUITS.
|
||||||
|
ADFields.VINE_FRUITS = {GRAPE = true, GRAPEB = true, OLIVE = true, OLIVEB = true}
|
||||||
|
|
||||||
|
-- fruitName + indgangen fra getMowable() (nil = ikke på listen) -> slåbar?
|
||||||
|
function ADFields.isMowableFruit(fruitName, mowableEntry)
|
||||||
|
if mowableEntry == nil then return false end
|
||||||
|
return not ADFields.VINE_FRUITS[string.upper(tostring(fruitName or ""))]
|
||||||
|
end
|
||||||
|
|
||||||
function ADFields.getMowable()
|
function ADFields.getMowable()
|
||||||
if ADFields.mowable ~= nil then return ADFields.mowable end
|
if ADFields.mowable ~= nil then return ADFields.mowable end
|
||||||
local ok, result = pcall(function()
|
local ok, result = pcall(function()
|
||||||
@@ -465,6 +475,8 @@ end
|
|||||||
local function finishScan(adEnv, scan)
|
local function finishScan(adEnv, scan)
|
||||||
local info = scan.info
|
local info = scan.info
|
||||||
local mowable = info.fruitIndex ~= nil and ADFields.getMowable()[info.fruitIndex] or nil
|
local mowable = info.fruitIndex ~= nil and ADFields.getMowable()[info.fruitIndex] or nil
|
||||||
|
local fruitDesc = info.fruitIndex ~= nil and g_fruitTypeManager ~= nil and g_fruitTypeManager:getFruitTypeByIndex(info.fruitIndex) or nil
|
||||||
|
if mowable ~= nil and not ADFields.isMowableFruit(fruitDesc ~= nil and fruitDesc.name or nil, mowable) then mowable = nil end
|
||||||
if mowable ~= nil then
|
if mowable ~= nil then
|
||||||
info.mowable, info.windrow, info.hay = true, mowable.windrow, mowable.hay
|
info.mowable, info.windrow, info.hay = true, mowable.windrow, mowable.hay
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||||
<modDesc descVersion="107">
|
<modDesc descVersion="107">
|
||||||
<author>masterdraco</author>
|
<author>masterdraco</author>
|
||||||
<version>1.60.1.0</version>
|
<version>1.60.2.0</version>
|
||||||
<title>
|
<title>
|
||||||
<en>AD Smart Pickup</en>
|
<en>AD Smart Pickup</en>
|
||||||
</title>
|
</title>
|
||||||
|
|||||||
@@ -88,5 +88,11 @@ check("jord: sået", cls(6), "false|false")
|
|||||||
check("jord: ukendt værdi", cls(nil), "nil|nil")
|
check("jord: ukendt værdi", cls(nil), "nil|nil")
|
||||||
groundValues.NONE = 0
|
groundValues.NONE = 0
|
||||||
check("jord: ingen markjord tæller ikke med", cls(0), "nil|nil")
|
check("jord: ingen markjord tæller ikke med", cls(0), "nil|nil")
|
||||||
|
-- vin/oliven er aldrig slåafgrøder, selv om et mod har sat dem på MOWER-listen (in-game 29/9: F22 hvide druer fik
|
||||||
|
-- planen "Silage + så" og en skårlægger sendt ud)
|
||||||
|
check("vin: druer ikke slåbare", ADFields.isMowableFruit("GRAPE", {windrow = "GRASS_WINDROW"}), false)
|
||||||
|
check("vin: oliven ikke slåbare", ADFields.isMowableFruit("oliveb", {windrow = "X"}), false)
|
||||||
|
check("græs slåbart", ADFields.isMowableFruit("GRASS", {windrow = "GRASS_WINDROW"}), true)
|
||||||
|
check("ikke på MOWER-listen", ADFields.isMowableFruit("WHEAT", nil), false)
|
||||||
print(failures == 0 and "\nALLE TESTS OK" or ("\n" .. failures .. " FEJL"))
|
print(failures == 0 and "\nALLE TESTS OK" or ("\n" .. failures .. " FEJL"))
|
||||||
os.exit(failures == 0 and 0 or 1)
|
os.exit(failures == 0 and 0 or 1)
|
||||||
|
|||||||
Reference in New Issue
Block a user