mirror of
https://github.com/thegeneralist01/Scene-Manager-DevRepo
synced 2026-01-11 15:40:29 +01:00
Added null check to CollectedPed creaetion. Replaced 100ms Sleep in DrivingToWaypoint loop with Yield
This commit is contained in:
parent
132b89dd25
commit
20f6cf0df5
1 changed files with 7 additions and 1 deletions
|
|
@ -19,6 +19,10 @@ namespace SceneManager.CollectedPeds
|
||||||
|
|
||||||
internal CollectedPed(Ped ped, Path path, Waypoint waypoint)
|
internal CollectedPed(Ped ped, Path path, Waypoint waypoint)
|
||||||
{
|
{
|
||||||
|
if(!ped)
|
||||||
|
{
|
||||||
|
Game.LogTrivial($"Ped is invalid.");
|
||||||
|
}
|
||||||
Handle = ped.Handle;
|
Handle = ped.Handle;
|
||||||
Path = path;
|
Path = path;
|
||||||
CurrentWaypoint = waypoint;
|
CurrentWaypoint = waypoint;
|
||||||
|
|
@ -223,6 +227,7 @@ namespace SceneManager.CollectedPeds
|
||||||
if (CurrentVehicle)
|
if (CurrentVehicle)
|
||||||
{
|
{
|
||||||
Tasks.DriveToPosition(Path.Waypoints[currentWaypointTask].Position, Path.Waypoints[currentWaypointTask].Speed, (VehicleDrivingFlags)Path.Waypoints[currentWaypointTask].DrivingFlagType, acceptedDistance);
|
Tasks.DriveToPosition(Path.Waypoints[currentWaypointTask].Position, Path.Waypoints[currentWaypointTask].Speed, (VehicleDrivingFlags)Path.Waypoints[currentWaypointTask].DrivingFlagType, acceptedDistance);
|
||||||
|
Game.LogTrivial($"{CurrentVehicle.Model.Name} [{CurrentVehicle.Handle}] driver [{Handle}] should have a task now.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -230,7 +235,8 @@ namespace SceneManager.CollectedPeds
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GameFiber.Sleep(100);
|
//GameFiber.Sleep(100);
|
||||||
|
GameFiber.Yield();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue