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

Fixed potential crash with IsAmbient check

This commit is contained in:
Rich Dunne 2021-05-23 06:22:01 -06:00
parent 3565b326ce
commit aad8521479

View file

@ -54,15 +54,15 @@ namespace SceneManager.Utils
}
// Ped is in a vehicle
if (taskInVehicleBasic)
if (ped.CurrentVehicle)
{
//Game.LogTrivial($"Ped is in a vehicle.");
// Ped has a controlled driving task
if (taskControlVehicle)
{
//Game.LogTrivial($"Ped has a controlled driving task. (non-ambient)");
return false;
}
//if (taskControlVehicle)
//{
// //Game.LogTrivial($"Ped has a controlled driving task. (non-ambient)");
// return false;
//}
// Ped has a wander driving task
if (taskCarDriveWander)
@ -72,6 +72,8 @@ namespace SceneManager.Utils
}
// If the ped is in a vehicle but doesn't have a driving task, then it's a passenger. Check if the vehicle's driver has a driving wander task
if (ped.CurrentVehicle.Driver && ped.CurrentVehicle.Driver != ped)
{
var driverHasWanderTask = Rage.Native.NativeFunction.Natives.GET_IS_TASK_ACTIVE<bool>(ped.CurrentVehicle.Driver, 151);
if (driverHasWanderTask)
{
@ -79,16 +81,10 @@ namespace SceneManager.Utils
return true;
}
}
}
if (ped.IsOnFoot)
{
// UB unit on-foot, waiting for interaction
if (ped.RelationshipGroup.Name == "UBCOP")
{
//Game.LogTrivial($"Cop is UB unit. (non-ambient)");
return false;
}
// Cop ped walking around or standing still
if ((taskComplexControlMovement && taskWanderingScenario) || (taskAmbientClips && taskUseScenario))
{