From f3c66e83b4bd76d61570b20faede1527f7c9a513 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ozan=20E=C4=9Fitmen?= Date: Wed, 17 Aug 2022 14:25:37 +0300 Subject: [PATCH] Refuel - Add Progress Bar Duration Setting (#8971) * Refuel: Allow changing progress bars' duration * Clarify Turkish progressDuration_DisplayName * Update addons/refuel/functions/fnc_moduleRefuelSettings.sqf * Change progressDuration setting's type to TIME * Update progressDuration setting display name, add description too Co-authored-by: PabstMirror --- addons/refuel/CfgVehicles.hpp | 5 +++++ addons/refuel/defines.hpp | 1 - addons/refuel/functions/fnc_checkFuel.sqf | 2 +- addons/refuel/functions/fnc_connectNozzleAction.sqf | 2 +- addons/refuel/functions/fnc_moduleRefuelSettings.sqf | 3 ++- addons/refuel/functions/fnc_returnNozzle.sqf | 2 +- addons/refuel/functions/fnc_takeNozzle.sqf | 2 +- addons/refuel/initSettings.sqf | 9 +++++++++ addons/refuel/script_component.hpp | 7 ------- addons/refuel/stringtable.xml | 10 +++++++++- 10 files changed, 29 insertions(+), 14 deletions(-) diff --git a/addons/refuel/CfgVehicles.hpp b/addons/refuel/CfgVehicles.hpp index 6745469a2a..adce2a8af2 100644 --- a/addons/refuel/CfgVehicles.hpp +++ b/addons/refuel/CfgVehicles.hpp @@ -78,6 +78,11 @@ class CfgVehicles { typeName = "NUMBER"; defaultValue = 12; }; + class progressDuration { + displayName = CSTRING(RefuelSettings_progressDuration_DisplayName); + typeName = "NUMBER"; + defaultValue = 2; + }; }; }; diff --git a/addons/refuel/defines.hpp b/addons/refuel/defines.hpp index dc9055da9a..761eb08641 100644 --- a/addons/refuel/defines.hpp +++ b/addons/refuel/defines.hpp @@ -2,4 +2,3 @@ #define REFUEL_DISABLED_FUEL -1 #define REFUEL_ACTION_DISTANCE 7 #define REFUEL_NOZZLE_ACTION_DISTANCE 2 -#define REFUEL_PROGRESS_DURATION 2 diff --git a/addons/refuel/functions/fnc_checkFuel.sqf b/addons/refuel/functions/fnc_checkFuel.sqf index 275ad7999b..72c1c2b896 100644 --- a/addons/refuel/functions/fnc_checkFuel.sqf +++ b/addons/refuel/functions/fnc_checkFuel.sqf @@ -21,7 +21,7 @@ params [["_unit", objNull, [objNull]], ["_source", objNull, [objNull]]]; private _fuel = [_source] call FUNC(getFuel); [ - TIME_PROGRESSBAR(REFUEL_PROGRESS_DURATION * 2), + GVAR(progressDuration) * 2, [_unit, _source, _fuel], { params ["_args"]; diff --git a/addons/refuel/functions/fnc_connectNozzleAction.sqf b/addons/refuel/functions/fnc_connectNozzleAction.sqf index f2e38c34a0..97778d3e83 100644 --- a/addons/refuel/functions/fnc_connectNozzleAction.sqf +++ b/addons/refuel/functions/fnc_connectNozzleAction.sqf @@ -65,7 +65,7 @@ _bestPosASL = _bestPosASL vectorAdd ((_bestPosASL vectorFromTo _startingPosASL) private _attachPosModel = _sink worldToModel (ASLtoAGL _bestPosASL); [ - TIME_PROGRESSBAR(REFUEL_PROGRESS_DURATION), + GVAR(progressDuration), [_unit, _nozzle, _sink, _attachPosModel], { params ["_args"]; diff --git a/addons/refuel/functions/fnc_moduleRefuelSettings.sqf b/addons/refuel/functions/fnc_moduleRefuelSettings.sqf index fabdad1706..1972397986 100644 --- a/addons/refuel/functions/fnc_moduleRefuelSettings.sqf +++ b/addons/refuel/functions/fnc_moduleRefuelSettings.sqf @@ -23,5 +23,6 @@ if !(_activated) exitWith {}; [_logic, QGVAR(rate), "rate"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(hoseLength), "hoseLength"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(progressDuration), "progressDuration"] call EFUNC(common,readSettingFromModule); -INFO_2("Refuel Module Initialized with flow rate: %1 - hoseLength: %2",GVAR(rate), GVAR(hoseLength)) +INFO_3("Refuel Module Initialized with flow rate: %1 - hoseLength: %2 - progressDuration: %3",GVAR(rate),GVAR(hoseLength),GVAR(progressDuration)) diff --git a/addons/refuel/functions/fnc_returnNozzle.sqf b/addons/refuel/functions/fnc_returnNozzle.sqf index 3cc2f773f0..5f1eed2721 100644 --- a/addons/refuel/functions/fnc_returnNozzle.sqf +++ b/addons/refuel/functions/fnc_returnNozzle.sqf @@ -23,7 +23,7 @@ private _nozzle = _unit getVariable [QGVAR(nozzle), objNull]; if (isNull _nozzle || {_source != _nozzle getVariable QGVAR(source)}) exitWith {}; [ - TIME_PROGRESSBAR(REFUEL_PROGRESS_DURATION), + GVAR(progressDuration), [_unit, _nozzle, _source], { params ["_args"]; diff --git a/addons/refuel/functions/fnc_takeNozzle.sqf b/addons/refuel/functions/fnc_takeNozzle.sqf index efb0256654..0292e9ec66 100644 --- a/addons/refuel/functions/fnc_takeNozzle.sqf +++ b/addons/refuel/functions/fnc_takeNozzle.sqf @@ -22,7 +22,7 @@ params [ ]; [ - TIME_PROGRESSBAR(REFUEL_PROGRESS_DURATION), + GVAR(progressDuration), [_unit, _object], { params ["_args"]; diff --git a/addons/refuel/initSettings.sqf b/addons/refuel/initSettings.sqf index 160c3ef22d..52e3c7ee8c 100644 --- a/addons/refuel/initSettings.sqf +++ b/addons/refuel/initSettings.sqf @@ -15,3 +15,12 @@ true, // isGlobal {[QGVAR(hoseLength), _this] call EFUNC(common,cbaSettings_settingChanged)} ] call CBA_fnc_addSetting; + +[ + QGVAR(progressDuration), "TIME", + [LSTRING(RefuelSettings_progressDuration_DisplayName), LSTRING(RefuelSettings_progressDuration_Description)], + [localize ELSTRING(OptionsMenu,CategoryLogistics), localize "str_state_refuel"], + [0, 10, 2], // [min, max, default value] + true, // isGlobal + {[QGVAR(progressDuration), _this] call EFUNC(common,cbaSettings_settingChanged)} +] call CBA_fnc_addSetting; diff --git a/addons/refuel/script_component.hpp b/addons/refuel/script_component.hpp index 09d0afc599..76d9b67819 100644 --- a/addons/refuel/script_component.hpp +++ b/addons/refuel/script_component.hpp @@ -2,7 +2,6 @@ #define COMPONENT_BEAUTIFIED Refuel #include "\z\ace\addons\main\script_mod.hpp" -// #define FAST_PROGRESSBARS // #define DRAW_HOOKS_POS // #define DEBUG_MODE_FULL // #define DISABLE_COMPILE_CACHE @@ -20,11 +19,5 @@ #include "\z\ace\addons\refuel\defines.hpp" -#ifdef FAST_PROGRESSBARS - #define TIME_PROGRESSBAR(X) ((X) * 0.075) -#else - #define TIME_PROGRESSBAR(X) (X) -#endif - #define INTERACT_EXCEPTIONS_REFUELING "isNotInside", "isNotOnLadder", "isNotSwimming" #define INTERACT_EXCEPTIONS INTERACT_EXCEPTIONS_REFUELING, "isNotRefueling" diff --git a/addons/refuel/stringtable.xml b/addons/refuel/stringtable.xml index 0a10e938c4..90ace6c7c1 100644 --- a/addons/refuel/stringtable.xml +++ b/addons/refuel/stringtable.xml @@ -479,7 +479,15 @@ Comprimento da Mangueira de Combustível Longueur du tuyau Délka hadice na palivo - Yakıt poması uzunluğu + Yakıt hortumu uzunluğu + + + Pump/Hose Interaction Time + Pompa/Hortum Etkileşim Süresi + + + How long refuel interactions take in seconds. + Saniye biriminde yakıt ikmali etkileşimlerinin süresi. Fuel Cargo Volume