Arsenal - Stop deleting unique belt items (#8483)

* prevent belt items from being deleted

* fix wrong index

* fix gps not being selected

* & fix UAV terminals not being selected

* add comments, delete extra line

* use getUnitLoadout for assignedItems
This commit is contained in:
GhostIsSpooky 2021-10-12 19:10:18 -03:00 committed by GitHub
parent fa99cfaa09
commit 005b2aef14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 10 deletions

View File

@ -176,6 +176,13 @@
#define IDX_VIRT_VEST 5
#define IDX_VIRT_BACKPACK 6
#define IDX_VIRT_GOGGLES 7
#define IDX_VIRT_NVG 8
#define IDX_VIRT_BINO 9
#define IDX_VIRT_MAP 10
#define IDX_VIRT_COMPASS 11
#define IDX_VIRT_RADIO 12
#define IDX_VIRT_WATCH 13
#define IDX_VIRT_COMMS 14
#define SYMBOL_ITEM_NONE ""
#define SYMBOL_ITEM_REMOVE "×"

View File

@ -60,8 +60,11 @@ GVAR(statsPagesLeft) = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
GVAR(statsPagesRight) = [0, 0, 0, 0, 0, 0, 0, 0];
GVAR(statsInfo) = [true, 0, controlNull, nil, nil];
// Cache assignedItems
private _assignedItems = (getUnitLoadout GVAR(center)) select 9;
// Add the items the player has to virtualItems
for "_index" from 0 to 10 do {
for "_index" from 0 to 14 do {
switch (_index) do {
// primary, secondary, handgun weapons
case IDX_VIRT_WEAPONS: {
@ -109,6 +112,14 @@ for "_index" from 0 to 10 do {
} forEach _magsArray;
};
// Assigned items
case IDX_VIRT_MAP: { (GVAR(virtualItems) select _index) pushBackUnique (_assignedItems select 0) };
case IDX_VIRT_COMMS: { (GVAR(virtualItems) select _index) pushBackUnique (_assignedItems select 1) };
case IDX_VIRT_RADIO: { (GVAR(virtualItems) select _index) pushBackUnique (_assignedItems select 2) };
case IDX_VIRT_COMPASS: { (GVAR(virtualItems) select _index) pushBackUnique (_assignedItems select 3) };
case IDX_VIRT_WATCH: { (GVAR(virtualItems) select _index) pushBackUnique (_assignedItems select 4) };
// Inventory items
case IDX_VIRT_ITEMS_ALL: {
call FUNC(updateUniqueItemsList);
@ -164,18 +175,24 @@ for "_index" from 0 to 15 do {
};
{
private _simulationType = getText (configFile >> "CfgWeapons" >> _x >> "simulation");
if (_simulationType != "NVGoggles") then {
if (_simulationType == "ItemGps" || _simulationType == "Weapon") then {
switch (_forEachIndex) do {
case 0: { // Map
GVAR(currentItems) set [10, _x];
};
case 1: { // GPS
GVAR(currentItems) set [14, _x];
} else {
private _index = 10 + (["itemmap", "itemcompass", "itemradio", "itemwatch"] find (tolower _simulationType));
GVAR(currentItems) set [_index, _x];
};
case 2: { // Radio
GVAR(currentItems) set [12, _x];
};
case 3: { // Compass
GVAR(currentItems) set [11, _x];
};
case 4: { // Watch
GVAR(currentItems) set [13, _x];
};
};
} forEach (assignedItems GVAR(center));
} forEach _assignedItems;
GVAR(currentWeaponType) = switch true do {
case (currentWeapon GVAR(center) == GVAR(currentItems) select 0): {0};