mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Fixes
- Fixed `isEngineOn` returning true on static objects - Fixed `fnc_readFuelCounter` for objects with infinite fuel
This commit is contained in:
parent
7451d1ee5f
commit
c8e8a17111
@ -19,8 +19,13 @@
|
||||
params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]]];
|
||||
|
||||
private _nozzle = _unit getVariable [QGVAR(nozzle), objNull];
|
||||
private _engine = false;
|
||||
|
||||
if (_target isKindOf "AllVehicles") then {
|
||||
_engine = isEngineOn _target;
|
||||
};
|
||||
|
||||
!(isNull _nozzle ||
|
||||
{isEngineOn _target} ||
|
||||
{_engine} ||
|
||||
{(_target distance _unit) > REFUEL_ACTION_DISTANCE} ||
|
||||
{!isNull (_target getVariable [QGVAR(nozzle), objNull])}) // TODO verify cant connect multiple fuel lines
|
||||
|
@ -125,7 +125,12 @@ _endPosTestOffset set [2, (_startingOffset select 2)];
|
||||
_target setVariable [QGVAR(nozzle), _nozzle, true];
|
||||
|
||||
_source = _nozzle getVariable QGVAR(source);
|
||||
_source setVariable [QGVAR(fuelCounter), [_source] call FUNC(getFuel), true];
|
||||
private _fuel = [_source] call FUNC(getFuel);
|
||||
if (_fuel == REFUEL_INFINITE_FUEL) then {
|
||||
_source setVariable [QGVAR(fuelCounter), 0, true];
|
||||
} else {
|
||||
_source setVariable [QGVAR(fuelCounter), _fuel, true];
|
||||
};
|
||||
|
||||
[_unit, _target, _nozzle, _endPosTestOffset] call FUNC(refuel);
|
||||
},
|
||||
|
@ -26,8 +26,13 @@ params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]]];
|
||||
_args params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]]];
|
||||
|
||||
private _currentFuel = [_target] call FUNC(getFuel);
|
||||
private _fuelCounter = 0.01 * round (100 * ((_target getVariable [QGVAR(fuelCounter), _currentFuel]) - _currentFuel));
|
||||
[[LSTRING(Hint_FuelCounter), _fuelCounter], 1.5, _unit] call EFUNC(common,displayTextStructured);
|
||||
if (_currentFuel == REFUEL_INFINITE_FUEL) then {
|
||||
private _fuelCounter = 0.01 * round (100 * (_target getVariable [QGVAR(fuelCounter), 0]));
|
||||
[[LSTRING(Hint_FuelCounter), _fuelCounter], 1.5, _unit] call EFUNC(common,displayTextStructured);
|
||||
} else {
|
||||
private _fuelCounter = 0.01 * round (100 * ((_target getVariable [QGVAR(fuelCounter), _currentFuel]) - _currentFuel));
|
||||
[[LSTRING(Hint_FuelCounter), _fuelCounter], 1.5, _unit] call EFUNC(common,displayTextStructured);
|
||||
};
|
||||
},
|
||||
"",
|
||||
localize LSTRING(CheckFuelCounterAction),
|
||||
|
@ -59,8 +59,10 @@ private _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >>
|
||||
};
|
||||
if !(_fuelInSource == REFUEL_INFINITE_FUEL) then {
|
||||
_fuelInSource = _fuelInSource - _rate;
|
||||
} else {
|
||||
_source setVariable [QGVAR(fuelCounter), (_source getVariable [QGVAR(fuelCounter), 0]) + _rate, true];
|
||||
};
|
||||
if (_fuelInSource < 0 && {_fuelInSource > -1}) then {
|
||||
if (_fuelInSource < 0 && {_fuelInSource > REFUEL_INFINITE_FUEL}) then {
|
||||
_fuelInSource = 0;
|
||||
_finished = true;
|
||||
[LSTRING(Hint_SourceEmpty), 2, _unit] call EFUNC(common,displayTextStructured);
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include "\z\ace\addons\main\script_macros.hpp"
|
||||
|
||||
#define REFUEL_INFINITE_FUEL -1
|
||||
#define REFUEL_INFINITE_FUEL -10
|
||||
#define REFUEL_ACTION_DISTANCE 7
|
||||
#define REFUEL_HOSE_LENGTH 12
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user