mirror of
https://github.com/thegeneralist01/Scene-Manager-DevRepo
synced 2026-01-10 15:20:29 +01:00
Added check for vehicle's driver before creating new CollectedPed
This commit is contained in:
parent
f19f2bc79d
commit
c3e401193b
1 changed files with 13 additions and 2 deletions
|
|
@ -237,14 +237,25 @@ namespace SceneManager.Paths
|
|||
|
||||
int checksDone = 0;
|
||||
var collectorWaypoints = Waypoints.Where(x => x.IsCollector);
|
||||
var vehiclesInWorld = World.GetAllVehicles().Where(x => x);
|
||||
|
||||
foreach (Waypoint waypoint in collectorWaypoints.ToList())
|
||||
{
|
||||
foreach (Vehicle vehicle in vehiclesInWorld)
|
||||
foreach (Vehicle vehicle in World.GetAllVehicles().Where(x => x))
|
||||
{
|
||||
if (vehicle.IsNearCollectorWaypoint(waypoint) && vehicle.IsValidForPathCollection(this))
|
||||
{
|
||||
while(!vehicle.Driver)
|
||||
{
|
||||
GameFiber.Yield();
|
||||
if (!vehicle)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!vehicle)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
CollectedPeds.Add(new CollectedPed(vehicle.Driver, this, waypoint));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue