Fixed jerry can madness (#8348)

Fixed refueling vehicles with high input rates when using fuel sources with low fuel capacity.
This commit is contained in:
GhostIsSpooky 2021-10-11 02:47:54 -03:00 committed by GitHub
parent 128ddf2591
commit 1c921674a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -74,13 +74,19 @@ if (_maxFuel == 0) then {
private _rateTime = _rate * (CBA_missionTime - (_nozzle getVariable [QGVAR(lastTickMissionTime), CBA_missionTime]));
_nozzle setVariable [QGVAR(lastTickMissionTime), CBA_missionTime];
if !(_fuelInSource == REFUEL_INFINITE_FUEL) then {
if (_fuelInSource != REFUEL_INFINITE_FUEL) then {
if (_rateTime > _fuelInSource) then {
_rateTime = _fuelInSource;
_fuelInSource = 0;
} else {
_fuelInSource = _fuelInSource - _rateTime;
};
} else {
_source setVariable [QGVAR(fuelCounter), (_source getVariable [QGVAR(fuelCounter), 0]) + _rateTime, true];
};
if (_fuelInSource < 0 && {_fuelInSource > REFUEL_INFINITE_FUEL}) then {
if (_fuelInSource <= 0 && {_fuelInSource != REFUEL_INFINITE_FUEL}) then {
_fuelInSource = 0;
[_source, _fuelInSource] call FUNC(setFuel);
_finished = true;
[LSTRING(Hint_SourceEmpty), 2, _unit] call EFUNC(common,displayTextStructured);
};