ACE3/addons/reloadlaunchers/functions/fnc_getLoadableMissiles.sqf

30 lines
838 B
Plaintext
Raw Normal View History

2015-03-18 20:33:00 +00:00
/*
* Author: commy2
* Return all magazine types from reloaders inventory that are compatible with given weapon.
*
2016-06-18 09:50:41 +00:00
* Arguments:
* 0: Unit to to the reload <OBJECT>
* 1: A launcher <OBJECT>
2015-03-18 20:33:00 +00:00
*
2016-06-18 09:50:41 +00:00
* Return Value:
* Reloable magazines <ARRAY>
*
* Example:
* [bob, launcher] call ace_reloadlaunchers_fnc_getLoadableMissiles
2016-04-28 03:58:47 +00:00
*
* Public: No
2015-03-18 20:33:00 +00:00
*/
#include "script_component.hpp"
2016-04-28 03:58:47 +00:00
params ["_unit", "_weapon"];
TRACE_2("params",_unit,_weapon);
2015-03-18 20:33:00 +00:00
// get available magazines of reloader, Note: "magazines" does not include currently loaded magazines
2016-04-28 03:58:47 +00:00
private _magazines = magazines _unit;
2015-03-18 20:33:00 +00:00
// case sensitvity
2016-02-06 11:08:04 +00:00
_magazines = _magazines apply {toLower _x};
2015-03-18 20:33:00 +00:00
// get reloaders magazine types compatible with targets launcher. No duplicates.
2016-02-06 10:58:31 +00:00
getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines") select {toLower _x in _magazines} // return