feat(ui): Flows-oprydning — tavle grupperet Ind/Ud efter navn, traktorer: egne+ledige (Vis alle), bygninger: valgte først, uden markør skjult (Vis alle); fix: staldes foderkrybbe (feedingTrough) i stationsopslag og bygningsmarkører — hønsehus (v1.19.0.0)
This commit is contained in:
@@ -189,8 +189,9 @@ end
|
||||
-- B-COOP: hønsehus — foder aflæsses i den ene ende, æg-paller spawnes i den anden (ingen læssestation)
|
||||
do
|
||||
local coop = placeable("coop1", "Chicken Coop", 10000, 0, {getHusbandryFillLevel = function() return 0 end,
|
||||
spec_husbandryFood = {feedingTrough = {exactFillRootNode = {x = 9970, z = 0}}},
|
||||
spec_husbandryPallets = {fillTypeIndexToPalletSpawner = {[99] = {spawnPlaces = {{startNode = {x = 10030, z = 0}}}}}}})
|
||||
table.insert(unloadStations, {owningPlaceable = coop, unloadTriggers = {{exactFillRootNode = {x = 9970, z = 0}}}})
|
||||
table.insert(unloadStations, {owningPlaceable = coop, unloadTriggers = {}}) -- som chickenBarnBig: tom station
|
||||
addMarker(61, "Chicken Food", "Chicken", 9965, 0)
|
||||
addMarker(62, "Egg Pickup", "Chicken", 10035, 0)
|
||||
ADBuildings.invalidate()
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
-- Kør: luajit tests/test_adFlowView.lua (fra repo-roden)
|
||||
-- Ren oprydning af Flows-fanen: tavlens rækkefølge, hvilke traktorer og bygninger der vises.
|
||||
|
||||
dofile("FS25_ADSmartPickup/adFlowView.lua")
|
||||
local V = ADFlowView
|
||||
|
||||
local failures = 0
|
||||
local function check(name, actual, expected)
|
||||
if actual == expected then
|
||||
print("OK " .. name)
|
||||
else
|
||||
failures = failures + 1
|
||||
print(string.format("FAIL %s: forventede %s, fik %s", name, tostring(expected), tostring(actual)))
|
||||
end
|
||||
end
|
||||
local function ids(list, field)
|
||||
local out = {}
|
||||
for _, item in ipairs(list) do table.insert(out, tostring(item[field or "id"])) end
|
||||
return table.concat(out, ",")
|
||||
end
|
||||
|
||||
-- FV1: tavlen — forsyning (Ind) først, så udkørsel (Ud); hver gruppe sorteret efter navn (naturligt)
|
||||
local runs = {
|
||||
{id = 1, name = "Pig Food", kind = "supply"},
|
||||
{id = 2, name = "Milk Sale", kind = "outbound"},
|
||||
{id = 3, name = "Cow Food", kind = "supply"},
|
||||
{id = 4, name = "Biogas 10", kind = "supply"},
|
||||
{id = 5, name = "Biogas 9", kind = "supply"},
|
||||
{id = 6, name = "Digestate", kind = "outbound"},
|
||||
}
|
||||
local groups = V.boardGroups(runs)
|
||||
check("FV1 to grupper", #groups, 2)
|
||||
check("FV1 Ind først", groups[1].kind, "supply")
|
||||
check("FV1 Ind sorteret (Biogas 9 før 10)", ids(groups[1].runs), "5,4,3,1")
|
||||
check("FV1 Ud sorteret", ids(groups[2].runs), "6,2")
|
||||
check("FV1 samlet rækkefølge til vælgeren", ids(V.orderedRuns(runs)), "5,4,3,1,6,2")
|
||||
check("FV1 tom gruppe udelades", #V.boardGroups({{id = 1, name = "A", kind = "supply"}}), 1)
|
||||
|
||||
-- FV2: traktorer — egne først, så ledige brugbare; andre flows og låste kun med "vis alle"
|
||||
local vehicles = {
|
||||
{id = "a", label = "Zetor", state = "free"},
|
||||
{id = "b", label = "Fendt", state = "in"},
|
||||
{id = "c", label = "Case", state = "other"},
|
||||
{id = "d", label = "Claas", state = "blocked"},
|
||||
{id = "e", label = "Deutz", state = "free"},
|
||||
}
|
||||
check("FV2 standard: egne + ledige, sorteret", ids(V.vehicleRows(vehicles, false)), "b,e,a")
|
||||
check("FV2 vis alle: + andre flows + låste til sidst", ids(V.vehicleRows(vehicles, true)), "b,e,a,c,d")
|
||||
check("FV2 antal skjulte", V.hiddenCount(vehicles, V.vehicleRows(vehicles, false)), 2)
|
||||
|
||||
-- FV3: bygninger — valgte først; uden markør skjult medmindre valgt eller "vis alle"
|
||||
local buildings = {
|
||||
{id = "s2", name = "Silo 2", hasMarker = true},
|
||||
{id = "s10", name = "Silo 10", hasMarker = true},
|
||||
{id = "x", name = "Gammel lade", hasMarker = false},
|
||||
{id = "y", name = "Anden uden", hasMarker = false},
|
||||
{id = "a", name = "Anlæg", hasMarker = true},
|
||||
}
|
||||
local chosen = {s10 = true, y = true}
|
||||
check("FV3 standard: valgte først, så med markør", ids(V.buildingRows(buildings, chosen, false)), "y,s10,a,s2")
|
||||
check("FV3 vis alle: uden markør til sidst", ids(V.buildingRows(buildings, chosen, true)), "y,s10,a,s2,x")
|
||||
|
||||
print(failures == 0 and "\nALLE TESTS OK" or ("\n" .. failures .. " FEJL"))
|
||||
os.exit(failures == 0 and 0 or 1)
|
||||
@@ -1259,5 +1259,22 @@ check("X3 Wait-logik springer udkørsel over", okWait, true)
|
||||
FS25_AutoDrive.AutoDrive.getAllDischargeableUnits = originalUnits
|
||||
ADOutbound = nil
|
||||
|
||||
-- FT: hønsehus — foderkrybben (spec_husbandryFood.feedingTrough) står ikke i aflæsningsstationens
|
||||
-- unloadTriggers; stationsopslaget ved markøren skal alligevel finde hønsehuset
|
||||
do
|
||||
local coop = {getHusbandryFillLevel = function() return 0 end, getName = function() return "Chicken Coop" end,
|
||||
spec_husbandryFood = {feedingTrough = {exactFillRootNode = 9901}}}
|
||||
nodePositions[9901] = {x = 20000, z = 3}
|
||||
local coopStation = {owningPlaceable = coop, unloadTriggers = {}}
|
||||
table.insert(unloadStations, coopStation)
|
||||
g_currentMission.placeableSystem = {placeables = {coop}}
|
||||
ADSmartPickup.invalidateUnloadCandidates()
|
||||
addMarker(95, "Chicken 1 food", "Chicken", 20000, 10)
|
||||
local found = ADSmartPickup.getUnloadStationAtWayPointId(FS25_AutoDrive, 95, 1)
|
||||
check("FT krybbe findes via markøren", found ~= nil and found.owningPlaceable == coop, true)
|
||||
g_currentMission.placeableSystem = nil
|
||||
ADSmartPickup.invalidateUnloadCandidates()
|
||||
end
|
||||
|
||||
print(failures == 0 and "\nALLE TESTS OK" or ("\n" .. failures .. " FEJL"))
|
||||
os.exit(failures == 0 and 0 or 1)
|
||||
|
||||
Reference in New Issue
Block a user