mirror of
https://github.com/thegeneralist01/Scene-Manager-DevRepo
synced 2026-01-11 23:50:29 +01:00
Added condition to give drivers to empty vehicles resulting from GTA V memory management
This commit is contained in:
parent
fc76ea1f80
commit
338fa61c94
1 changed files with 12 additions and 2 deletions
|
|
@ -74,7 +74,7 @@ namespace SceneManager
|
||||||
|
|
||||||
private static Vehicle[] GetNearbyVehicles(Vector3 OriginPosition, float radius)
|
private static Vehicle[] GetNearbyVehicles(Vector3 OriginPosition, float radius)
|
||||||
{
|
{
|
||||||
return (from x in World.GetAllVehicles() where !x.IsTrailer && x.DistanceTo(OriginPosition) < radius select x).ToArray();
|
return (from x in World.GetAllVehicles() where !x.IsTrailer && x.DistanceTo(OriginPosition) <= radius select x).ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void AssignStopForVehiclesFlag(List<Path> paths, Path path, Waypoint waypointData)
|
private static void AssignStopForVehiclesFlag(List<Path> paths, Path path, Waypoint waypointData)
|
||||||
|
|
@ -116,10 +116,20 @@ namespace SceneManager
|
||||||
|
|
||||||
private static bool IsValidForCollection(this Vehicle v)
|
private static bool IsValidForCollection(this Vehicle v)
|
||||||
{
|
{
|
||||||
if (v && v.HasDriver && v.Driver && v.Driver.IsAlive && v != Game.LocalPlayer.Character.CurrentVehicle && (v.IsCar || v.IsBike || v.IsBicycle || v.IsQuadBike || (v.HasSiren && !v.IsSirenOn)))
|
if(v && v.Speed > 0 && v.IsOnAllWheels && !v != Game.LocalPlayer.Character.CurrentVehicle && (v.IsCar || v.IsBike || v.IsBicycle || v.IsQuadBike || (v.HasSiren && !v.IsSirenOn)))
|
||||||
{
|
{
|
||||||
|
if (!v.HasDriver)
|
||||||
|
{
|
||||||
|
v.CreateRandomDriver();
|
||||||
|
v.Driver.IsPersistent = true;
|
||||||
|
v.Driver.BlockPermanentEvents = true;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
//if (v && v.HasDriver && v.Driver && v.Driver.IsAlive && v != Game.LocalPlayer.Character.CurrentVehicle && (v.IsCar || v.IsBike || v.IsBicycle || v.IsQuadBike || (v.HasSiren && !v.IsSirenOn)))
|
||||||
|
//{
|
||||||
|
// return true;
|
||||||
|
//}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue