Skip to content

Commit

Permalink
Overpressure - Separate backblast and overpressure range coefficient (a…
Browse files Browse the repository at this point in the history
…cemod#10070)

* feat: separate overpressure and backblast configurations

* documentation: remove undefined return

* typo: trace macro padding

* refactor: add range<number> return

* refactor: reuse return values for overpressure coef

* refactor: reuse return values for backblast coef

* whitespace

Co-authored-by: Drofseh <[email protected]>

* headers

Co-authored-by: Drofseh <[email protected]>
Co-authored-by: johnb432 <[email protected]>

* feat: change backblast limit to 0

Co-authored-by: PabstMirror <[email protected]>

* 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 <[email protected]>

* typo: fix spacing

Co-authored-by: johnb432 <[email protected]>

* feat: switch distanceCoef minimun value to 0

Co-authored-by: johnb432 <[email protected]>

* typo: update the slider checks with new minimuns

temporary solution until i figure out the EH

Co-authored-by: johnb432 <[email protected]>

* 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 <[email protected]>
Co-authored-by: Drofseh <[email protected]>
Co-authored-by: johnb432 <[email protected]>
Co-authored-by: PabstMirror <[email protected]>
  • Loading branch information
5 people authored and blake8090 committed Aug 18, 2024
1 parent f159efb commit 0bdaddc
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 29 deletions.
5 changes: 0 additions & 5 deletions addons/overpressure/ACE_Settings.hpp

This file was deleted.

13 changes: 8 additions & 5 deletions addons/overpressure/XEH_postInit.sqf
Original file line number Diff line number Diff line change
@@ -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;
1 change: 0 additions & 1 deletion addons/overpressure/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ class CfgPatches {
};
};

#include "ACE_Settings.hpp"
#include "CfgEventHandlers.hpp"
#include "CfgWeapons.hpp"
#include "ACE_Arsenal_Stats.hpp"
2 changes: 2 additions & 0 deletions addons/overpressure/functions/fnc_firedEHBB.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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 {};
Expand Down
2 changes: 2 additions & 0 deletions addons/overpressure/functions/fnc_firedEHOP.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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 {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
];
Expand Down
20 changes: 17 additions & 3 deletions addons/overpressure/initSettings.inc.sqf
Original file line number Diff line number Diff line change
@@ -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;
34 changes: 20 additions & 14 deletions addons/overpressure/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,26 @@
<Spanish>Coeficiente de distancia de sobrepresión</Spanish>
</Key>
<Key ID="STR_ACE_Overpressure_distanceCoefficient_toolTip">
<English>Scales the overpressure effect [Default: 1]</English>
<German>Stellt den Koeffizient für die Überdruckentfernung ein [Standard: 1]</German>
<Japanese>過圧効果の範囲 [デフォルト: 1]</Japanese>
<Korean>과중압력의 효과 크기 [기본설정: 1]</Korean>
<Polish>Skaluje efekt nadciśnienia [Domyślne: 1]</Polish>
<French>Ajuste l'effet de surpression. Valeur par défaut : 1.</French>
<Italian>Scala l'effetto di sovrapressione [Predefinito: 1]</Italian>
<Chinesesimp>超压影响的范围 [预设:1]</Chinesesimp>
<Chinese>高壓影響的範圍 [預設: 1]</Chinese>
<Russian>Степень зависимости избыточного давления от расстояния [По умолчанию: 1]</Russian>
<Portuguese>Escala o efeito de sobrepressão [Padrão: 1]</Portuguese>
<Hungarian>Állítja a túlnyomás hatását [Alapértelmezett: 1]</Hungarian>
<Czech>Nastavuje jak velký je efekt přetlaku [Standard: 1]</Czech>
<Spanish>Escala el efecto de sobrepresión [Predeterminado: 1]</Spanish>
<English>Scales the overpressure effect</English>
<German>Stellt den Koeffizient für die Überdruckentfernung ein</German>
<Japanese>過圧効果の範囲</Japanese>
<Korean>과중압력의 효과 크기</Korean>
<Polish>Skaluje efekt nadciśnienia</Polish>
<French>Ajuste l'effet de surpression</French>
<Italian>Scala l'effetto di sovrapressione</Italian>
<Chinesesimp>超压影响的范围</Chinesesimp>
<Chinese>高壓影響的範圍</Chinese>
<Russian>Степень зависимости избыточного давления от расстояния</Russian>
<Portuguese>Escala o efeito de sobrepressão</Portuguese>
<Hungarian>Állítja a túlnyomás hatását</Hungarian>
<Czech>Nastavuje jak velký je efekt přetlaku</Czech>
<Spanish>Escala el efecto de sobrepresión</Spanish>
</Key>
<Key ID="STR_ACE_Overpressure_backblastDistanceCoefficient_displayName">
<English>Backblast Distance Coefficient</English>
</Key>
<Key ID="STR_ACE_Overpressure_backblastDistanceCoefficient_toolTip">
<English>Scales the backblast effect</English>
</Key>
<Key ID="STR_ACE_Overpressure_statBackblastRange">
<English>Backblast range</English>
Expand Down

0 comments on commit 0bdaddc

Please sign in to comment.