ACE3/addons/overpressure/functions/fnc_cacheOverPressureValues.sqf

58 lines
1.6 KiB
Plaintext
Raw Normal View History

2015-07-10 22:09:20 +00:00
/*
* Author: joko // Jonas
* Cache the shot data for a given weapon/mag/ammo combination.
* Will use the config that has the highest priority.
2015-07-10 22:09:20 +00:00
*
* Argument:
* 0: Weapon <STRING>
* 1: Magazine <STRING>
* 2: Ammo <STRING>
2015-07-10 22:09:20 +00:00
*
* Return value:
* Shot Config <ARRAY>:
* 0: Angle <Number>
* 1: Range <Number>
* 2: Damage <Number>
2015-07-10 22:09:20 +00:00
*
* Example:
* ["cannon_125mm","Sh_125mm_APFSDS_T_Green","24Rnd_125mm_APFSDS_T_Green"] call ace_overpressure_fnc_cacheOverPressureValues
*
* Public: No
2015-07-10 22:09:20 +00:00
*/
#include "script_component.hpp"
2015-07-10 22:09:20 +00:00
2015-08-30 21:40:53 +00:00
params ["_weapon", "_ammo", "_magazine"];
2015-08-30 21:10:03 +00:00
TRACE_3("Parameter",_weapon,_magazine,_ammo);
// 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]]];
2015-09-06 17:34:46 +00:00
TRACE_2("Priority Array",_array,_indexOfMaxPriority);
2015-09-06 17:34:46 +00:00
// create the Config entry Point
private _config = [
(configFile >> "CfgWeapons" >> _weapon),
(configFile >> "CfgMagazines" >> _magazine),
2015-08-30 20:59:27 +00:00
(configFile >> "CfgAmmo" >> _ammo)
] select _indexOfMaxPriority;
2015-08-30 21:10:03 +00:00
TRACE_1("ConfigPath",_config);
// get the Variables out of the Configes and create a array with then
private _return = [
(getNumber (_config >> QGVAR(angle))),
(getNumber (_config >> QGVAR(range))),
(getNumber (_config >> QGVAR(damage)))
];
private _varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine];
2016-01-16 23:48:58 +00:00
missionNameSpace setVariable [_varName, _return];
TRACE_2("Return",_varName,_return);
_return