From afe862324e7fd7b0b83fc9bc02cfc33e9b4c7334 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Wed, 31 May 2017 11:30:48 -0500 Subject: [PATCH] Refuel - Add setting for hose length (#5224) --- addons/refuel/ACE_Settings.hpp | 6 ++++++ addons/refuel/CfgVehicles.hpp | 5 +++++ addons/refuel/functions/fnc_maxDistanceDropNozzle.sqf | 3 ++- addons/refuel/functions/fnc_moduleRefuelSettings.sqf | 3 ++- addons/refuel/functions/fnc_refuel.sqf | 3 ++- addons/refuel/functions/fnc_takeNozzle.sqf | 3 ++- addons/refuel/script_component.hpp | 1 - addons/refuel/stringtable.xml | 5 +++++ docs/wiki/feature/refuel.md | 6 ++++++ 9 files changed, 30 insertions(+), 5 deletions(-) diff --git a/addons/refuel/ACE_Settings.hpp b/addons/refuel/ACE_Settings.hpp index b38a880641..a25c36a2ba 100644 --- a/addons/refuel/ACE_Settings.hpp +++ b/addons/refuel/ACE_Settings.hpp @@ -6,4 +6,10 @@ class ACE_Settings { value = 1; typeName = "SCALAR"; }; + class GVAR(hoseLength) { + category = ECSTRING(OptionsMenu,CategoryLogistics); + displayName = CSTRING(RefuelSettings_hoseLength_DisplayName); + value = 12; + typeName = "SCALAR"; + }; }; diff --git a/addons/refuel/CfgVehicles.hpp b/addons/refuel/CfgVehicles.hpp index 87e7e3e80b..3a28762b79 100644 --- a/addons/refuel/CfgVehicles.hpp +++ b/addons/refuel/CfgVehicles.hpp @@ -119,6 +119,11 @@ class CfgVehicles { typeName = "NUMBER"; defaultValue = 10; }; + class hoseLength { + displayName = CSTRING(RefuelSettings_hoseLength_DisplayName); + typeName = "NUMBER"; + defaultValue = 12; + }; }; }; diff --git a/addons/refuel/functions/fnc_maxDistanceDropNozzle.sqf b/addons/refuel/functions/fnc_maxDistanceDropNozzle.sqf index 81ce6ccd2f..0f83f48fbb 100644 --- a/addons/refuel/functions/fnc_maxDistanceDropNozzle.sqf +++ b/addons/refuel/functions/fnc_maxDistanceDropNozzle.sqf @@ -38,7 +38,8 @@ if (_nozzle getVariable [QGVAR(jerryCan), false]) exitWith {}; [_pfID] call CBA_fnc_removePerFrameHandler; }; - if (isNull _source || {_unit distance (_source modelToWorld _endPosOffset) > (REFUEL_HOSE_LENGTH - 2)} || {!alive _source}) exitWith { + private _hoseLength = _source getVariable [QGVAR(hoseLength), GVAR(hoseLength)]; + if (isNull _source || {_unit distance (_source modelToWorld _endPosOffset) > (_hoseLength - 2)} || {!alive _source}) exitWith { if !(isNull _nozzle) then { [_unit, _nozzle] call FUNC(dropNozzle); REFUEL_UNHOLSTER_WEAPON diff --git a/addons/refuel/functions/fnc_moduleRefuelSettings.sqf b/addons/refuel/functions/fnc_moduleRefuelSettings.sqf index 4d8f89425e..8322118a90 100644 --- a/addons/refuel/functions/fnc_moduleRefuelSettings.sqf +++ b/addons/refuel/functions/fnc_moduleRefuelSettings.sqf @@ -20,5 +20,6 @@ params ["_logic", "", ["_activated", false, [false]]]; if !(_activated) exitWith {}; [_logic, QGVAR(rate), "rate"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(hoseLength), "hoseLength"] call EFUNC(common,readSettingFromModule); -diag_log text format ["[ACE]: Refuel Module Initialized with flow rate: %1", GVAR(rate)]; +INFO_2("Refuel Module Initialized with flow rate: %1 - hoseLength: %2",GVAR(rate), GVAR(hoseLength)) diff --git a/addons/refuel/functions/fnc_refuel.sqf b/addons/refuel/functions/fnc_refuel.sqf index 773d85e08d..2c8f6c1a8c 100644 --- a/addons/refuel/functions/fnc_refuel.sqf +++ b/addons/refuel/functions/fnc_refuel.sqf @@ -44,7 +44,8 @@ if (_maxFuel == 0) then { _sink setVariable [QGVAR(nozzle), objNull, true]; [_pfID] call CBA_fnc_removePerFrameHandler; }; - private _tooFar = ((_sink modelToWorld _connectToPoint) distance (_source modelToWorld _connectFromPoint)) > (REFUEL_HOSE_LENGTH - 2); + private _hoseLength = _source getVariable [QGVAR(hoseLength), GVAR(hoseLength)]; + private _tooFar = ((_sink modelToWorld _connectToPoint) distance (_source modelToWorld _connectFromPoint)) > (_hoseLength - 2); if (_tooFar && {!(_nozzle getVariable [QGVAR(jerryCan), false])}) exitWith { [LSTRING(Hint_TooFar), 2, _unit] call EFUNC(common,displayTextStructured); diff --git a/addons/refuel/functions/fnc_takeNozzle.sqf b/addons/refuel/functions/fnc_takeNozzle.sqf index 3012cdc860..285dd37ced 100644 --- a/addons/refuel/functions/fnc_takeNozzle.sqf +++ b/addons/refuel/functions/fnc_takeNozzle.sqf @@ -67,7 +67,8 @@ if (isNull _nozzle) then { // func is called on fuel truck _newNozzle setVariable [QGVAR(helper), _helper, true]; _ropeTarget = _helper; }; - private _rope = ropeCreate [_ropeTarget, _endPosOffset, _newNozzle, [0, -0.20, 0.12], REFUEL_HOSE_LENGTH]; + private _hoseLength = _target getVariable [QGVAR(hoseLength), GVAR(hoseLength)]; + private _rope = ropeCreate [_ropeTarget, _endPosOffset, _newNozzle, [0, -0.20, 0.12], _hoseLength]; _newNozzle setVariable [QGVAR(rope), _rope, true]; _newNozzle setVariable [QGVAR(attachPos), _endPosOffset, true]; _newNozzle setVariable [QGVAR(source), _target, true]; diff --git a/addons/refuel/script_component.hpp b/addons/refuel/script_component.hpp index 989f6ad048..19f12ed366 100644 --- a/addons/refuel/script_component.hpp +++ b/addons/refuel/script_component.hpp @@ -18,7 +18,6 @@ #define REFUEL_INFINITE_FUEL -10 #define REFUEL_ACTION_DISTANCE 7 -#define REFUEL_HOSE_LENGTH 12 #define REFUEL_PROGRESS_DURATION 2 #define REFUEL_HOLSTER_WEAPON \ diff --git a/addons/refuel/stringtable.xml b/addons/refuel/stringtable.xml index 0bc50bb63d..4522ddd620 100644 --- a/addons/refuel/stringtable.xml +++ b/addons/refuel/stringtable.xml @@ -404,5 +404,10 @@ %1 リッターがある %1 리터가 재급유되었습니다. + + Refuel hose length + Betankung Schlauchlänge + Reabastecer longitud de manguera + diff --git a/docs/wiki/feature/refuel.md b/docs/wiki/feature/refuel.md index 939879caa0..b069d9dba2 100644 --- a/docs/wiki/feature/refuel.md +++ b/docs/wiki/feature/refuel.md @@ -65,6 +65,12 @@ Please check the framework description for more details. ### Something broke, I can't use the fuel truck / nozzle any longer. What to do? You can reset the fuel truck and its nozzle by calling `ace_refuel_fnc_reset` with its first parameter being the fuel truck object. +### How do I increase the length of the hose? +There is a global setting that will effect all vehicles and static pumps. To only effect a specific vehicle put the following in it's init box: +```cpp +this setVariable ["ace_refuel_hoseLength", 30]; +``` + ## 4. Dependencies {% include dependencies_list.md component="refuel" %}