ACE3/addons/arsenal/functions/fnc_buttonImport.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

105 lines
3.5 KiB
Plaintext

#include "script_component.hpp"
#include "..\defines.hpp"
/*
* Author: Alganthe
* Import loadout / default loadouts list from clipboard.
*
* Arguments:
* 0: Arsenal display <DISPLAY>
*
* Return Value:
* None
*
* Public: No
*/
params ["_display"];
private _data = call (compile copyFromClipboard);
if (isNil "_data" || {!(_data isEqualType [])}) exitWith {
[_display, localize LSTRING(importFormatError)] call FUNC(message);
};
if (GVAR(shiftState) && {is3DEN}) then {
{
if (
count _x == 2 &&
{_x select 0 isEqualType ""} &&
{_x select 0 != ""} &&
{_x select 1 isEqualType []} &&
{count (_x select 1) == 10}
) then {
_x call FUNC(addDefaultLoadout);
};
} foreach _data;
[_display, localize LSTRING(importedDefault)] call FUNC(message);
set3DENMissionAttributes [[QGVAR(DummyCategory), QGVAR(DefaultLoadoutsListAttribute), GVAR(defaultLoadoutsList)]];
} else {
if (count _data == 10) then {
GVAR(center) setUnitLoadout _data;
GVAR(currentItems) = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", [], [], [], [], [], []];
for "_index" from 0 to 15 do {
switch (_index) do {
case 0;
case 1;
case 2:{
GVAR(currentItems) set [_index, ((LIST_DEFAULTS select 0) select _index)];
};
case 3;
case 4;
case 5;
case 6;
case 7;
case 8;
case 9: {
GVAR(currentItems) set [_index, (LIST_DEFAULTS select _index) select 0];
};
case 10: {
{(GVAR(currentItems) select 15) pushBack _x} forEach (uniformItems GVAR(center));
};
case 11: {
{(GVAR(currentItems) select 16) pushBack _x} forEach (vestItems GVAR(center));
};
case 12: {
{(GVAR(currentItems) select 17) pushBack _x} forEach (backpackItems GVAR(center));
};
case 13: {
GVAR(currentItems) set [18, (primaryWeaponItems GVAR(center)) + (primaryWeaponMagazine GVAR(center))];
};
case 14: {
GVAR(currentItems) set [19, (secondaryWeaponItems GVAR(center)) + (secondaryWeaponMagazine GVAR(center))];
};
case 15: {
GVAR(currentItems) set [20, (handgunItems GVAR(center)) + (handgunMagazine GVAR(center))];
};
};
};
{
private _simulationType = getText (configFile >> "CfgWeapons" >> _x >> "simulation");
private _index = 10 + (["itemmap", "itemcompass", "itemradio", "itemwatch", "itemgps"] find (tolower _simulationType));
GVAR(currentItems) set [_index, _x];
} foreach (assignedItems GVAR(center));
call FUNC(updateUniqueItemsList);
// Reapply insignia
[GVAR(center), ""] call bis_fnc_setUnitInsignia;
[GVAR(center), GVAR(currentInsignia)] call bis_fnc_setUnitInsignia;
[_display, _display displayCtrl GVAR(currentLeftPanel)] call FUNC(fillLeftPanel);
[_display, localize LSTRING(importedCurrent)] call FUNC(message);
};
};
[QGVAR(loadoutImported), [_display, (GVAR(shiftState) && {is3DEN})]] call CBA_fnc_localEvent;