Pylons - Update configure pylons action (#6381)

This commit is contained in:
mharis001 2019-02-07 18:12:48 -05:00 committed by PabstMirror
parent ff5eb34e10
commit fa101d859a

View File

@ -1,12 +1,8 @@
#include "script_component.hpp" #include "script_component.hpp"
private _filter = "isClass (_x >> 'Components' >> 'TransportPylonsComponent') && {(getNumber (_x >> 'scope')) > 0}"; GVAR(aircraftWithPylons) = [];
GVAR(aircraftWithPylons) = (_filter configClasses (configFile >> "CfgVehicles")) apply {configName _x};
{
[_x, "init", {
params ["_aircraft"];
private _loadoutAction = [ GVAR(loadoutAction) = [ // create action
QGVAR(loadoutAction), QGVAR(loadoutAction),
localize LSTRING(ConfigurePylons), localize LSTRING(ConfigurePylons),
"", "",
@ -24,11 +20,19 @@ GVAR(aircraftWithPylons) = (_filter configClasses (configFile >> "CfgVehicles"))
(_isRearmVehicle && {[ace_player, _target] call FUNC(canConfigurePylons)}) (_isRearmVehicle && {[ace_player, _target] call FUNC(canConfigurePylons)})
} }
] call EFUNC(interact_menu,createAction); ] call EFUNC(interact_menu,createAction);
["Air", "init", { // on air vehicle init, add action to class if has pylons
params ["_vehicle"];
private _typeOf = typeOf _vehicle;
if (_typeOf in GVAR(aircraftWithPylons)) exitWith {};
if (!isClass (configFile >> "CfgVehicles" >> _typeOf >> 'Components' >> 'TransportPylonsComponent')) exitWith {};
GVAR(aircraftWithPylons) pushBack _typeOf;
[_typeOf, 0, ["ACE_MainActions"], GVAR(loadoutAction)] call EFUNC(interact_menu,addActionToClass);
}, true, ["ParachuteBase"], true] call CBA_fnc_addClassEventHandler;
[_aircraft, 0, ["ACE_MainActions"], _loadoutAction] call EFUNC(interact_menu,addActionToObject);
}, false, [], true] call CBA_fnc_addClassEventHandler;
} forEach GVAR(aircraftWithPylons);
[QGVAR(setPylonLoadOutEvent), { [QGVAR(setPylonLoadOutEvent), {
params ["_aircraft", "_pylonIndex", "_pylon", "_turret", "_weaponToRemove"]; params ["_aircraft", "_pylonIndex", "_pylon", "_turret", "_weaponToRemove"];