2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2015-03-22 13:05:31 +00:00
|
|
|
/*
|
|
|
|
* Author: commy2
|
2023-08-28 17:27:01 +00:00
|
|
|
* Create one action per reloadable missile.
|
2015-03-22 13:05:31 +00:00
|
|
|
*
|
2016-06-18 09:50:41 +00:00
|
|
|
* Arguments:
|
2023-08-28 17:27:01 +00:00
|
|
|
* 0: Unit equipped with the launcher <OBJECT>
|
2023-08-28 20:20:53 +00:00
|
|
|
* 1: Unit wanting to execute the reload <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:
|
2023-08-28 17:27:01 +00:00
|
|
|
* [cursorTarget, player] 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
|
|
|
|
2023-08-28 17:27:01 +00:00
|
|
|
// Fast exit for common cases
|
2016-04-28 03:58:47 +00:00
|
|
|
private _weapon = secondaryWeapon _target;
|
2023-08-28 17:27:01 +00:00
|
|
|
|
2016-04-28 03:58:47 +00:00
|
|
|
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
|
|
|
|
2023-08-28 17:27:01 +00:00
|
|
|
private _cfgMagazines = configFile >> "CfgMagazines";
|
|
|
|
|
2015-03-22 13:05:31 +00:00
|
|
|
{
|
2017-10-10 14:39:59 +00:00
|
|
|
private _name = format [QGVAR(Missile_%1), _x];
|
2023-08-28 17:27:01 +00:00
|
|
|
private _displayName = format [LLSTRING(LoadMagazine), getText (_cfgMagazines >> _x >> "displayName")];
|
2015-03-22 13:05:31 +00:00
|
|
|
|
2017-10-10 14:39:59 +00:00
|
|
|
private _statement = {
|
2023-08-28 17:27:01 +00:00
|
|
|
(_this select 2) call FUNC(load);
|
2015-03-22 13:05:31 +00:00
|
|
|
};
|
|
|
|
|
2017-10-10 14:39:59 +00:00
|
|
|
private _condition = {
|
2023-08-28 17:27:01 +00:00
|
|
|
(_this select 2) call FUNC(canLoad)
|
2015-03-22 13:05:31 +00:00
|
|
|
};
|
|
|
|
|
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
|