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

Added new DismissOption enum for when a player enters a collected vehicle. Added null checking when deleting nearby vehicle from world.

This commit is contained in:
Rich Dunne 2020-10-10 20:08:59 -06:00
parent 822725ae2d
commit 5d1a17ed1f

View file

@ -13,7 +13,8 @@ namespace SceneManager
FromPath = 0, FromPath = 0,
FromWaypoint = 1, FromWaypoint = 1,
FromWorld = 2, FromWorld = 2,
FromDirect = 3 FromDirect = 3,
FromPlayer = 4
} }
static class PathMainMenu static class PathMainMenu
@ -296,21 +297,22 @@ namespace SceneManager
else if(dismissDriver.Index == (int)DismissOption.FromWorld) else if(dismissDriver.Index == (int)DismissOption.FromWorld)
{ {
Game.LogTrivial($"Dismissed {nearbyVehicle.Model.Name} from the world"); Game.LogTrivial($"Dismissed {nearbyVehicle.Model.Name} from the world");
while (nearbyVehicle.HasOccupants) while (nearbyVehicle && nearbyVehicle.HasOccupants)
{ {
foreach (Ped occupant in nearbyVehicle.Occupants) foreach (Ped occupant in nearbyVehicle.Occupants)
{ {
occupant.Dismiss();
occupant.Delete(); occupant.Delete();
} }
GameFiber.Yield(); GameFiber.Yield();
} }
if (nearbyVehicle)
{
nearbyVehicle.Delete(); nearbyVehicle.Delete();
} }
} }
} }
} }
}
private static void PathMenu_OnCheckboxChange(UIMenu sender, UIMenuCheckboxItem checkboxItem, bool @checked) private static void PathMenu_OnCheckboxChange(UIMenu sender, UIMenuCheckboxItem checkboxItem, bool @checked)
{ {