From 487490a8bcf3655dd4bf9b6e1d9e1ebd032f0aba Mon Sep 17 00:00:00 2001 From: oldnapalm <38410858+oldnapalm@users.noreply.github.com> Date: Wed, 14 Apr 2021 16:09:41 -0300 Subject: [PATCH] Add AggressiveCyclists option --- BicycleCity/BicycleCity.cs | 12 +++++------- BicycleCity/BicycleCity.ini | 1 + README.md | 3 ++- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/BicycleCity/BicycleCity.cs b/BicycleCity/BicycleCity.cs index 63d96cb..6ad9b99 100644 --- a/BicycleCity/BicycleCity.cs +++ b/BicycleCity/BicycleCity.cs @@ -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 | @@ -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; } @@ -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; @@ -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(); diff --git a/BicycleCity/BicycleCity.ini b/BicycleCity/BicycleCity.ini index 5245beb..10d59e8 100644 --- a/BicycleCity/BicycleCity.ini +++ b/BicycleCity/BicycleCity.ini @@ -1,3 +1,4 @@ [Main] BikesPercentage=50 AggressiveDrivers=false +AggressiveCyclists=false diff --git a/README.md b/README.md index cb3184c..99b0400 100644 --- a/README.md +++ b/README.md @@ -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