ACE3/addons/pylons/functions/fnc_configurePylons.sqf
Ozan Eğitmen 1b86063ade Add Pylons Component (#5517)
* Initial commit

* Change order

* ace-ify functions

* Add function headers, tweak onPylonMirror function

* Finish localization

* Fix trivial idc collision

* Styling

* Add self as author

* Add interaction for the dialog

* Add settings to enable menu and change behaviour

* Add strings

* Move changes into pylons component

* Progress

* Only one function left!

* Fix issues with overlapping players, Use LINKFUNC

* Add progress bar

* I need to switch branches

* Remove old pylon weapons from aircraft

* Explicitly set new pylon's ammo to 0

* Replace magic numbers with ID list

* Align controls properly

* Remove space before eol

* Add ability to add/remove FRIES

* 🐛 Whoops

* Fix logic errors

* Value of 1 means helicopter has built-in FRIES

* Add pilot/gunner switch button

Working on those buttons also helped me improve both the static and
on-the-fly (pun intended) parts of the dialog.

* Add quick zeus module

* Add a way to retrieve scripted pylon turrets

Not entirely reliable, but if used in both rearm and pylons, missions
that only use ace will work perfectly.

* Use getNumber default

* Use common's getPylonTurret

* Make dialog close on apply for zeus

* Handle UI Scaling better

* Prevent progressBar from failing in zeus

* Remove unnecessary stringtable key
2017-10-11 14:05:54 -05:00

75 lines
2.6 KiB
Plaintext

/*
* Author: 654wak654
* Recursively shows the progress bar for each configured pylon.
*
* Arguments:
* 0: Indexes of pylons to configure <ARRAY>
* 1: Current index <NUMBER>
*
* Return Value:
* None
*
* Example:
* [_pylonsToConfigure, 0] call ace_pylons_fnc_configurePylons
*
* Public: No
*/
#include "script_component.hpp"
params ["_pylonsToConfigure", "_currentPylon"];
if (_currentPylon == count _pylonsToConfigure) exitWith {};
// TODO: Animation and sound
[
[GVAR(timePerPylon), 0] select GVAR(isCurator),
_this,
{
(_this select 0) params ["_pylonsToConfigure", "_currentPylon"];
private _pylonIndex = _pylonsToConfigure select _currentPylon;
// Remove the weapon of current pylon from aircraft IF weapon is only on this pylon
private _currentPylonMagazine = (getPylonMagazines GVAR(currentAircraft)) select _pylonIndex;
if (_currentPylonMagazine != "") then {
private _allPylonWeapons = (getPylonMagazines GVAR(currentAircraft)) apply {
getText (configFile >> "CfgMagazines" >> _x >> "pylonWeapon")
};
private _pylonWeapon = _allPylonWeapons select _pylonIndex;
if (({_x == _pylonWeapon} count _allPylonWeapons) == 1) then {
GVAR(currentAircraft) removeWeaponGlobal _pylonWeapon;
};
};
private _combo = GVAR(comboBoxes) select _pylonIndex select 0;
private _pylonMagazine = _combo lbData (lbCurSel _combo);
private _turret = (GVAR(comboBoxes) select _pylonIndex select 2) getVariable [QGVAR(turret), []];
if (_turret isEqualTo [-1]) then {_turret = [];};
[
QGVAR(setPylonLoadOutEvent),
[GVAR(currentAircraft), _pylonIndex + 1, _pylonMagazine, _turret]
] call CBA_fnc_globalEvent;
private _count = if (GVAR(rearmNewPylons) || {GVAR(isCurator)}) then {
getNumber (configFile >> "CfgMagazines" >> _pylonMagazine >> "count")
} else {
0
};
[
QGVAR(setAmmoOnPylonEvent),
[GVAR(currentAircraft), _pylonIndex + 1, _count],
GVAR(currentAircraft)
] call CBA_fnc_targetEvent;
[_pylonsToConfigure, _currentPylon + 1] call FUNC(configurePylons);
},
{
(_this select 0) params ["", "_currentPylon"];
[format [localize LSTRING(Stopped), _currentPylon + 1], false, 5] call EFUNC(common,displayText);
},
format [localize LSTRING(ReplacingPylon), _currentPylon + 1, count _pylonsToConfigure],
{true},
["isNotInZeus"]
] call EFUNC(common,progressBar);