ACE3/addons/overpressure/functions/fnc_getOverPressureValues.sqf
bluefield 1439680795
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<number> return

* refactor: reuse return values for overpressure coef

* refactor: reuse return values for backblast coef

* whitespace

Co-authored-by: Drofseh <Drofseh@users.noreply.github.com>

* headers

Co-authored-by: Drofseh <Drofseh@users.noreply.github.com>
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

* feat: change backblast limit to 0

Co-authored-by: PabstMirror <pabstmirror@gmail.com>

* 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 <Drofseh@users.noreply.github.com>

* 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 <Drofseh@users.noreply.github.com>
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
Co-authored-by: PabstMirror <pabstmirror@gmail.com>
2024-06-20 22:30:33 +02:00

66 lines
1.8 KiB
Plaintext

#include "..\script_component.hpp"
/*
* Author: joko // Jonas
* Cache the shot data for a given weapon/mag/ammo combination.
* Will use the config that has the highest priority.
*
* Arguments:
* 0: Weapon <STRING>
* 1: Magazine <STRING>
* 2: Ammo <STRING>
*
* Return Value:
* Shot Config <ARRAY>:
* 0: Angle <Number>
* 1: Range <Number>
* 2: Damage <Number>
* 3: Offset <Number>
*
* Example:
* ["cannon_125mm","Sh_125mm_APFSDS_T_Green","24Rnd_125mm_APFSDS_T_Green"] call ace_overpressure_fnc_getOverPressureValues
*
* Public: No
*/
params ["_weapon", "_ammo", "_magazine"];
TRACE_3("Parameter",_weapon,_magazine,_ammo);
// Check cache for weapon/ammo/mag combo
private _return = GVAR(cacheHash) get _this;
if (!isNil "_return") exitWith {
TRACE_3("CacheHit",_weapon,_magazine,_ammo);
_return
};
// get Priority Array from Config
private _array = [
getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(priority)),
getNumber (configFile >> "CfgMagazines" >> _magazine >> QGVAR(priority)),
getNumber (configFile >> "CfgAmmo" >> _ammo >> QGVAR(priority))
];
(_array call CBA_fnc_findMax) params ["", ["_indexOfMaxPriority", 0, [0]]];
TRACE_2("Priority Array",_array,_indexOfMaxPriority);
// create the Config entry Point
private _config = [
(configFile >> "CfgWeapons" >> _weapon),
(configFile >> "CfgMagazines" >> _magazine),
(configFile >> "CfgAmmo" >> _ammo)
] select _indexOfMaxPriority;
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))),
(getNumber (_config >> QGVAR(damage))),
(getNumber (_config >> QGVAR(offset)))
];
GVAR(cacheHash) set [_this, _return];
TRACE_2("Return",_this,_return);
_return