From 0bdaddc786849999edecbdbd2ea1e4b936229d1b Mon Sep 17 00:00:00 2001 From: bluefield <59333909+bluefieldcreator@users.noreply.github.com> Date: Thu, 20 Jun 2024 22:30:33 +0200 Subject: [PATCH] Overpressure - Separate backblast and overpressure range coefficient (#10070) * feat: separate overpressure and backblast configurations * documentation: remove undefined return * typo: trace macro padding * refactor: add range return * refactor: reuse return values for overpressure coef * refactor: reuse return values for backblast coef * whitespace Co-authored-by: Drofseh * headers Co-authored-by: Drofseh Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> * feat: change backblast limit to 0 Co-authored-by: PabstMirror * remove: deleted ACE_Settings.hpp * fix: update postInit.sqf event handler to register new GVARs * fix: remove `ACE_Settings.hpp` * typo: add spacing Co-authored-by: Drofseh * typo: fix spacing Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> * feat: switch distanceCoef minimun value to 0 Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> * typo: update the slider checks with new minimuns temporary solution until i figure out the EH Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> * feat: new stringable elements * Update stringtable.xml * Added translations * Switched order of settings to match age of settings * setting require restart, split adding firedEH * Added notifications about mission restart --------- Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> Co-authored-by: Drofseh Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> Co-authored-by: PabstMirror --- addons/overpressure/ACE_Settings.hpp | 5 --- addons/overpressure/XEH_postInit.sqf | 13 ++++--- addons/overpressure/config.cpp | 1 - .../overpressure/functions/fnc_firedEHBB.sqf | 2 ++ .../overpressure/functions/fnc_firedEHOP.sqf | 2 ++ .../functions/fnc_getOverPressureValues.sqf | 2 +- addons/overpressure/initSettings.inc.sqf | 20 +++++++++-- addons/overpressure/stringtable.xml | 34 +++++++++++-------- 8 files changed, 50 insertions(+), 29 deletions(-) delete mode 100644 addons/overpressure/ACE_Settings.hpp diff --git a/addons/overpressure/ACE_Settings.hpp b/addons/overpressure/ACE_Settings.hpp deleted file mode 100644 index d46cae7498b..00000000000 --- a/addons/overpressure/ACE_Settings.hpp +++ /dev/null @@ -1,5 +0,0 @@ -class ACE_Settings { - class GVAR(distanceCoefficient) { - movedToSQF = 1; - }; -}; diff --git a/addons/overpressure/XEH_postInit.sqf b/addons/overpressure/XEH_postInit.sqf index 46fe4602682..4b014e89e24 100644 --- a/addons/overpressure/XEH_postInit.sqf +++ b/addons/overpressure/XEH_postInit.sqf @@ -1,14 +1,17 @@ #include "script_component.hpp" ["CBA_settingsInitialized", { - TRACE_1("settingsInit eh",GVAR(distanceCoefficient)); - if (GVAR(distanceCoefficient) <= 0) exitWith {}; + TRACE_2("settingsInit eh",GVAR(backblastDistanceCoefficient),GVAR(overpressureDistanceCoefficient)); ["ace_overpressure", LINKFUNC(overpressureDamage)] call CBA_fnc_addEventHandler; - // Register fire event handler - ["ace_firedPlayer", LINKFUNC(firedEHBB)] call CBA_fnc_addEventHandler; - ["ace_firedPlayerVehicle", LINKFUNC(firedEHOP)] call CBA_fnc_addEventHandler; + // Register fire event handlers + if (GVAR(backblastDistanceCoefficient) > 0) then { + ["ace_firedPlayer", LINKFUNC(firedEHBB)] call CBA_fnc_addEventHandler; + }; + if (GVAR(overpressureDistanceCoefficient) > 0) then { + ["ace_firedPlayerVehicle", LINKFUNC(firedEHOP)] call CBA_fnc_addEventHandler; + }; GVAR(cacheHash) = createHashMap; }] call CBA_fnc_addEventHandler; diff --git a/addons/overpressure/config.cpp b/addons/overpressure/config.cpp index 3815cc831fa..7274cd50593 100644 --- a/addons/overpressure/config.cpp +++ b/addons/overpressure/config.cpp @@ -14,7 +14,6 @@ class CfgPatches { }; }; -#include "ACE_Settings.hpp" #include "CfgEventHandlers.hpp" #include "CfgWeapons.hpp" #include "ACE_Arsenal_Stats.hpp" diff --git a/addons/overpressure/functions/fnc_firedEHBB.sqf b/addons/overpressure/functions/fnc_firedEHBB.sqf index a0277859402..05a761bf068 100644 --- a/addons/overpressure/functions/fnc_firedEHBB.sqf +++ b/addons/overpressure/functions/fnc_firedEHBB.sqf @@ -22,6 +22,8 @@ TRACE_10("firedEH:",_unit,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile,_veh private _bbValues = [_weapon, _ammo, _magazine] call FUNC(getOverPressureValues); _bbValues params ["_backblastAngle", "_backblastRange", "_backblastDamage", "_offset"]; +_backblastRange = _backblastRange * GVAR(backblastDistanceCoefficient); + TRACE_4("cache",_backblastAngle,_backblastRange,_backblastDamage,_offset); if (_backblastDamage <= 0) exitWith {}; diff --git a/addons/overpressure/functions/fnc_firedEHOP.sqf b/addons/overpressure/functions/fnc_firedEHOP.sqf index 2345d093273..e011098b59e 100644 --- a/addons/overpressure/functions/fnc_firedEHOP.sqf +++ b/addons/overpressure/functions/fnc_firedEHOP.sqf @@ -22,6 +22,8 @@ TRACE_10("firedEH:",_unit,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile,_veh private _opValues = [_weapon, _ammo, _magazine] call FUNC(getOverPressureValues); _opValues params ["_dangerZoneAngle", "_dangerZoneRange", "_dangerZoneDamage"]; +_dangerZoneRange = _dangerZoneRange * GVAR(overpressureDistanceCoefficient); + TRACE_3("cache",_dangerZoneAngle,_dangerZoneRange,_dangerZoneDamage); if (_dangerZoneDamage <= 0) exitWith {}; diff --git a/addons/overpressure/functions/fnc_getOverPressureValues.sqf b/addons/overpressure/functions/fnc_getOverPressureValues.sqf index 4372d4c8e6d..374e9de9d66 100644 --- a/addons/overpressure/functions/fnc_getOverPressureValues.sqf +++ b/addons/overpressure/functions/fnc_getOverPressureValues.sqf @@ -54,7 +54,7 @@ TRACE_1("ConfigPath",_config); // get the Variables out of the Configs and populate return array with them _return = [ (getNumber (_config >> QGVAR(angle))), - (getNumber (_config >> QGVAR(range))) * GVAR(distanceCoefficient), + (getNumber (_config >> QGVAR(range))), (getNumber (_config >> QGVAR(damage))), (getNumber (_config >> QGVAR(offset))) ]; diff --git a/addons/overpressure/initSettings.inc.sqf b/addons/overpressure/initSettings.inc.sqf index 7fe64011313..ece1230dcce 100644 --- a/addons/overpressure/initSettings.inc.sqf +++ b/addons/overpressure/initSettings.inc.sqf @@ -1,9 +1,23 @@ private _category = [LELSTRING(common,categoryUncategorized), LLSTRING(DisplayName)]; [ - QGVAR(distanceCoefficient), "SLIDER", + QGVAR(overpressureDistanceCoefficient), + "SLIDER", [LSTRING(distanceCoefficient_displayName), LSTRING(distanceCoefficient_toolTip)], _category, - [-1, 10, 1, 1], - 1 + [0, 10, 1, 1], + 1, + {[QGVAR(overpressureDistanceCoefficient), _this] call EFUNC(common,cbaSettings_settingChanged)}, + true // Needs mission restart +] call CBA_fnc_addSetting; + +[ + QGVAR(backblastDistanceCoefficient), + "SLIDER", + [LSTRING(backblastDistanceCoefficient_displayName), LSTRING(backblastDistanceCoefficient_toolTip)], + _category, + [0, 10, 1, 1], + 1, + {[QGVAR(backblastDistanceCoefficient), _this] call EFUNC(common,cbaSettings_settingChanged)}, + true // Needs mission restart ] call CBA_fnc_addSetting; diff --git a/addons/overpressure/stringtable.xml b/addons/overpressure/stringtable.xml index caade38c3d3..d8b9ad12f40 100644 --- a/addons/overpressure/stringtable.xml +++ b/addons/overpressure/stringtable.xml @@ -30,20 +30,26 @@ Coeficiente de distancia de sobrepresión - Scales the overpressure effect [Default: 1] - Stellt den Koeffizient für die Überdruckentfernung ein [Standard: 1] - 過圧効果の範囲 [デフォルト: 1] - 과중압력의 효과 크기 [기본설정: 1] - Skaluje efekt nadciśnienia [Domyślne: 1] - Ajuste l'effet de surpression. Valeur par défaut : 1. - Scala l'effetto di sovrapressione [Predefinito: 1] - 超压影响的范围 [预设:1] - 高壓影響的範圍 [預設: 1] - Степень зависимости избыточного давления от расстояния [По умолчанию: 1] - Escala o efeito de sobrepressão [Padrão: 1] - Állítja a túlnyomás hatását [Alapértelmezett: 1] - Nastavuje jak velký je efekt přetlaku [Standard: 1] - Escala el efecto de sobrepresión [Predeterminado: 1] + Scales the overpressure effect + Stellt den Koeffizient für die Überdruckentfernung ein + 過圧効果の範囲 + 과중압력의 효과 크기 + Skaluje efekt nadciśnienia + Ajuste l'effet de surpression + Scala l'effetto di sovrapressione + 超压影响的范围 + 高壓影響的範圍 + Степень зависимости избыточного давления от расстояния + Escala o efeito de sobrepressão + Állítja a túlnyomás hatását + Nastavuje jak velký je efekt přetlaku + Escala el efecto de sobrepresión + + + Backblast Distance Coefficient + + + Scales the backblast effect Backblast range