fix: bak helt hen til vognen og kun til krog af samme type (v1.62.42)

This commit is contained in:
2026-10-06 15:08:46 +02:00
parent 6f50e3d2a1
commit b4a870fe20
3 changed files with 13 additions and 8 deletions
+1
View File
@@ -8,6 +8,7 @@ står i [docs/BRUGERMANUAL.md](docs/BRUGERMANUAL.md) (dansk) og [docs/USER_MANUA
## 1.62 — Kæder slås selv til ## 1.62 — Kæder slås selv til
- **1.62.42** Rettet: traktoren bakker nu helt hen til vognen (indtil spillet selv melder den inden for rækkevidde) og bruger kun en krog af samme type som vognens trækøje; før blev der ikke bakket under 3 m, og 2,9 m var for langt til at koble (Tippevogn 3, Læssevogn 5).
- **1.62.41** Nyt: *Tid mellem hver maskine der sendes ud* i markflåden (1, 5, 10, 15, 20, 30, 45 eller 60 s; standard nu 15 s, før fast 10 s), gemt pr. savegame. - **1.62.41** Nyt: *Tid mellem hver maskine der sendes ud* i markflåden (1, 5, 10, 15, 20, 30, 45 eller 60 s; standard nu 15 s, før fast 10 s), gemt pr. savegame.
- **1.62.40** Rettet: traktoren bakker nu op til 12 m (før 8 m) hen til et puljeredskab — AutoDrive holdt 9–10 m før vognen (River 1, Plov 1), og så blev der ikke bakket. - **1.62.40** Rettet: traktoren bakker nu op til 12 m (før 8 m) hen til et puljeredskab — AutoDrive holdt 9–10 m før vognen (River 1, Plov 1), og så blev der ikke bakket.
- **1.62.39** Tilbage: turen via båsens bak-stik er slået fra. Bak-kanten er kun ca. 1,5 m, og bagefter kørte AutoDrive fremad igen, så traktoren kom næsen først frem til vognen. Uden omvejen ankommer den oftest baglæns og bakker selv det sidste stykke. - **1.62.39** Tilbage: turen via båsens bak-stik er slået fra. Bak-kanten er kun ca. 1,5 m, og bagefter kørte AutoDrive fremad igen, så traktoren kom næsen først frem til vognen. Uden omvejen ankommer den oftest baglæns og bakker selv det sidste stykke.
+11 -7
View File
@@ -6,7 +6,9 @@
ADHitchCreep = {} ADHitchCreep = {}
ADHitchCreep.LOG_PREFIX = "ADSmartPickup: kobling: " ADHitchCreep.LOG_PREFIX = "ADSmartPickup: kobling: "
ADHitchCreep.ROOMY_ATTACH_DISTANCE = 3 -- m: herinden for kobler ADHitch direkte (samme som ADHitch.ROOMY_ATTACH_DISTANCE) ADHitchCreep.ROOMY_ATTACH_DISTANCE = 3 -- m: ADHitch's rummelige koblingsforsøg (samme som ADHitch.ROOMY_ATTACH_DISTANCE)
-- Kun så tæt kobles uden at bakke: 2,9 m var for langt for spillet (in-game 6/10: Tippevogn 3 og Læssevogn 5)
ADHitchCreep.DIRECT_ATTACH_DISTANCE = 1.0
ADHitchCreep.CREEP_MAX_DISTANCE = 12 -- m: længere væk end det bakkes ikke (in-game 6/10: AD holdt 9-10 m før River 1 / Plov 1) ADHitchCreep.CREEP_MAX_DISTANCE = 12 -- m: længere væk end det bakkes ikke (in-game 6/10: AD holdt 9-10 m før River 1 / Plov 1)
ADHitchCreep.CREEP_MAX_LATERAL = 1.5 -- m til siden: mere end det rammer en lige bakning ikke trækøjet ADHitchCreep.CREEP_MAX_LATERAL = 1.5 -- m til siden: mere end det rammer en lige bakning ikke trækøjet
ADHitchCreep.CREEP_TIMEOUT_MS = 35000 ADHitchCreep.CREEP_TIMEOUT_MS = 35000
@@ -20,7 +22,7 @@ ADHitchCreep.RANGE_CHECK_MS = 250
function ADHitchCreep.plan(offset) function ADHitchCreep.plan(offset)
if offset == nil then return "none" end if offset == nil then return "none" end
local distance = math.sqrt(offset.x ^ 2 + offset.z ^ 2) local distance = math.sqrt(offset.x ^ 2 + offset.z ^ 2)
if distance <= ADHitchCreep.ROOMY_ATTACH_DISTANCE then return "attach" end if distance <= ADHitchCreep.DIRECT_ATTACH_DISTANCE then return "attach" end
if offset.z >= 0 or distance > ADHitchCreep.CREEP_MAX_DISTANCE or math.abs(offset.x) > ADHitchCreep.CREEP_MAX_LATERAL then if offset.z >= 0 or distance > ADHitchCreep.CREEP_MAX_DISTANCE or math.abs(offset.x) > ADHitchCreep.CREEP_MAX_LATERAL then
return "none" return "none"
end end
@@ -60,7 +62,7 @@ local function freeRearJoints(vehicle)
if not used[index] and joint.jointTransform ~= nil then if not used[index] and joint.jointTransform ~= nil then
local p = worldPos(joint.jointTransform) local p = worldPos(joint.jointTransform)
local _, _, lz = worldToLocal(vehicle.rootNode, p.x, p.y, p.z) local _, _, lz = worldToLocal(vehicle.rootNode, p.x, p.y, p.z)
if lz < 0 then table.insert(joints, joint.jointTransform) end if lz < 0 then table.insert(joints, {node = joint.jointTransform, jointType = joint.jointType}) end
end end
end end
return joints return joints
@@ -87,12 +89,14 @@ function ADHitchCreep.findTarget(vehicle)
for _, input in ipairs(attachable.inputAttacherJoints) do for _, input in ipairs(attachable.inputAttacherJoints) do
if input.node ~= nil then if input.node ~= nil then
for _, joint in ipairs(joints) do for _, joint in ipairs(joints) do
local offset = offsetOf(vehicle, joint, input.node) if input.jointType == nil or joint.jointType == nil or input.jointType == joint.jointType then
local offset = offsetOf(vehicle, joint.node, input.node)
local distance = math.sqrt(offset.x ^ 2 + offset.z ^ 2) local distance = math.sqrt(offset.x ^ 2 + offset.z ^ 2)
if distance < bestDistance and distance <= ADHitchCreep.CREEP_MAX_DISTANCE + 2 then if distance < bestDistance and distance <= ADHitchCreep.CREEP_MAX_DISTANCE + 2 then
bestDistance = distance bestDistance = distance
best = {wagon = object, joint = joint, target = input.node, offset = offset} best = {wagon = object, joint = joint.node, target = input.node, offset = offset}
end end
end
end end
end end
end end
@@ -105,7 +109,7 @@ end
local function isInRange(vehicle, wagon) local function isInRange(vehicle, wagon)
local spec = vehicle.spec_attacherJoints local spec = vehicle.spec_attacherJoints
if spec == nil or AttacherJoints == nil or AttacherJoints.updateVehiclesInAttachRange == nil then return false end if spec == nil or AttacherJoints == nil or AttacherJoints.updateVehiclesInAttachRange == nil then return false end
AttacherJoints.updateVehiclesInAttachRange(vehicle, ADHitchCreep.ROOMY_ATTACH_DISTANCE ^ 2, AttacherJoints.MAX_ATTACH_ANGLE, true) AttacherJoints.updateVehiclesInAttachRange(vehicle, AttacherJoints.MAX_ATTACH_DISTANCE_SQ, AttacherJoints.MAX_ATTACH_ANGLE, true)
local info = spec.attachableInfo local info = spec.attachableInfo
return info ~= nil and info.attachable == wagon return info ~= nil and info.attachable == wagon
end end
@@ -150,7 +154,7 @@ function CreepTask:update(dt)
self.checkMs = 0 self.checkMs = 0
self.inRange = isInRange(self.vehicle, self.target.wagon) self.inRange = isInRange(self.vehicle, self.target.wagon)
end end
local action = ADHitchCreep.step({inRange = self.inRange, distance = distance, startDistance = self.startDistance, local action = ADHitchCreep.step({inRange = self.inRange or distance <= ADHitchCreep.DIRECT_ATTACH_DISTANCE, distance = distance, startDistance = self.startDistance,
elapsedMs = self.elapsedMs, passed = offset.z > 0.5}) elapsedMs = self.elapsedMs, passed = offset.z > 0.5})
if action ~= "drive" then return self:finish(action, distance) end if action ~= "drive" then return self:finish(action, distance) end
+1 -1
View File
@@ -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.62.41.0</version> <version>1.62.42.0</version>
<title> <title>
<en>AD Smart Pickup</en> <en>AD Smart Pickup</en>
</title> </title>