From a1d6507accf9f3e6bcc5018592785a4ec0559324 Mon Sep 17 00:00:00 2001 From: oldnapalm <38410858+oldnapalm@users.noreply.github.com> Date: Tue, 15 Jun 2021 10:24:27 -0300 Subject: [PATCH] Added opacity option Changed blip sprite and color --- ActivityGhosts/ActivityGhosts.cs | 18 +++++++++++++----- ActivityGhosts/ActivityGhosts.ini | 1 + README.md | 2 +- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/ActivityGhosts/ActivityGhosts.cs b/ActivityGhosts/ActivityGhosts.cs index 1fadf38..af88558 100644 --- a/ActivityGhosts/ActivityGhosts.cs +++ b/ActivityGhosts/ActivityGhosts.cs @@ -20,6 +20,7 @@ public class ActivityGhosts : Script private System.DateTime lastTime; private Keys menuKey; public static PointF initialGPSPoint; + public static int opacity; public ActivityGhosts() { @@ -102,6 +103,10 @@ private void LoadSettings() float initialGPSPointLat = settings.GetValue("Main", "InitialGPSPointLat", -19.10637f); float initialGPSPointLong = settings.GetValue("Main", "InitialGPSPointLong", -169.871f); initialGPSPoint = new PointF(initialGPSPointLat, initialGPSPointLong); + opacity = settings.GetValue("Main", "Opacity", 50); + if (opacity < 0) opacity = 0; + if (opacity > 100) opacity = 100; + opacity *= 255 / 100; } private void CreateMenu() @@ -189,6 +194,7 @@ public Ghost(List pointList) vehicle = World.CreateVehicle(vModel, start); vModel.MarkAsNoLongerNeeded(); vehicle.IsInvincible = true; + vehicle.Opacity = ActivityGhosts.opacity; vehicle.Mods.CustomPrimaryColor = Color.FromArgb(random.Next(255), random.Next(255), random.Next(255)); Model pModel; pModel = new Model(availableCyclists[random.Next(availableCyclists.Length)]); @@ -200,11 +206,13 @@ public Ghost(List pointList) ped = World.CreatePed(pModel, start); pModel.MarkAsNoLongerNeeded(); ped.IsInvincible = true; + ped.Opacity = ActivityGhosts.opacity; ped.SetIntoVehicle(vehicle, VehicleSeat.Driver); vehicle.Heading = GetHeading(index); blip = vehicle.AddBlip(); + blip.Sprite = BlipSprite.Ghost; blip.Name = "Ghost (active)"; - blip.Color = BlipColor.Blue; + blip.Color = BlipColor.WhiteNotPure; } } } @@ -213,7 +221,7 @@ public void Update() { if (points.Count > index + 1) { - if (!ped.IsOnBike) + if (!ped.IsInVehicle(vehicle)) ped.SetIntoVehicle(vehicle, VehicleSeat.Driver); float speed = points[index].Speed; float distance = vehicle.Position.DistanceTo2D(GetPoint(index)); @@ -229,7 +237,7 @@ public void Update() ped.Task.DriveTo(vehicle, GetPoint(index), 0f, speed, (DrivingStyle)customDrivingStyle); vehicle.Speed = speed; } - else if (ped.IsOnBike) + else if (ped.IsInVehicle(vehicle)) { ped.Task.ClearAll(); ped.Task.LeaveVehicle(vehicle, false); @@ -243,11 +251,11 @@ public void Regroup(PointF point) index = points.IndexOf(points.OrderBy(x => Distance(point, x)).First()); if (points.Count > index + 1) { - if (!ped.IsOnBike) + if (!ped.IsInVehicle(vehicle)) { ped.SetIntoVehicle(vehicle, VehicleSeat.Driver); blip.Name = "Ghost (active)"; - blip.Color = BlipColor.Blue; + blip.Color = BlipColor.WhiteNotPure; } vehicle.Position = GetPoint(index); vehicle.Heading = GetHeading(index); diff --git a/ActivityGhosts/ActivityGhosts.ini b/ActivityGhosts/ActivityGhosts.ini index 34d82fb..50c04b5 100644 --- a/ActivityGhosts/ActivityGhosts.ini +++ b/ActivityGhosts/ActivityGhosts.ini @@ -2,3 +2,4 @@ MenuKey=F8 InitialGPSPointLat=-19.10637 InitialGPSPointLong=-169.871 +Opacity=50 diff --git a/README.md b/README.md index 8961211..96a6bcc 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Basic activity ghosts mod for [GTBikeV](https://www.gtbikev.com/) ## Installation - Put `ActivityGhosts.dll` and `ActivityGhosts.ini` in the `Scripts` folder -- Optionally, edit `ActivityGhosts.ini` to change the menu key and/or initial GPS coordinates +- Optionally, open `ActivityGhosts.ini` and edit preferences - The requirements should be satisfied if you have already installed GTBikeV ## Usage