mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
615afee022
* reload magazine instantly on arsenal * remove comment in reloadlaunchers * use addWeaponItem in selChangedRight
79 lines
3.9 KiB
Plaintext
79 lines
3.9 KiB
Plaintext
#include "script_component.hpp"
|
|
#include "..\defines.hpp"
|
|
/*
|
|
* Author: Alganthe
|
|
* Handles selection changes on the right panel.
|
|
*
|
|
* Arguments:
|
|
* 0: Right panel control <CONTROL>
|
|
* 1: Right panel selection <SCALAR>
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
params ["_control", "_curSel"];
|
|
|
|
if (_curSel < 0) exitwith {};
|
|
|
|
private _ctrlIDC = ctrlIDC _control;
|
|
private _display = ctrlParent _control;
|
|
private _item = _control lbData _curSel;
|
|
|
|
|
|
private _fnc_selectItem = {
|
|
params ["_item", "_currentItemsIndex", "_itemIndex"];
|
|
|
|
switch (_currentItemsIndex) do {
|
|
case 18: {
|
|
if (_item == "") then {
|
|
GVAR(center) removePrimaryWeaponItem ((GVAR(currentItems) select 18) select _itemIndex);
|
|
private _primaryMags = primaryWeaponMagazine GVAR(center);
|
|
GVAR(currentItems) set [18, (primaryWeaponItems GVAR(center)) + ([_primaryMags + [""], _primaryMags] select (count _primaryMags > 1))];
|
|
} else {
|
|
GVAR(center) addWeaponItem [primaryWeapon GVAR(center), _item, true];
|
|
private _primaryMags = primaryWeaponMagazine GVAR(center);
|
|
GVAR(currentItems) set [18, (primaryWeaponItems GVAR(center)) + ([_primaryMags + [""], _primaryMags] select (count _primaryMags > 1))];
|
|
};
|
|
[_display, _control, _curSel, (configFile >> (["CfgWeapons", "CfgMagazines"] select (_itemIndex in [4, 5]))>> _item)] call FUNC(itemInfo);
|
|
};
|
|
|
|
case 19: {
|
|
if (_item == "") then {
|
|
if (cba_disposable_replaceDisposableLauncher && !isNil {cba_disposable_LoadedLaunchers getVariable secondaryWeapon GVAR(center)}) exitWith { TRACE_1("ignoring unload of disposable",secondaryWeapon GVAR(center)); };
|
|
GVAR(center) removeSecondaryWeaponItem ((GVAR(currentItems) select 19) select _itemIndex);
|
|
private _secondaryMags = secondaryWeaponMagazine GVAR(center);
|
|
GVAR(currentItems) set [19, (secondaryWeaponItems GVAR(center)) + ([_secondaryMags + [""], _secondaryMags] select (count _secondaryMags > 1))];
|
|
} else {
|
|
GVAR(center) addWeaponItem [secondaryWeapon GVAR(center), _item, true];
|
|
private _secondaryMags = secondaryWeaponMagazine GVAR(center);
|
|
GVAR(currentItems) set [19, (secondaryWeaponItems GVAR(center)) + ([_secondaryMags + [""], _secondaryMags] select (count _secondaryMags > 1))];
|
|
};
|
|
[_display, _control, _curSel, (configFile >> (["CfgWeapons", "CfgMagazines"] select (_itemIndex in [4, 5]))>> _item)] call FUNC(itemInfo);
|
|
};
|
|
|
|
case 20: {
|
|
if (_item == "") then {
|
|
GVAR(center) removeHandgunItem ((GVAR(currentItems) select 20) select _itemIndex);
|
|
private _handgunMags = handgunMagazine GVAR(center);
|
|
GVAR(currentItems) set [20, (handgunItems GVAR(center)) + ([_handgunMags + [""], _handgunMags] select (count _handgunMags > 1))];
|
|
} else {
|
|
GVAR(center) addWeaponItem [handgunWeapon GVAR(center), _item, true];
|
|
private _handgunMags = handgunMagazine GVAR(center);
|
|
GVAR(currentItems) set [20, (handgunItems GVAR(center)) + ([_handgunMags + [""], _handgunMags] select (count _handgunMags > 1))];
|
|
};
|
|
[_display, _control, _curSel, (configFile >> (["CfgWeapons", "CfgMagazines"] select (_itemIndex in [4, 5]))>> _item)] call FUNC(itemInfo);
|
|
};
|
|
};
|
|
};
|
|
|
|
[
|
|
_item,
|
|
18 + ([IDC_buttonPrimaryWeapon, IDC_buttonSecondaryWeapon, IDC_buttonHandgun] find GVAR(currentLeftPanel)),
|
|
[IDC_buttonMuzzle, IDC_buttonItemAcc, IDC_buttonOptic, IDC_buttonBipod, IDC_buttonCurrentMag, IDC_buttonCurrentMag2] find GVAR(currentRightPanel)
|
|
] call _fnc_selectItem;
|
|
|
|
(_display displayCtrl IDC_totalWeightText) ctrlSetText (format ["%1 (%2)", [GVAR(center), 2] call EFUNC(common,getWeight), [GVAR(center), 1] call EFUNC(common,getWeight)]);
|