2015-07-10 22:09:20 +00:00
|
|
|
/*
|
|
|
|
* Author: joko // Jonas
|
|
|
|
*
|
|
|
|
* Handle fire of local launchers
|
|
|
|
*
|
|
|
|
* Argument:
|
2015-08-30 05:35:58 +00:00
|
|
|
* 0: Weapon <STRING>
|
|
|
|
* 1: Magazine <STRING>
|
|
|
|
* 2: Ammo <STRING>
|
2015-07-10 22:09:20 +00:00
|
|
|
*
|
|
|
|
* Return value:
|
|
|
|
* Array:
|
2015-08-30 05:35:58 +00:00
|
|
|
* 0: Angle <Number>
|
|
|
|
* 1: Range <Number>
|
|
|
|
* 2: Damage <Number>
|
2015-07-10 22:09:20 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
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);
|
2015-08-30 05:35:58 +00:00
|
|
|
|
2015-09-06 17:34:46 +00:00
|
|
|
private ["_array", "_type", "_return", "_config" /*, "_priority"*/];
|
2015-08-30 05:35:58 +00:00
|
|
|
|
|
|
|
// get Priority Array from Config
|
|
|
|
_array = [
|
2015-11-06 19:02:54 +00:00
|
|
|
getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(priority)),
|
|
|
|
getNumber (configFile >> "CfgMagazines" >> _magazine >> QGVAR(priority)),
|
|
|
|
getNumber (configFile >> "CfgAmmo" >> _ammo >> QGVAR(priority))
|
2015-08-30 05:35:58 +00:00
|
|
|
];
|
|
|
|
|
2015-08-30 21:10:03 +00:00
|
|
|
TRACE_1("Proiroity Array",_array);
|
2015-09-06 17:34:46 +00:00
|
|
|
|
|
|
|
/* for CBA Upadte 2.1
|
|
|
|
_priority = _array call CBA_fnc_findMax;
|
|
|
|
_type = if (isNil "_priority") then {
|
|
|
|
0
|
|
|
|
} else {
|
|
|
|
_priority select 1
|
|
|
|
};
|
|
|
|
*/
|
|
|
|
|
|
|
|
// obsolete as CBA Update 2.1 start
|
2015-08-30 05:35:58 +00:00
|
|
|
_array params ["_max"];
|
|
|
|
|
2015-09-08 17:45:46 +00:00
|
|
|
// set Default type
|
|
|
|
_type = 0;
|
2015-08-30 05:35:58 +00:00
|
|
|
// get Highest Entry out the the Priority Array
|
|
|
|
{
|
|
|
|
if (_max < _x) then {
|
|
|
|
_max = _x;
|
|
|
|
_type = _forEachIndex;
|
|
|
|
};
|
|
|
|
} forEach _array;
|
2015-09-06 17:34:46 +00:00
|
|
|
// obsolete end
|
2015-08-30 05:35:58 +00:00
|
|
|
|
2015-08-30 21:10:03 +00:00
|
|
|
TRACE_2("Highest Value",_max,_type);
|
2015-08-30 05:35:58 +00:00
|
|
|
// create the Config entry Point
|
2015-08-30 21:10:03 +00:00
|
|
|
_config = [
|
2015-08-30 05:35:58 +00:00
|
|
|
(configFile >> "CfgWeapons" >> _weapon),
|
|
|
|
(configFile >> "CfgMagazines" >> _magazine),
|
2015-08-30 20:59:27 +00:00
|
|
|
(configFile >> "CfgAmmo" >> _ammo)
|
2015-08-30 05:35:58 +00:00
|
|
|
] select _type;
|
2015-08-30 21:10:03 +00:00
|
|
|
TRACE_1("ConfigPath",_config);
|
2015-08-30 05:35:58 +00:00
|
|
|
|
|
|
|
// get the Variables out of the Configes and create a array with then
|
|
|
|
_return = [
|
|
|
|
(getNumber (_config >> QGVAR(angle))),
|
|
|
|
(getNumber (_config >> QGVAR(range))),
|
|
|
|
(getNumber (_config >> QGVAR(damage)))
|
|
|
|
];
|
2015-08-30 21:10:03 +00:00
|
|
|
TRACE_1("Return",_return);
|
2015-08-30 21:40:53 +00:00
|
|
|
_varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine];
|
2015-08-30 05:35:58 +00:00
|
|
|
missionNameSpace setVariable [format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine], _return];
|
|
|
|
|
|
|
|
_return
|