Stephan-S / FS22_AutoDrive

FS22 version of the AutoDrive mod
581 stars 107 forks source link

Autodrive does not wait for bunker silo unloading to finish (with quick fix) #928

Open cyr123 opened 1 year ago

cyr123 commented 1 year ago

I found that when I have multiple vehicles queued up to unload into a bunker they will not wait for but instead proceed to back into the bunker and block, crash into and/or dump chaff onto the one currently unloading.

They will wait while the vehicle in front backs into the bunker, but then start to drive again once the unloading starts. I had a quick poke around the code and found that this is because the collision check that looks to see if the path ahead is free looks at the current waypoint of the other vehicles, and once a vehicle reaches the bunker and starts to unload the waypoint list is cleared and the vehicle becomes "invisible" to other vehicles.

As a quick fix I commented out two lines in DrivePathModule.lua:

function ADDrivePathModule:reachedTarget()
    self.atTarget = true
--    self.wayPoints = nil
--    self.currentWayPoint = 0
end

This appears to fix the problem, but I'm sure it will have other consequences.

Iwan1803 commented 1 year ago

No screenshots of the AD settings and the bunker route, no information about distributed unloading and how many vehicles are active....

cyr123 commented 1 year ago

Apologies, here are screenshots with hopefully all that's needed. The route is just a single reverse-in, drive-out route and I just used two tractors for testing. I've used two-way (blue) segments but I also tried reverse (cyan) segments all the way into the bunker with the same result.

When the unloading tractor is driving (reverse or forward) the second one does stop, just not during the actual unload. This makes sense from my (limited) understanding of the code.

mpv-shot0011

mpv-shot0012

mpv-shot0013

mpv-shot0014

mpv-shot0015

mpv-shot0016

mpv-shot0017

mpv-shot0018

mpv-shot0019

mpv-shot0021

mpv-shot0023

mpv-shot0024

mpv-shot0025

mpv-shot0026

mpv-shot0027

mpv-shot0029

mpv-shot0032

cyr123 commented 1 year ago

I realize the area is a bit "messy" with other routes making it hard to see but it's pretty straight forward, the incoming route connects to the bidirectional path with a reverse (cyan) segment at the same node as the outgoing path connects to it.

Iwan1803 commented 1 year ago

I would suggest 2 Lines and distributed unloading, maybe with smaller trailers. Removing lines could cause problems in other situations, but @Axel32019 should check this.

cyr123 commented 1 year ago

I may look into another way to make the unloading vehicle keep the path "reserved" for the purpose of collision checking without affecting anything else.

Thank you to the devs for this awesome mod BTW, it has some "quirks" shall we say but it still allows us to do some awesome stuff in the game that wouldn't be possible otherwise.