Skip to content

Commit

Permalink
Added opacity option
Browse files Browse the repository at this point in the history
Changed blip sprite and color
  • Loading branch information
oldnapalm committed Jun 15, 2021
1 parent e152218 commit a1d6507
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
18 changes: 13 additions & 5 deletions ActivityGhosts/ActivityGhosts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -189,6 +194,7 @@ public Ghost(List<GeoPoint> 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)]);
Expand All @@ -200,11 +206,13 @@ public Ghost(List<GeoPoint> 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;
}
}
}
Expand All @@ -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));
Expand All @@ -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);
Expand All @@ -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);
Expand Down
1 change: 1 addition & 0 deletions ActivityGhosts/ActivityGhosts.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
MenuKey=F8
InitialGPSPointLat=-19.10637
InitialGPSPointLong=-169.871
Opacity=50
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a1d6507

Please sign in to comment.