mirror of
https://github.com/thegeneralist01/Scene-Manager-DevRepo
synced 2026-01-11 23:50:29 +01:00
Added loop to ensure driver is deleted before the vehicle upon dismiss from world
This commit is contained in:
parent
64c7afed14
commit
d684d57cb2
1 changed files with 15 additions and 4 deletions
|
|
@ -40,13 +40,19 @@ namespace SceneManager
|
|||
if (dismissOption == DismissOption.FromWorld)
|
||||
{
|
||||
Game.LogTrivial($"Dismissed {Vehicle.Model.Name} from the world");
|
||||
Vehicle.Driver.Delete();
|
||||
if (Vehicle.HasDriver)
|
||||
{
|
||||
while (Vehicle.Driver)
|
||||
{
|
||||
Vehicle.Driver.Dismiss();
|
||||
Vehicle.Driver.Delete();
|
||||
GameFiber.Yield();
|
||||
}
|
||||
}
|
||||
Vehicle.Delete();
|
||||
return;
|
||||
}
|
||||
|
||||
Dismissed = true;
|
||||
Dismissed = false;
|
||||
Driver.Tasks.Clear();
|
||||
if(StoppedAtWaypoint)
|
||||
{
|
||||
|
|
@ -66,12 +72,17 @@ namespace SceneManager
|
|||
{
|
||||
Logger.Log($"Dismissed from waypoint.");
|
||||
SkipWaypoint = true;
|
||||
SkipWaypoint = false;
|
||||
GameFiber.StartNew(() =>
|
||||
{
|
||||
GameFiber.Sleep(100);
|
||||
SkipWaypoint = false;
|
||||
});
|
||||
}
|
||||
|
||||
if(dismissOption == DismissOption.FromWaypoint && CurrentWaypoint.Number == Path.Waypoints.Count || dismissOption == DismissOption.FromPath)
|
||||
{
|
||||
Logger.Log($"Dismissed from path.");
|
||||
Dismissed = true;
|
||||
GameFiber.StartNew(() =>
|
||||
{
|
||||
// check if the vehicle is near any of the path's collector waypoints
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue