1
Fork 0
mirror of https://github.com/thegeneralist01/Scene-Manager-DevRepo synced 2026-01-11 15:40:29 +01:00

Adjusted distance check to nearest waypoint when dismissed.

This commit is contained in:
Rich Dunne 2020-09-13 04:49:52 -06:00
parent d6fd840333
commit 8c3752a483

View file

@ -60,6 +60,7 @@ namespace SceneManager
_stoppedAtWaypoint = false; _stoppedAtWaypoint = false;
_driver.Tasks.Clear(); _driver.Tasks.Clear();
_driver.Tasks.PerformDrivingManeuver(_vehicle, VehicleManeuver.GoForwardWithCustomSteeringAngle, 3);
if (_driver.GetAttachedBlip()) if (_driver.GetAttachedBlip())
{ {
@ -70,7 +71,7 @@ namespace SceneManager
var nearestCollectorWaypoint = _path.Waypoints.Where(wp => wp.IsCollector && _vehicle.DistanceTo2D(wp.Position) <= wp.CollectorRadius * 2).FirstOrDefault(); var nearestCollectorWaypoint = _path.Waypoints.Where(wp => wp.IsCollector && _vehicle.DistanceTo2D(wp.Position) <= wp.CollectorRadius * 2).FirstOrDefault();
if (nearestCollectorWaypoint != null) if (nearestCollectorWaypoint != null)
{ {
while (nearestCollectorWaypoint != null && _vehicle && _driver && _vehicle.DistanceTo2D(nearestCollectorWaypoint.Position) <= nearestCollectorWaypoint.CollectorRadius * 2.5) while (nearestCollectorWaypoint != null && _vehicle && _driver && _vehicle.DistanceTo2D(nearestCollectorWaypoint.Position) <= nearestCollectorWaypoint.CollectorRadius * 2)
{ {
//Game.LogTrivial($"{_vehicle.Model.Name} is too close to the collector to be fully dismissed."); //Game.LogTrivial($"{_vehicle.Model.Name} is too close to the collector to be fully dismissed.");
GameFiber.Yield(); GameFiber.Yield();