Skip to content

Commit

Permalink
Fix vehiclefeatures
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardosnt committed Jul 25, 2016
1 parent 1a2dfad commit 419a5f0
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/Components/Player/VehicleFeatures.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,16 @@ public class VehicleFeatures : PlayerComponent {
private int _needRepairPercentage;

protected override void SafeFixedUpdate() {
if (_lastVehicle == null || _lastVehicle != Player.CurrentVehicle) {
var currentVeh = Player.CurrentVehicle;
if (currentVeh == null) {
return;
}

if (_lastVehicle != currentVeh) {
var vehFeatures = UEssentials.Config.VehicleFeatures;
_lastVehicle = Player.CurrentVehicle;
_needRefuelPercentage = _lastVehicle.asset.fuel * (vehFeatures.RefuelPercentage / 100);
_needRepairPercentage = _lastVehicle.asset.health * (vehFeatures.RepairPercentage / 100);
_lastVehicle = currentVeh;
_needRefuelPercentage = (_lastVehicle.asset.fuel * vehFeatures.RefuelPercentage) / 100;
_needRepairPercentage = (_lastVehicle.asset.health * vehFeatures.RepairPercentage) / 100;
}

if (AutoRefuel && _lastVehicle.fuel <= _needRefuelPercentage) {
Expand Down

0 comments on commit 419a5f0

Please sign in to comment.