Skip to content

Commit

Permalink
Disable manual engine cut-off
Browse files Browse the repository at this point in the history
  • Loading branch information
thers committed Jul 4, 2017
1 parent 05e7a72 commit 139a31f
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions FRFuel.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System;
#undef MANUAL_ENGINE_CUTOFF

using System;
using System.Threading.Tasks;
using CitizenFX.Core;
using CitizenFX.Core.Native;
Expand Down Expand Up @@ -31,9 +33,9 @@ public class FRFuel : BaseScript

public float showMarkerInRangeSquared = 250f;

#if DEBUG
public Dev.DevMenu menu;
#endif
#if DEBUG
public Dev.DevMenu menu;
#endif

public HUD hud;
public Random random = new Random();
Expand All @@ -58,9 +60,9 @@ public class FRFuel : BaseScript
/// </summary>
public FRFuel()
{
#if DEBUG
#if DEBUG
menu = new Dev.DevMenu();
#endif
#endif
hud = new HUD();

LoadConfig();
Expand Down Expand Up @@ -122,9 +124,9 @@ protected void LoadConfig()

Config = new Config(configContent);

#if DEBUG
#if DEBUG
Debug.WriteLine($"CreatePickups: {Config.Get("CreatePickups", "true")}");
#endif
#endif
}

/// <summary>
Expand Down Expand Up @@ -276,11 +278,12 @@ public void ConsumeFuel(Vehicle vehicle)
fuel = fuel < 0f ? 0f : fuel;
}

// FIXME: Temp engine cut-off
#if MANUAL_ENGINE_CUTOFF
if (fuel == 0f && vehicle.IsEngineRunning)
{
vehicle.IsEngineRunning = false;
}
#endif

// Refueling at gas station
if (
Expand All @@ -290,7 +293,10 @@ public void ConsumeFuel(Vehicle vehicle)
IsVehicleNearAnyPump(vehicle)
)
{
if (vehicle.Speed < 0.1f && fuel != 0) // Temp check for out of fuel as we're cutting engine off before
#if MANUAL_ENGINE_CUTOFF
if (vehicle.Speed < 0.1f && fuel != 0)
#endif
if (vehicle.Speed < 0.1f)
{
ControlEngine(vehicle);
}
Expand Down Expand Up @@ -329,11 +335,12 @@ public void ConsumeFuel(Vehicle vehicle)
}
else
{
// FIXME: Temp engine cut-off
#if MANUAL_ENGINE_CUTOFF
if (fuel != 0f && !vehicle.IsEngineRunning)
{
vehicle.IsEngineRunning = true;
}
#endif

hudActive = false;
}
Expand Down

0 comments on commit 139a31f

Please sign in to comment.