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

Removed DismissOption.FromDirect

This commit is contained in:
Rich Dunne 2020-10-11 15:01:32 -06:00
parent 772e618628
commit 080701b0b1
2 changed files with 4 additions and 35 deletions

View file

@ -13,8 +13,7 @@ namespace SceneManager
FromPath = 0,
FromWaypoint = 1,
FromWorld = 2,
FromDirect = 3,
FromPlayer = 4
FromPlayer = 3
}
static class PathMainMenu

View file

@ -3,7 +3,7 @@ using System.Linq;
namespace SceneManager
{
public class CollectedVehicle
internal class CollectedVehicle
{
internal Ped Driver { get; set; }
internal Vehicle Vehicle { get; set; }
@ -14,7 +14,7 @@ namespace SceneManager
internal bool Dismissed { get; set; } = false;
internal bool Directed { get; set; } = false;
internal bool SkipWaypoint { get; set; } = false;
internal bool ReadyForDirectTasks { get; set; } = false;
internal bool ReadyForDirectTasks { get; set; } = true;
internal CollectedVehicle(Vehicle vehicle, Path path, Waypoint currentWaypoint)
{
@ -83,16 +83,11 @@ namespace SceneManager
DismissFromWaypoint();
}
if(dismissOption == DismissOption.FromPath)
if (dismissOption == DismissOption.FromPath)
{
DismissFromPath();
}
if(dismissOption == DismissOption.FromDirect)
{
DismissFromDirect();
}
void DismissFromWorld()
{
Game.LogTrivial($"Dismissed {Vehicle.Model.Name} from the world");
@ -176,31 +171,6 @@ namespace SceneManager
});
}
void DismissFromDirect()
{
Logger.Log($"Dismissing from direct.");
ReadyForDirectTasks = false;
GameFiber.StartNew(() =>
{
var nearestCollectorWaypoint = Path.Waypoints.Where(wp => wp.IsCollector).OrderBy(wp => Vehicle.DistanceTo2D(wp.Position)).FirstOrDefault();
if (nearestCollectorWaypoint != null)
{
// Enabling this will keep the menu, but the dismissed vehicle is immediately re - collected
while (nearestCollectorWaypoint != null && Vehicle && Driver && Vehicle.FrontPosition.DistanceTo2D(nearestCollectorWaypoint.Position) <= nearestCollectorWaypoint.CollectorRadius)
{
//Game.LogTrivial($"{Vehicle.Model.Name} is within 2x collector radius, cannot be fully dismissed yet.");
GameFiber.Yield();
}
}
else
{
Logger.Log($"Nearest collector is null");
}
ReadyForDirectTasks = true;
});
}
}
}
}