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

Added local function to create waypoint blip for Add As New Waypoint

This commit is contained in:
Rich Dunne 2020-10-01 06:04:40 -06:00
parent 06777aa928
commit 6ce58a7d8e

View file

@ -164,19 +164,19 @@ namespace SceneManager
{ {
var pathIndex = PathMainMenu.paths.IndexOf(currentPath); var pathIndex = PathMainMenu.paths.IndexOf(currentPath);
var drivingFlag = drivingFlags[changeWaypointType.Index]; var drivingFlag = drivingFlags[changeWaypointType.Index];
var blip = PathCreationMenu.CreateWaypointBlip(pathIndex, drivingFlag); var newWaypointBlip = CreateNewWaypointBlip();
if (!currentPath.IsEnabled) if (!currentPath.IsEnabled)
{ {
blip.Alpha = 0.5f; newWaypointBlip.Alpha = 0.5f;
} }
if (collectorWaypoint.Checked) if (collectorWaypoint.Checked)
{ {
currentPath.Waypoints.Add(new Waypoint(currentPath, currentPath.Waypoints.Last().Number + 1, Game.LocalPlayer.Character.Position, SetDriveSpeedForWaypoint(), drivingFlag, blip, true, changeCollectorRadius.Value, changeSpeedZoneRadius.Value)); currentPath.Waypoints.Add(new Waypoint(currentPath, currentPath.Waypoints.Last().Number + 1, Game.LocalPlayer.Character.Position, SetDriveSpeedForWaypoint(), drivingFlag, newWaypointBlip, true, changeCollectorRadius.Value, changeSpeedZoneRadius.Value));
} }
else else
{ {
currentPath.Waypoints.Add(new Waypoint(currentPath, currentPath.Waypoints.Last().Number + 1, Game.LocalPlayer.Character.Position, SetDriveSpeedForWaypoint(), drivingFlag, blip)); currentPath.Waypoints.Add(new Waypoint(currentPath, currentPath.Waypoints.Last().Number + 1, Game.LocalPlayer.Character.Position, SetDriveSpeedForWaypoint(), drivingFlag, newWaypointBlip));
} }
editWaypointMenu.RemoveItemAt(0); editWaypointMenu.RemoveItemAt(0);
@ -186,6 +186,36 @@ namespace SceneManager
editWaypointMenu.RefreshIndex(); editWaypointMenu.RefreshIndex();
updateWaypointPosition.Checked = false; updateWaypointPosition.Checked = false;
Logger.Log($"New waypoint (#{currentWaypoint.Number + 1}) added."); Logger.Log($"New waypoint (#{currentWaypoint.Number + 1}) added.");
Blip CreateNewWaypointBlip()
{
var spriteNumericalEnum = pathIndex + 17; // 17 because the numerical value of these sprites are always 17 more than the path index
var blip = new Blip(Game.LocalPlayer.Character.Position)
{
Scale = 0.5f,
Sprite = (BlipSprite)spriteNumericalEnum
};
if (collectorWaypoint.Checked)
{
blip.Color = Color.Blue;
}
else if (drivingFlag == VehicleDrivingFlags.StopAtDestination)
{
blip.Color = Color.Red;
}
else
{
blip.Color = Color.Green;
}
if (!SettingsMenu.mapBlips.Checked)
{
blip.Alpha = 0f;
}
return blip;
}
} }
if (selectedItem == removeWaypoint) if (selectedItem == removeWaypoint)