From 2a8e758390c6ed3efbafade34d62d2eb80d01a07 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sat, 16 Sep 2017 04:36:42 -0500 Subject: [PATCH] Allow loading fuel canister (#5493) Fix #5438 - Also block cargo action when being used --- addons/cargo/CfgVehicles.hpp | 6 ++++++ addons/refuel/functions/fnc_connectNozzleAction.sqf | 1 + addons/refuel/functions/fnc_disconnect.sqf | 1 + addons/refuel/functions/fnc_refuel.sqf | 2 ++ 4 files changed, 10 insertions(+) diff --git a/addons/cargo/CfgVehicles.hpp b/addons/cargo/CfgVehicles.hpp index 04cdaeffaa..4d76ac8581 100644 --- a/addons/cargo/CfgVehicles.hpp +++ b/addons/cargo/CfgVehicles.hpp @@ -432,6 +432,12 @@ class CfgVehicles { GVAR(size) = 2; // 1 = small, 2 = large }; + // Fuel Canister (ace_refuel) + class Land_CanisterFuel_F: Items_base_F { + GVAR(size) = 1; + GVAR(canLoad) = 1; + }; + // objects class Lamps_base_F; class RoadCone_F: ThingX { diff --git a/addons/refuel/functions/fnc_connectNozzleAction.sqf b/addons/refuel/functions/fnc_connectNozzleAction.sqf index e52e7ae971..1c6c3b7dbf 100644 --- a/addons/refuel/functions/fnc_connectNozzleAction.sqf +++ b/addons/refuel/functions/fnc_connectNozzleAction.sqf @@ -108,6 +108,7 @@ private _attachPosModel = _sink worldToModel (ASLtoAGL _bestPosASL); }; }; [QEGVAR(common,setVectorDirAndUp), [_nozzle, _dirAndUp], _nozzle] call CBA_fnc_targetEvent; + if (_nozzle isKindOf "Land_CanisterFuel_F") then { _nozzle setVariable [QEGVAR(cargo,canLoad), false, true]; }; _nozzle setVariable [QGVAR(sink), _sink, true]; _nozzle setVariable [QGVAR(isConnected), true, true]; _sink setVariable [QGVAR(nozzle), _nozzle, true]; diff --git a/addons/refuel/functions/fnc_disconnect.sqf b/addons/refuel/functions/fnc_disconnect.sqf index 94020b29e9..793eefbb93 100644 --- a/addons/refuel/functions/fnc_disconnect.sqf +++ b/addons/refuel/functions/fnc_disconnect.sqf @@ -22,6 +22,7 @@ private _sink = _nozzle getVariable [QGVAR(sink), objNull]; if (isNull _sink) exitWith {}; _sink setVariable [QGVAR(nozzle), nil, true]; +if (_nozzle isKindOf "Land_CanisterFuel_F") then { _nozzle setVariable [QEGVAR(cargo,canLoad), true, true]; }; _nozzle setVariable [QGVAR(sink), nil, true]; _nozzle setVariable [QGVAR(isConnected), false, true]; [objNull, _nozzle, true] call FUNC(dropNozzle); diff --git a/addons/refuel/functions/fnc_refuel.sqf b/addons/refuel/functions/fnc_refuel.sqf index 848739994a..e294a43497 100644 --- a/addons/refuel/functions/fnc_refuel.sqf +++ b/addons/refuel/functions/fnc_refuel.sqf @@ -43,6 +43,7 @@ if (_maxFuel == 0) then { if (!alive _source || {!alive _sink}) exitWith { [objNull, _nozzle] call FUNC(dropNozzle); _nozzle setVariable [QGVAR(isConnected), false, true]; + if (_nozzle isKindOf "Land_CanisterFuel_F") then { _nozzle setVariable [QEGVAR(cargo,canLoad), true, true]; }; _nozzle setVariable [QGVAR(sink), nil, true]; _sink setVariable [QGVAR(nozzle), nil, true]; [_pfID] call CBA_fnc_removePerFrameHandler; @@ -54,6 +55,7 @@ if (_maxFuel == 0) then { [objNull, _nozzle] call FUNC(dropNozzle); _nozzle setVariable [QGVAR(isConnected), false, true]; + if (_nozzle isKindOf "Land_CanisterFuel_F") then { _nozzle setVariable [QEGVAR(cargo,canLoad), true, true]; }; _nozzle setVariable [QGVAR(sink), nil, true]; _sink setVariable [QGVAR(nozzle), nil, true]; [_pfID] call CBA_fnc_removePerFrameHandler;