mirror of
https://github.com/thegeneralist01/Scene-Manager-DevRepo
synced 2026-01-11 15:40:29 +01:00
Directed vehicles are now dismissed properly from their paths and re-collected.
This commit is contained in:
parent
0da63a655a
commit
4d305aea15
1 changed files with 10 additions and 6 deletions
|
|
@ -240,7 +240,7 @@ namespace SceneManager
|
||||||
|
|
||||||
if (selectedItem == directDriver)
|
if (selectedItem == directDriver)
|
||||||
{
|
{
|
||||||
var nearbyVehicle = Game.LocalPlayer.Character.GetNearbyVehicles(1).Where(v => v.VehicleAndDriverValid()).SingleOrDefault();
|
var nearbyVehicle = Game.LocalPlayer.Character.GetNearbyVehicles(1).Where(v => v != Game.LocalPlayer.Character.CurrentVehicle && v.VehicleAndDriverValid()).SingleOrDefault();
|
||||||
|
|
||||||
if (nearbyVehicle)
|
if (nearbyVehicle)
|
||||||
{
|
{
|
||||||
|
|
@ -252,28 +252,32 @@ namespace SceneManager
|
||||||
|
|
||||||
VehicleCollector.SetVehicleAndDriverPersistence(nearbyVehicle);
|
VehicleCollector.SetVehicleAndDriverPersistence(nearbyVehicle);
|
||||||
|
|
||||||
|
if(collectedVehicle != null)
|
||||||
|
{
|
||||||
|
collectedVehicle.Dismiss();
|
||||||
|
collectedVehicle = null;
|
||||||
|
}
|
||||||
|
|
||||||
// The vehicle should only be added to the collection when it's not null AND if the selected item is First Waypoint OR if the selected item is nearestWaypoint AND nearestWaypoint is not null
|
// The vehicle should only be added to the collection when it's not null AND if the selected item is First Waypoint OR if the selected item is nearestWaypoint AND nearestWaypoint is not null
|
||||||
if (collectedVehicle == null && (directOptions.SelectedItem == "First waypoint" || directOptions.SelectedItem == "Nearest waypoint" && nearestWaypoint != null))
|
if (collectedVehicle == null && (directOptions.SelectedItem == "First waypoint" || (directOptions.SelectedItem == "Nearest waypoint" && nearestWaypoint != null)))
|
||||||
{
|
{
|
||||||
Game.LogTrivial($"[Direct Driver] {nearbyVehicle.Model.Name} not found in collection, adding now.");
|
Game.LogTrivial($"[Direct Driver] {nearbyVehicle.Model.Name} not found in collection, adding now.");
|
||||||
VehicleCollector.collectedVehicles.Add(new CollectedVehicle(nearbyVehicle, path));
|
VehicleCollector.collectedVehicles.Add(new CollectedVehicle(nearbyVehicle, path));
|
||||||
collectedVehicle = VehicleCollector.collectedVehicles.Where(cv => cv.Vehicle == nearbyVehicle).FirstOrDefault();
|
collectedVehicle = VehicleCollector.collectedVehicles.Where(cv => cv.Vehicle == nearbyVehicle).FirstOrDefault();
|
||||||
|
Logger.Log($"Collected vehicle is {collectedVehicle.Vehicle.Model.Name}");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (collectedVehicle == null)
|
if (collectedVehicle == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
collectedVehicle.Directed = true;
|
||||||
collectedVehicle.Driver.Tasks.Clear();
|
collectedVehicle.Driver.Tasks.Clear();
|
||||||
if (collectedVehicle.StoppedAtWaypoint)
|
if (collectedVehicle.StoppedAtWaypoint)
|
||||||
{
|
{
|
||||||
collectedVehicle.StoppedAtWaypoint = false;
|
collectedVehicle.StoppedAtWaypoint = false;
|
||||||
Rage.Native.NativeFunction.Natives.x260BE8F09E326A20(collectedVehicle.Vehicle, 0f, 1, true);
|
Rage.Native.NativeFunction.Natives.x260BE8F09E326A20(collectedVehicle.Vehicle, 0f, 1, true);
|
||||||
}
|
}
|
||||||
collectedVehicle.Dismiss();
|
|
||||||
collectedVehicle.Directed = true;
|
|
||||||
|
|
||||||
|
|
||||||
if (directOptions.SelectedItem == "First waypoint")
|
if (directOptions.SelectedItem == "First waypoint")
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue