ACE3/addons/pylons/functions/fnc_configurePylons.sqf
Dedmen Miller e2ac18a05d [WIP] Fix script errors reporting wrong line numbers (#6407)
* advanced_ballistics

* advanced_fatigue

* advanced_throwing

* ai

* aircraft

* arsenal

* atragmx

* attach

* backpacks

* ballistics

* captives

* cargo

* chemlights

* common

* concertina_wire

* cookoff

* dagr

* disarming

* disposable

* dogtags

* dragging

* explosives

* fastroping

* fcs

* finger

* frag

* gestures

* gforces

* goggles

* grenades

* gunbag

* hearing

* hitreactions

* huntir

* interact_menu

* interaction

* inventory

* kestrel4500

* laser

* laserpointer

* logistics_uavbattery

* logistics_wirecutter

* magazinerepack

* map

* map_gestures

* maptools

* markers

* medical

* medical_ai

* medical_blood

* medical_menu

* microdagr

* minedetector

* missileguidance

* missionmodules

* mk6mortar

* modules

* movement

* nametags

* nightvision

* nlaw

* optics

* optionsmenu

* overheating

* overpressure

* parachute

* pylons

* quickmount

* rangecard

* rearm

* recoil

* refuel

* reload

* reloadlaunchers

* repair

* respawn

* safemode

* sandbag

* scopes

* slideshow

* spectator

* spottingscope

* switchunits

* tacticalladder

* tagging

* trenches

* tripod

* ui

* vector

* vehiclelock

* vehicles

* viewdistance

* weaponselect

* weather

* winddeflection

* yardage450

* zeus

* arsenal defines.hpp

* optionals

* DEBUG_MODE_FULL 1

* DEBUG_MODE_FULL 2

* Manual fixes

* Add SQF Validator check for #include after block comment

* explosives fnc_openTimerUI

* fix uniqueItems
2018-09-17 14:19:29 -05:00

78 lines
2.8 KiB
Plaintext

#include "script_component.hpp"
/*
* 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
*/
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;
TRACE_2("",_currentPylon,_pylonIndex);
// Remove the weapon of current pylon from aircraft IF weapon is only on this pylon
private _weaponToRemove = "";
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 {
TRACE_2("Removing unused weapon",_pylonWeapon,_allPylonWeapons);
_weaponToRemove = _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, _weaponToRemove]
] 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],
{GVAR(isCurator) || {(ace_player distanceSqr GVAR(currentAircraft)) <= GVAR(searchDistanceSqr)}},
["isNotInZeus"]
] call EFUNC(common,progressBar);