fix(kobling): ankomst måles fra nærmeste led i sættet — bakker AD med vogn, ender vognen på markøren og traktoren et vognslæb væk (stoppedAway ved Bredal) (v1.47.4.0)
This commit is contained in:
@@ -142,10 +142,19 @@ end
|
|||||||
local function vehicleState(adEnv, vehicle, markerId)
|
local function vehicleState(adEnv, vehicle, markerId)
|
||||||
local module = stateModule(vehicle)
|
local module = stateModule(vehicle)
|
||||||
local wayPoint = adEnv.ADGraphManager:getWayPointById(markerId)
|
local wayPoint = adEnv.ADGraphManager:getWayPointById(markerId)
|
||||||
|
-- nærmeste led i sættet: bakker AD med vogn, er det vognen der ender på markøren, ikke traktoren
|
||||||
|
-- (in-game 28/9: vognen stod på Bredal, traktoren et vognslæb væk -> "stoppedAway")
|
||||||
local distance = math.huge
|
local distance = math.huge
|
||||||
if wayPoint ~= nil and vehicle.rootNode ~= nil then
|
local parts = {vehicle}
|
||||||
local x, _, z = getWorldTranslation(vehicle.rootNode)
|
if vehicle.getChildVehicles ~= nil then
|
||||||
distance = math.sqrt((x - wayPoint.x) ^ 2 + (z - wayPoint.z) ^ 2)
|
local ok, children = pcall(vehicle.getChildVehicles, vehicle)
|
||||||
|
if ok and children ~= nil then parts = children end
|
||||||
|
end
|
||||||
|
for _, part in pairs(parts) do
|
||||||
|
if wayPoint ~= nil and part.rootNode ~= nil then
|
||||||
|
local x, _, z = getWorldTranslation(part.rootNode)
|
||||||
|
distance = math.min(distance, math.sqrt((x - wayPoint.x) ^ 2 + (z - wayPoint.z) ^ 2))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
return {
|
return {
|
||||||
adActive = module ~= nil and module:isActive(),
|
adActive = module ~= nil and module:isActive(),
|
||||||
|
|||||||
@@ -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.47.3.0</version>
|
<version>1.47.4.0</version>
|
||||||
<title>
|
<title>
|
||||||
<en>AD Smart Pickup</en>
|
<en>AD Smart Pickup</en>
|
||||||
</title>
|
</title>
|
||||||
|
|||||||
Reference in New Issue
Block a user