2018-09-17 19:19:29 +00:00
|
|
|
#include "script_component.hpp"
|
2015-03-22 13:05:31 +00:00
|
|
|
/*
|
|
|
|
* Author: commy2
|
|
|
|
* Create one action per reloadable missile
|
|
|
|
*
|
2016-06-18 09:50:41 +00:00
|
|
|
* Arguments:
|
2017-06-08 13:31:51 +00:00
|
|
|
* 1: Target <OBJECT>
|
|
|
|
* 0: Player <OBJECT>
|
2015-03-22 13:05:31 +00:00
|
|
|
*
|
2016-06-18 09:50:41 +00:00
|
|
|
* Return Value:
|
2017-06-08 13:31:51 +00:00
|
|
|
* Children actions <ARRAY>
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [bob, kevin] call ace_reloadlaunchers_fnc_addMissileReloadActions
|
2015-03-22 13:05:31 +00:00
|
|
|
*
|
2016-04-28 03:58:47 +00:00
|
|
|
* Public: No
|
|
|
|
*
|
2015-03-22 13:05:31 +00:00
|
|
|
*/
|
|
|
|
|
2016-04-28 03:58:47 +00:00
|
|
|
params ["_target", "_unit"];
|
|
|
|
TRACE_2("params",_target,_unit);
|
2015-03-22 13:05:31 +00:00
|
|
|
|
2016-04-28 03:58:47 +00:00
|
|
|
//Fast exit for common case:
|
|
|
|
private _weapon = secondaryWeapon _target;
|
|
|
|
if ((_weapon == "") || {(getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(enabled))) == 0}) exitWith {
|
|
|
|
TRACE_1("weapon not supported",_weapon);
|
|
|
|
[]
|
|
|
|
};
|
2015-03-22 13:05:31 +00:00
|
|
|
|
2016-04-28 03:58:47 +00:00
|
|
|
private _actions = [];
|
2015-03-22 13:05:31 +00:00
|
|
|
|
2016-04-28 03:58:47 +00:00
|
|
|
private _loadableMissiles = [_unit, _weapon] call FUNC(getLoadableMissiles);
|
|
|
|
TRACE_2("",_weapon,_loadableMissiles);
|
2015-03-22 13:05:31 +00:00
|
|
|
|
|
|
|
{
|
2017-10-10 14:39:59 +00:00
|
|
|
private _name = format [QGVAR(Missile_%1), _x];
|
|
|
|
private _displayName = format [localize LSTRING(LoadMagazine), getText (configFile >> "CfgMagazines" >> _x >> "displayName")];
|
2015-03-22 13:05:31 +00:00
|
|
|
|
2017-10-10 14:39:59 +00:00
|
|
|
private _statement = {
|
2015-03-22 13:05:31 +00:00
|
|
|
(_this select 2) call DFUNC(load);
|
|
|
|
};
|
|
|
|
|
2017-10-10 14:39:59 +00:00
|
|
|
private _condition = {
|
2015-03-22 13:05:31 +00:00
|
|
|
(_this select 2) call DFUNC(canLoad)
|
|
|
|
};
|
|
|
|
|
2017-10-10 14:39:59 +00:00
|
|
|
private _action = [_name, _displayName, "", _statement, _condition, {}, [_unit, _target, _weapon, _x], "", 4] call EFUNC(interact_menu,createAction);
|
2015-03-22 13:05:31 +00:00
|
|
|
|
|
|
|
_actions pushBack [_action, [], _unit];
|
|
|
|
} forEach _loadableMissiles;
|
|
|
|
|
2016-04-28 03:58:47 +00:00
|
|
|
TRACE_1("return",_actions);
|
2015-03-22 13:05:31 +00:00
|
|
|
_actions
|