mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Added canCheckFuel for check fuel condition, removed extra spaces
This commit is contained in:
parent
4dc8747430
commit
9ad8718762
@ -25,7 +25,7 @@
|
||||
}; \
|
||||
class GVAR(CheckFuel) { \
|
||||
displayName = CSTRING(CheckFuel); \
|
||||
condition = QUOTE([ARR_2(_player,_target)] call FUNC(getFuel) >= 0); \
|
||||
condition = QUOTE([ARR_2(_player,_target)] call FUNC(canCheckFuel)); \
|
||||
statement = QUOTE([ARR_2(_player,_target)] call FUNC(checkFuel)); \
|
||||
exceptions[] = {"isNotInside"}; \
|
||||
icon = PATHTOF(ui\icon_refuel_interact.paa); \
|
||||
@ -47,7 +47,7 @@
|
||||
icon = PATHTOF(ui\icon_refuel_interact.paa); \
|
||||
class GVAR(Connect) { \
|
||||
displayName = CSTRING(Connect); \
|
||||
condition = QUOTE([ARR_1(_player)] call FUNC(canConnectNozzle)); \
|
||||
condition = QUOTE([ARR_2(_player,_target)] call FUNC(canConnectNozzle)); \
|
||||
statement = QUOTE([ARR_2(_player,_target)] call DFUNC(connectNozzle)); \
|
||||
exceptions[] = {"isNotInside"}; \
|
||||
icon = PATHTOF(ui\icon_refuel_interact.paa); \
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
ADDON = false;
|
||||
|
||||
PREP(canCheckFuel);
|
||||
PREP(canConnectNozzle);
|
||||
PREP(canDisconnect);
|
||||
PREP(canRefuel);
|
||||
|
23
addons/refuel/functions/fnc_canCheckFuel.sqf
Normal file
23
addons/refuel/functions/fnc_canCheckFuel.sqf
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Author: Jonpas
|
||||
* Checks if unit can check fuel.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Target <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Can Check Fuel <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* [unit, target] call ace_refuel_fnc_canCheckFuel
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_unit", "_target"];
|
||||
|
||||
if (isNull _unit || {!(_unit isKindOf "CAManBase")} || {!local _unit} || {(_target distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false};
|
||||
|
||||
true
|
@ -19,7 +19,7 @@ params ["_unit", "_target"];
|
||||
|
||||
if (isNull _unit || {!(_unit isKindOf "CAManBase")} || {!local _unit} || {(_target distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false};
|
||||
|
||||
_fuel = [_unit, _target] call FUNC(getFuel);
|
||||
_fuel = [_target] call FUNC(getFuel);
|
||||
if (_fuel > 0 || {_fuel == -1}) exitWith {true};
|
||||
|
||||
false
|
||||
|
@ -18,9 +18,7 @@
|
||||
private ["_fuel", "_type"];
|
||||
params ["_unit", "_target"];
|
||||
|
||||
if (isNull _unit || {!(_unit isKindOf "CAManBase")} || {!local _unit} || { (_target distance _unit) > 7}) exitWith {0};
|
||||
|
||||
_fuel = [_unit, _target] call FUNC(getFuel);
|
||||
_fuel = [_target] call FUNC(getFuel);
|
||||
|
||||
[
|
||||
5,
|
||||
@ -40,4 +38,3 @@ _fuel = [_unit, _target] call FUNC(getFuel);
|
||||
{true},
|
||||
["isnotinside"]
|
||||
] call EFUNC(common,progressBar);
|
||||
|
||||
|
@ -1,28 +1,26 @@
|
||||
/*
|
||||
* Author: GitHawk
|
||||
* Get the remaining fuel amount
|
||||
* Author: GitHawk, Jonpas
|
||||
* Get the remaining fuel amount.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The unit <OBJECT>
|
||||
* 1: The target <OBJECT>
|
||||
* 0: Target <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Fuel left (in liters) <NUMBER>
|
||||
*
|
||||
* Example:
|
||||
* [unit, target] call ace_refuel_fnc_getFuel
|
||||
* [target] call ace_refuel_fnc_getFuel
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_fuel"];
|
||||
params ["_unit", "_target"];
|
||||
params ["_target"];
|
||||
|
||||
if (isNull _unit || {!(_unit isKindOf "CAManBase")} || {!local _unit}) exitWith {0};
|
||||
_fuel = _target getVariable [QGVAR(currentFuelCargo), nil];
|
||||
|
||||
_fuel = _target getVariable [QGVAR(currentFuelCargo), -2];
|
||||
|
||||
if (_fuel == -2) then {
|
||||
if (isNil "_fuel") then {
|
||||
_fuel = getNumber (configFile >> "CfgVehicles" >> typeOf _target >> QGVAR(fuelCargo));
|
||||
_target setVariable [QGVAR(currentFuelCargo), _fuel, true];
|
||||
};
|
||||
|
@ -40,7 +40,7 @@ _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(f
|
||||
_nozzle setVariable [QGVAR(sink), objNull];
|
||||
[_pfID] call cba_fnc_removePerFrameHandler;
|
||||
};
|
||||
_fuelInSource = [_unit, _source] call FUNC(getFuel);
|
||||
_fuelInSource = [_source] call FUNC(getFuel);
|
||||
if (_fuelInSource == 0) exitWith {
|
||||
[LSTRING(Hint_SourceEmpty), 2, _unit] call EFUNC(common,displayTextStructured);
|
||||
_nozzle setVariable [QGVAR(fueling), 0, true];
|
||||
|
Loading…
Reference in New Issue
Block a user