diff --git a/addons/refuel/CfgVehicles.hpp b/addons/refuel/CfgVehicles.hpp index 4859cd883f9..6fc5ddae086 100644 --- a/addons/refuel/CfgVehicles.hpp +++ b/addons/refuel/CfgVehicles.hpp @@ -512,6 +512,22 @@ class CfgVehicles { GVAR(fuelCargo) = REFUEL_INFINITE_FUEL; }; + // Helper object for non-AllVehicles objects + class GVAR(helper): Helicopter_Base_F { + scope = 1; + displayName = "Refuel Helper"; + model = "\A3\Weapons_f\empty"; + class ACE_Actions {}; + class ACE_SelfActions {}; + EGVAR(cargo,hasCargo) = 0; + EGVAR(cargo,space) = 0; + damageEffect = ""; + destrType = ""; + class HitPoints {}; + class Turrets {}; + class TransportItems {}; + }; + /* // Barrels found in config \ BarrelHelper: Misc_thing 100 BarrelBase: BarrelHelper 100 diff --git a/addons/refuel/functions/fnc_checkFuel.sqf b/addons/refuel/functions/fnc_checkFuel.sqf index 49d62b1e448..8acecccfd64 100644 --- a/addons/refuel/functions/fnc_checkFuel.sqf +++ b/addons/refuel/functions/fnc_checkFuel.sqf @@ -21,7 +21,7 @@ params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]]]; private _fuel = [_target] call FUNC(getFuel); [ - 5, + REFUEL_PROGRESS_DURATION * 2.5, [_unit, _target, _fuel], { params ["_args"]; diff --git a/addons/refuel/functions/fnc_connectNozzleAction.sqf b/addons/refuel/functions/fnc_connectNozzleAction.sqf index 250da51e211..b1328636725 100644 --- a/addons/refuel/functions/fnc_connectNozzleAction.sqf +++ b/addons/refuel/functions/fnc_connectNozzleAction.sqf @@ -72,7 +72,7 @@ _endPosTestOffset = _startingOffset vectorAdd (_closeInUnitVector vectorMultiply _endPosTestOffset set [2, (_startingOffset select 2)]; [ - 2, + REFUEL_PROGRESS_DURATION, [_unit, _nozzle, _target, _endPosTestOffset], { params ["_args"]; diff --git a/addons/refuel/functions/fnc_maxDistanceDropNozzle.sqf b/addons/refuel/functions/fnc_maxDistanceDropNozzle.sqf index 2a23b5eb997..81ce6ccd2fc 100644 --- a/addons/refuel/functions/fnc_maxDistanceDropNozzle.sqf +++ b/addons/refuel/functions/fnc_maxDistanceDropNozzle.sqf @@ -49,6 +49,10 @@ if (_nozzle getVariable [QGVAR(jerryCan), false]) exitWith {}; if !(isNull _rope) then { ropeDestroy _rope; }; + private _helper = _nozzle getVariable [QGVAR(helper), objNull]; + if !(isNull _helper) then { + deleteVehicle _helper; + }; deleteVehicle _nozzle; } else { [LSTRING(Hint_TooFar), 2, _unit] call EFUNC(common,displayTextStructured); diff --git a/addons/refuel/functions/fnc_readFuelCounter.sqf b/addons/refuel/functions/fnc_readFuelCounter.sqf index 519b07897d6..1b1fb78e81b 100644 --- a/addons/refuel/functions/fnc_readFuelCounter.sqf +++ b/addons/refuel/functions/fnc_readFuelCounter.sqf @@ -19,7 +19,7 @@ params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]]]; [ - 2, + REFUEL_PROGRESS_DURATION, [_unit, _target], { params ["_args"]; diff --git a/addons/refuel/functions/fnc_reset.sqf b/addons/refuel/functions/fnc_reset.sqf index d58f0a48ad2..480beb6ca0f 100644 --- a/addons/refuel/functions/fnc_reset.sqf +++ b/addons/refuel/functions/fnc_reset.sqf @@ -31,6 +31,10 @@ if !(isNil "_nozzle") then { if !(isNull _rope) then { ropeDestroy _rope; }; + private _helper = _nozzle getVariable [QGVAR(helper), objNull]; + if !(isNull _helper) then { + deleteVehicle _helper; + }; { [QGVAR(resetLocal), [_x, _nozzle], _x] call CBA_fnc_targetEvent; diff --git a/addons/refuel/functions/fnc_returnNozzle.sqf b/addons/refuel/functions/fnc_returnNozzle.sqf index 1bd364eafb6..752be90d238 100644 --- a/addons/refuel/functions/fnc_returnNozzle.sqf +++ b/addons/refuel/functions/fnc_returnNozzle.sqf @@ -24,7 +24,7 @@ private _source = _nozzle getVariable QGVAR(source); if (isNull _nozzle || {_source != _target}) exitWith {false}; [ - 2, + REFUEL_PROGRESS_DURATION, [_unit, _nozzle, _target], { params ["_args"]; @@ -46,6 +46,10 @@ if (isNull _nozzle || {_source != _target}) exitWith {false}; if !(isNull _rope) then { ropeDestroy _rope; }; + private _helper = _nozzle getVariable [QGVAR(helper), objNull]; + if !(isNull _helper) then { + deleteVehicle _helper; + }; deleteVehicle _nozzle; [_target, "blockEngine", "ACE_Refuel", false] call EFUNC(common,statusEffect_set); diff --git a/addons/refuel/functions/fnc_takeNozzle.sqf b/addons/refuel/functions/fnc_takeNozzle.sqf index 006c5e09429..3012cdc860e 100644 --- a/addons/refuel/functions/fnc_takeNozzle.sqf +++ b/addons/refuel/functions/fnc_takeNozzle.sqf @@ -39,7 +39,7 @@ if (isNull _nozzle) then { // func is called on fuel truck _endPosOffset = _endPosOffset select 0; }; [ - 2, + REFUEL_PROGRESS_DURATION, [_unit, _target, _endPosOffset], { params ["_args"]; @@ -53,11 +53,22 @@ if (isNull _nozzle) then { // func is called on fuel truck _newNozzle attachTo [_unit, [-0.02,0.05,-0.12], "righthandmiddle1"]; _unit setVariable [QGVAR(nozzle), _newNozzle, true]; - if (_target isKindOf "AllVehicles") then { - // Currently ropeCreate requires its first parameter to be a real vehicle - private _rope = ropeCreate [_target, _endPosOffset, _newNozzle, [0, -0.20, 0.12], REFUEL_HOSE_LENGTH]; - _newNozzle setVariable [QGVAR(rope), _rope, true]; + private _ropeTarget = _target; + if (!(_target isKindOf "AllVehicles")) then { + private _helper = QGVAR(helper) createVehicle [0,0,0]; + [QEGVAR(common,hideObjectGlobal), [_helper, true]] call CBA_fnc_serverEvent; + if ((getText (configFile >> "CfgVehicles" >> typeOf _target >> "simulation")) isEqualTo "thingX") then { + _helper attachTo [_target, [0,0,0]]; + } else { + _helper setPosWorld (getPosWorld _target); + _helper setDir (getDir _target); + _helper setVectorUp (vectorUp _target); + }; + _newNozzle setVariable [QGVAR(helper), _helper, true]; + _ropeTarget = _helper; }; + private _rope = ropeCreate [_ropeTarget, _endPosOffset, _newNozzle, [0, -0.20, 0.12], REFUEL_HOSE_LENGTH]; + _newNozzle setVariable [QGVAR(rope), _rope, true]; _newNozzle setVariable [QGVAR(attachPos), _endPosOffset, true]; _newNozzle setVariable [QGVAR(source), _target, true]; @@ -93,7 +104,7 @@ if (isNull _nozzle) then { // func is called on fuel truck ] call EFUNC(common,progressBar); } else { // func is called on muzzle either connected or on ground [ - 2, + REFUEL_PROGRESS_DURATION, [_unit, _nozzle], { params ["_args"]; diff --git a/addons/refuel/functions/fnc_turnOff.sqf b/addons/refuel/functions/fnc_turnOff.sqf index 7ce3d9c874e..31308607bb1 100644 --- a/addons/refuel/functions/fnc_turnOff.sqf +++ b/addons/refuel/functions/fnc_turnOff.sqf @@ -19,7 +19,7 @@ params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]]]; [ - 2, + REFUEL_PROGRESS_DURATION, [_unit, _nozzle], { params ["_args"]; diff --git a/addons/refuel/functions/fnc_turnOn.sqf b/addons/refuel/functions/fnc_turnOn.sqf index 7a69de9b6f8..b7a4cf1bc98 100644 --- a/addons/refuel/functions/fnc_turnOn.sqf +++ b/addons/refuel/functions/fnc_turnOn.sqf @@ -19,7 +19,7 @@ params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]]]; [ - 2, + REFUEL_PROGRESS_DURATION, [_unit, _nozzle], { params ["_args"]; diff --git a/addons/refuel/script_component.hpp b/addons/refuel/script_component.hpp index 37b9502510b..a62e14048cd 100644 --- a/addons/refuel/script_component.hpp +++ b/addons/refuel/script_component.hpp @@ -19,6 +19,7 @@ #define REFUEL_INFINITE_FUEL -10 #define REFUEL_ACTION_DISTANCE 7 #define REFUEL_HOSE_LENGTH 12 +#define REFUEL_PROGRESS_DURATION 2 #define REFUEL_HOLSTER_WEAPON \ _unit setVariable [QGVAR(selectedWeaponOnRefuel), currentWeapon _unit]; \ diff --git a/addons/repair/CfgEventHandlers.hpp b/addons/repair/CfgEventHandlers.hpp index 559d2d4d7e4..3e47f9f96f1 100644 --- a/addons/repair/CfgEventHandlers.hpp +++ b/addons/repair/CfgEventHandlers.hpp @@ -37,7 +37,7 @@ class Extended_InitPost_EventHandlers { class Helicopter { class ADDON { init = QUOTE(_this call DFUNC(addRepairActions)); - exclude[] = {QEGVAR(fastroping,helper), "ACE_friesBase"}; + exclude[] = {QEGVAR(fastroping,helper), "ACE_friesBase", QEGVAR(refuel,helper)}; }; }; class Plane {