fix: lange køretøjer godtages fremme ved halv længde fra markøren — 1.62.175
This commit is contained in:
@@ -166,8 +166,14 @@ function ADHitch.arriveDistanceFor(action, crept)
|
||||
end
|
||||
|
||||
-- state = {adActive, distance, speed, arriveDistance?} (arriveDistance: udvidet, når traktoren har bakket hen til vognen)
|
||||
-- lengthSlack: lange køretøjer (mejetærsker ~12 m) holder med midten længere fra markøren end en traktor (in-game 10/10:
|
||||
-- Mejetærsker 1 stod 6 m fra 'P Mejetærsker 2' -> 'stoppedAway')
|
||||
function ADHitch.lengthSlack(length)
|
||||
return math.max(0, (tonumber(length) or 0) / 2 - ADHitch.ARRIVE_DISTANCE)
|
||||
end
|
||||
|
||||
local function arriveDistanceOf(state)
|
||||
return state.arriveDistance or ADHitch.ARRIVE_DISTANCE
|
||||
return (state.arriveDistance or ADHitch.ARRIVE_DISTANCE) + (state.lengthSlack or 0)
|
||||
end
|
||||
|
||||
function ADHitch.hasArrived(state)
|
||||
@@ -292,6 +298,7 @@ local function vehicleState(adEnv, vehicle, markerId)
|
||||
local mode = module ~= nil and module.getMode ~= nil and module:getMode() or nil
|
||||
return {
|
||||
adActive = module ~= nil and module:isActive(),
|
||||
lengthSlack = ADHitch.lengthSlack(vehicle.size ~= nil and vehicle.size.length or 0),
|
||||
atLastWaypoint = atLastWaypoint,
|
||||
distance = distance,
|
||||
speed = vehicle.getLastSpeed ~= nil and vehicle:getLastSpeed() or 0,
|
||||
|
||||
Reference in New Issue
Block a user