Skip to content

Commit

Permalink
Add AggressiveCyclists option
Browse files Browse the repository at this point in the history
  • Loading branch information
oldnapalm committed Apr 14, 2021
1 parent b9f997e commit 487490a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
12 changes: 5 additions & 7 deletions BicycleCity/BicycleCity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class BicycleCity : Script
{
int bikesPercentage;
bool aggressiveDrivers;
int drivingStyle;
bool aggressiveCyclists;
DateTime lastTime;
string[] availableBicycles = { "BMX", "CRUISER", "FIXTER", "SCORCHER", "TRIBIKE", "TRIBIKE2", "TRIBIKE3" };
VehicleDrivingFlags customDrivingStyle = VehicleDrivingFlags.AvoidEmptyVehicles |
Expand All @@ -26,10 +26,7 @@ public BicycleCity()
if (bikesPercentage > 100)
bikesPercentage = 100;
aggressiveDrivers = settings.GetValue("Main", "AggressiveDrivers", false);
if (aggressiveDrivers)
drivingStyle = (int)customDrivingStyle;
else
drivingStyle = (int)DrivingStyle.Normal;
aggressiveCyclists = settings.GetValue("Main", "AggressiveCyclists", false);
lastTime = DateTime.UtcNow;
Tick += OnTick;
}
Expand All @@ -52,7 +49,7 @@ void OnTick(object sender, EventArgs e)
{
canChange.Add(vehicle);
if (aggressiveDrivers)
Function.Call(Hash.SET_DRIVE_TASK_DRIVING_STYLE, vehicle.Driver, drivingStyle);
Function.Call(Hash.SET_DRIVE_TASK_DRIVING_STYLE, vehicle.Driver, (int)customDrivingStyle);
}
}
int toChange = (bicycles + canChange.Count) * bikesPercentage / 100 - bicycles;
Expand All @@ -77,7 +74,8 @@ void OnTick(object sender, EventArgs e)
newVehicle.MaxSpeed = 10;
canChange[i].Delete();
driver.SetIntoVehicle(newVehicle, VehicleSeat.Driver);
Function.Call(Hash.TASK_VEHICLE_DRIVE_WANDER, driver, newVehicle, (float)random.Next(4, 8), drivingStyle);
Function.Call(Hash.TASK_VEHICLE_DRIVE_WANDER, driver, newVehicle, (float)random.Next(4, 8),
aggressiveCyclists ? (int)customDrivingStyle : (int)DrivingStyle.Normal);
Function.Call(Hash.SET_PED_KEEP_TASK, driver, true);
driver.MarkAsNoLongerNeeded();
newVehicle.MarkAsNoLongerNeeded();
Expand Down
1 change: 1 addition & 0 deletions BicycleCity/BicycleCity.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[Main]
BikesPercentage=50
AggressiveDrivers=false
AggressiveCyclists=false
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ Replace cars by bikes (GTA V mod)
- Put `BicycleCity.dll` and `BicycleCity.ini` in the `Scripts` folder
- Optionally, edit `BicycleCity.ini`
- Change `BikesPercentage` if you want more or less cars replaced by bikes
- Set `AggressiveDrivers` to `true` if you want drivers to overtake cyclists and other slower vehicles
- Set `AggressiveDrivers` to `true` if you want drivers to overtake slower vehicles
- Set `AggressiveCyclists` to `true` if you want cyclists to overtake slower vehicles

## Download
https://github.com/oldnapalm/BicycleCity/releases/latest
Expand Down

0 comments on commit 487490a

Please sign in to comment.