mirror of
https://github.com/thegeneralist01/Scene-Manager-DevRepo
synced 2026-01-11 15:40:29 +01:00
Added function to loop while the path exists checking for vehicles which need to be dismissed for cleanup
This commit is contained in:
parent
7688768d9b
commit
2922102409
1 changed files with 25 additions and 0 deletions
|
|
@ -15,6 +15,8 @@ namespace SceneManager
|
|||
|
||||
internal static void StartCollectingAtWaypoint(List<Path> paths, Path path, Waypoint waypoint)
|
||||
{
|
||||
LoopForVehiclesToBeDismissed(paths, path);
|
||||
|
||||
while (paths.Contains(path) && path.Waypoints.Contains(waypoint))
|
||||
{
|
||||
if (path.IsEnabled && waypoint.IsCollector)
|
||||
|
|
@ -25,6 +27,29 @@ namespace SceneManager
|
|||
}
|
||||
}
|
||||
|
||||
private static void LoopForVehiclesToBeDismissed(List<Path> paths, Path path)
|
||||
{
|
||||
GameFiber.StartNew(() =>
|
||||
{
|
||||
while (paths.Contains(path))
|
||||
{
|
||||
Logger.Log($"Cleaning up bad collected vehicles");
|
||||
foreach (CollectedVehicle cv in collectedVehicles)
|
||||
{
|
||||
if (!cv.Vehicle.IsDriveable || cv.Vehicle.IsUpsideDown || !cv.Vehicle.HasDriver)
|
||||
{
|
||||
if (cv.Vehicle.HasDriver)
|
||||
{
|
||||
cv.Vehicle.Driver.Dismiss();
|
||||
}
|
||||
cv.Vehicle.Dismiss();
|
||||
}
|
||||
}
|
||||
GameFiber.Sleep(10000);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static void LoopForNearbyValidVehicles(Path path, Waypoint waypoint)
|
||||
{
|
||||
foreach (Vehicle vehicle in GetNearbyVehiclesForCollection(waypoint.Position, waypoint.CollectorRadius))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue