mirror of
https://github.com/thegeneralist01/Scene-Manager-DevRepo
synced 2026-01-11 15:40:29 +01:00
Added new Drive-To mode (Direct) which allows the AI to drive on the wrong side of the road to the next waypoint.
This commit is contained in:
parent
36a04f94c7
commit
a816967255
5 changed files with 22 additions and 6 deletions
|
|
@ -65,7 +65,15 @@ namespace SceneManager
|
|||
Game.LogTrivial($"{vehicle.Model.Name} is driving to waypoint {waypoints[nextWaypoint].Number}");
|
||||
if (waypoints.ElementAtOrDefault(nextWaypoint) != null && !collectedVehicle.StoppedAtWaypoint)
|
||||
{
|
||||
collectedVehicle.Vehicle.Driver.Tasks.DriveToPosition(waypoints[nextWaypoint].Position, waypoints[nextWaypoint].Speed, (VehicleDrivingFlags)263083, 2f).WaitForCompletion();
|
||||
if(waypoints[nextWaypoint].DrivingFlag == VehicleDrivingFlags.Normal)
|
||||
{
|
||||
collectedVehicle.Vehicle.Driver.Tasks.DriveToPosition(waypoints[nextWaypoint].Position, waypoints[nextWaypoint].Speed, (VehicleDrivingFlags)263083, 2f).WaitForCompletion();
|
||||
}
|
||||
else if (waypoints[nextWaypoint].DrivingFlag == VehicleDrivingFlags.IgnorePathFinding)
|
||||
{
|
||||
collectedVehicle.Vehicle.Driver.Tasks.DriveToPosition(waypoints[nextWaypoint].Position, waypoints[nextWaypoint].Speed, (VehicleDrivingFlags)17040299, 2f).WaitForCompletion();
|
||||
}
|
||||
|
||||
collectedVehicle.Vehicle.Driver.Tasks.PerformDrivingManeuver(collectedVehicle.Vehicle, VehicleManeuver.GoForwardWithCustomSteeringAngle, 3);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ namespace SceneManager
|
|||
Rage.Native.NativeFunction.Natives.DRAW_MARKER(1, Game.LocalPlayer.Character.Position.X, Game.LocalPlayer.Character.Position.Y, Game.LocalPlayer.Character.Position.Z - 1, 0, 0, 0, 0, 0, 0, (float)PathCreationMenu.collectorRadius.Value, (float)PathCreationMenu.collectorRadius.Value, 1f, 80, 130, 255, 80, false, false, 2, false, 0, 0, false);
|
||||
Rage.Native.NativeFunction.Natives.DRAW_MARKER(1, Game.LocalPlayer.Character.Position.X, Game.LocalPlayer.Character.Position.Y, Game.LocalPlayer.Character.Position.Z - 1, 0, 0, 0, 0, 0, 0, (float)PathCreationMenu.speedZoneRadius.Value, (float)PathCreationMenu.speedZoneRadius.Value, 1f, 255, 185, 80, 80, false, false, 2, false, 0, 0, false);
|
||||
}
|
||||
else if (PathCreationMenu.waypointType.SelectedItem == "Drive To")
|
||||
else if (PathCreationMenu.waypointType.SelectedItem.Contains("Drive To"))
|
||||
{
|
||||
Rage.Native.NativeFunction.Natives.DRAW_MARKER(1, Game.LocalPlayer.Character.Position.X, Game.LocalPlayer.Character.Position.Y, Game.LocalPlayer.Character.Position.Z - 1, 0, 0, 0, 0, 0, 0, 1f, 1f, 1f, 65, 255, 65, 80, false, false, 2, false, 0, 0, false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ namespace SceneManager
|
|||
{
|
||||
class EditWaypointMenu
|
||||
{
|
||||
private static VehicleDrivingFlags[] drivingFlags = new VehicleDrivingFlags[] { VehicleDrivingFlags.Normal, VehicleDrivingFlags.StopAtDestination };
|
||||
private static string[] waypointTypes = new string[] { "Drive To", "Stop" };
|
||||
private static VehicleDrivingFlags[] drivingFlags = new VehicleDrivingFlags[] { VehicleDrivingFlags.Normal, VehicleDrivingFlags.IgnorePathFinding, VehicleDrivingFlags.StopAtDestination };
|
||||
private static string[] waypointTypes = new string[] { "Drive To (Normal)", "Drive To (Direct)", "Stop" };
|
||||
public static UIMenu editWaypointMenu { get; private set; }
|
||||
public static UIMenuItem updateWaypoint { get; private set; }
|
||||
public static UIMenuItem removeWaypoint { get; private set; }
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ namespace SceneManager
|
|||
class PathCreationMenu
|
||||
{
|
||||
|
||||
private static VehicleDrivingFlags[] drivingFlags = new VehicleDrivingFlags[] { VehicleDrivingFlags.Normal, VehicleDrivingFlags.StopAtDestination }; // Implement custom driving flag for normal
|
||||
private static string[] waypointTypes = new string[] { "Drive To", "Stop" };
|
||||
private static VehicleDrivingFlags[] drivingFlags = new VehicleDrivingFlags[] { VehicleDrivingFlags.Normal, VehicleDrivingFlags.IgnorePathFinding, VehicleDrivingFlags.StopAtDestination }; // Implement custom driving flag for normal
|
||||
private static string[] waypointTypes = new string[] { "Drive To (Normal)", "Drive To (Direct)", "Stop" };
|
||||
public static UIMenu pathCreationMenu { get; private set; }
|
||||
private static UIMenuItem trafficAddWaypoint, trafficRemoveWaypoint, trafficEndPath;
|
||||
public static UIMenuListScrollerItem<string> waypointType = new UIMenuListScrollerItem<string>("Waypoint Type", "", waypointTypes);
|
||||
|
|
|
|||
|
|
@ -71,6 +71,14 @@ namespace SceneManager
|
|||
|
||||
void UpdateDrivingFlag(VehicleDrivingFlags newDrivingFlag)
|
||||
{
|
||||
if(_drivingFlag == VehicleDrivingFlags.StopAtDestination && newDrivingFlag != VehicleDrivingFlags.StopAtDestination)
|
||||
{
|
||||
foreach(CollectedVehicle cv in VehicleCollector.collectedVehicles.Where(cv => cv.Path == _path && cv.CurrentWaypoint == _number && cv.StoppedAtWaypoint))
|
||||
{
|
||||
Game.LogTrivial($"Setting StoppedAtWaypoint to false for {cv.Vehicle.Model.Name}");
|
||||
cv.SetStoppedAtWaypoint(false);
|
||||
}
|
||||
}
|
||||
_drivingFlag = newDrivingFlag;
|
||||
if (newDrivingFlag == VehicleDrivingFlags.StopAtDestination)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue