fix(pulje): traktor med redskab på sin egen parkering er et parkeret sæt, ikke forældreløs (vinmarks-REX blev skilt ad) (v1.60.7.0)
This commit is contained in:
@@ -52,8 +52,10 @@ end
|
||||
|
||||
-- Påkobling uden ejer (hentet før genindlæsning, markopgaven tabt): s = {owned, idleMs} -> "home"|"wait"|"none"
|
||||
ADFlowWagons.ORPHAN_MS = 120000
|
||||
-- s.atOwnPark: traktoren holder på sin egen parkering = parkeret sæt, ikke forældreløs (vinmarks-REX, 29/9)
|
||||
ADFlowWagons.OWN_PARK_M = 30
|
||||
function ADFlowWagons.orphanAction(s)
|
||||
if s.owned then return "none" end
|
||||
if s.owned or s.atOwnPark then return "none" end
|
||||
return (s.idleMs or 0) >= ADFlowWagons.ORPHAN_MS and "home" or "wait"
|
||||
end
|
||||
|
||||
@@ -504,7 +506,14 @@ local function tickOrphans(adEnv, elapsed)
|
||||
local owned = (module ~= nil and module:isActive()) or (vehicle.getIsControlled ~= nil and vehicle:getIsControlled())
|
||||
or (run ~= nil and not run.stopped) or (ADFieldJobs ~= nil and id ~= nil and ADFieldJobs.state.assignments[id] ~= nil)
|
||||
or (ADCpBridge ~= nil and ADCpBridge.isWorking(vehicle)) or #ADHitch.rearImplementsOf(vehicle) == 0
|
||||
local action = ADFlowWagons.orphanAction({owned = owned, idleMs = idle + elapsed})
|
||||
local atOwnPark = false
|
||||
local parkId = ADFieldWork ~= nil and ADFieldWork.parkMarkerId ~= nil and ADFieldWork.parkMarkerId(adEnv, vehicle) or nil
|
||||
local parkWp = parkId ~= nil and adEnv.ADGraphManager:getWayPointById(parkId) or nil
|
||||
if parkWp ~= nil and vehicle.rootNode ~= nil then
|
||||
local x, _, z = getWorldTranslation(vehicle.rootNode)
|
||||
atOwnPark = (x - parkWp.x) ^ 2 + (z - parkWp.z) ^ 2 <= ADFlowWagons.OWN_PARK_M ^ 2
|
||||
end
|
||||
local action = ADFlowWagons.orphanAction({owned = owned, atOwnPark = atOwnPark, idleMs = idle + elapsed})
|
||||
if action == "none" then
|
||||
orphans[vehicle] = nil
|
||||
elseif action == "home" then
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<modDesc descVersion="107">
|
||||
<author>masterdraco</author>
|
||||
<version>1.60.6.0</version>
|
||||
<version>1.60.7.0</version>
|
||||
<title>
|
||||
<en>AD Smart Pickup</en>
|
||||
</title>
|
||||
|
||||
@@ -124,5 +124,7 @@ check("husk ikke ved oprydning efter indlæsning", W.shouldRememberOnHome("after
|
||||
check("forældreløs: ingen ejer, længe nok -> hjem", W.orphanAction({owned = false, idleMs = W.ORPHAN_MS}), "home")
|
||||
check("forældreløs: har ejer -> intet", W.orphanAction({owned = true, idleMs = W.ORPHAN_MS}), "none")
|
||||
check("forældreløs: for kort tid -> vent", W.orphanAction({owned = false, idleMs = 1000}), "wait")
|
||||
-- parkeret sæt på traktorens egen plads er ikke forældreløst (in-game 29/9: vinmarks-REX blev skilt ad)
|
||||
check("forældreløs: står på egen parkering -> intet", W.orphanAction({owned = false, atOwnPark = true, idleMs = W.ORPHAN_MS}), "none")
|
||||
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