Arsenal - Improve addWeaponItem usage (#8813)

* reload magazine instantly on arsenal

* remove comment in reloadlaunchers

* use addWeaponItem in selChangedRight
This commit is contained in:
GhostIsSpooky 2022-02-17 14:14:01 -03:00 committed by GitHub
parent 8cf900a1bc
commit 615afee022
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 7 deletions

View File

@ -61,7 +61,7 @@ switch (GVAR(currentLeftPanel)) do {
private _compatibleMags = ([_item, true] call CBA_fnc_compatibleMagazines) select { getNumber (_cfgMags >> _x >> "scope") == 2 }; private _compatibleMags = ([_item, true] call CBA_fnc_compatibleMagazines) select { getNumber (_cfgMags >> _x >> "scope") == 2 };
GVAR(center) addWeapon _item; GVAR(center) addWeapon _item;
if (_compatibleMags isNotEqualTo []) then { if (_compatibleMags isNotEqualTo []) then {
GVAR(center) addWeaponItem [_item, [_compatibleMags select 0]]; GVAR(center) addWeaponItem [_item, [_compatibleMags select 0], true];
}; };
{ {
@ -103,7 +103,7 @@ switch (GVAR(currentLeftPanel)) do {
private _compatibleMags = ([_item, true] call CBA_fnc_compatibleMagazines) select { getNumber (_cfgMags >> _x >> "scope") == 2 }; private _compatibleMags = ([_item, true] call CBA_fnc_compatibleMagazines) select { getNumber (_cfgMags >> _x >> "scope") == 2 };
GVAR(center) addWeapon _item; GVAR(center) addWeapon _item;
if (_compatibleMags isNotEqualTo []) then { if (_compatibleMags isNotEqualTo []) then {
GVAR(center) addWeaponItem [_item, [_compatibleMags select 0]]; GVAR(center) addWeaponItem [_item, [_compatibleMags select 0], true];
}; };
{ {
@ -144,7 +144,7 @@ switch (GVAR(currentLeftPanel)) do {
private _compatibleMags = ([_item, true] call CBA_fnc_compatibleMagazines) select { getNumber (_cfgMags >> _x >> "scope") == 2 }; private _compatibleMags = ([_item, true] call CBA_fnc_compatibleMagazines) select { getNumber (_cfgMags >> _x >> "scope") == 2 };
GVAR(center) addWeapon _item; GVAR(center) addWeapon _item;
if (_compatibleMags isNotEqualTo []) then { if (_compatibleMags isNotEqualTo []) then {
GVAR(center) addWeaponItem [_item, [_compatibleMags select 0]]; GVAR(center) addWeaponItem [_item, [_compatibleMags select 0], true];
}; };
{ {

View File

@ -33,7 +33,7 @@ private _fnc_selectItem = {
private _primaryMags = primaryWeaponMagazine GVAR(center); private _primaryMags = primaryWeaponMagazine GVAR(center);
GVAR(currentItems) set [18, (primaryWeaponItems GVAR(center)) + ([_primaryMags + [""], _primaryMags] select (count _primaryMags > 1))]; GVAR(currentItems) set [18, (primaryWeaponItems GVAR(center)) + ([_primaryMags + [""], _primaryMags] select (count _primaryMags > 1))];
} else { } else {
GVAR(center) addPrimaryWeaponItem _item; GVAR(center) addWeaponItem [primaryWeapon GVAR(center), _item, true];
private _primaryMags = primaryWeaponMagazine GVAR(center); private _primaryMags = primaryWeaponMagazine GVAR(center);
GVAR(currentItems) set [18, (primaryWeaponItems GVAR(center)) + ([_primaryMags + [""], _primaryMags] select (count _primaryMags > 1))]; GVAR(currentItems) set [18, (primaryWeaponItems GVAR(center)) + ([_primaryMags + [""], _primaryMags] select (count _primaryMags > 1))];
}; };
@ -47,7 +47,7 @@ private _fnc_selectItem = {
private _secondaryMags = secondaryWeaponMagazine GVAR(center); private _secondaryMags = secondaryWeaponMagazine GVAR(center);
GVAR(currentItems) set [19, (secondaryWeaponItems GVAR(center)) + ([_secondaryMags + [""], _secondaryMags] select (count _secondaryMags > 1))]; GVAR(currentItems) set [19, (secondaryWeaponItems GVAR(center)) + ([_secondaryMags + [""], _secondaryMags] select (count _secondaryMags > 1))];
} else { } else {
GVAR(center) addSecondaryWeaponItem _item; GVAR(center) addWeaponItem [secondaryWeapon GVAR(center), _item, true];
private _secondaryMags = secondaryWeaponMagazine GVAR(center); private _secondaryMags = secondaryWeaponMagazine GVAR(center);
GVAR(currentItems) set [19, (secondaryWeaponItems GVAR(center)) + ([_secondaryMags + [""], _secondaryMags] select (count _secondaryMags > 1))]; GVAR(currentItems) set [19, (secondaryWeaponItems GVAR(center)) + ([_secondaryMags + [""], _secondaryMags] select (count _secondaryMags > 1))];
}; };
@ -60,7 +60,7 @@ private _fnc_selectItem = {
private _handgunMags = handgunMagazine GVAR(center); private _handgunMags = handgunMagazine GVAR(center);
GVAR(currentItems) set [20, (handgunItems GVAR(center)) + ([_handgunMags + [""], _handgunMags] select (count _handgunMags > 1))]; GVAR(currentItems) set [20, (handgunItems GVAR(center)) + ([_handgunMags + [""], _handgunMags] select (count _handgunMags > 1))];
} else { } else {
GVAR(center) addHandgunItem _item; GVAR(center) addWeaponItem [handgunWeapon GVAR(center), _item, true];
private _handgunMags = handgunMagazine GVAR(center); private _handgunMags = handgunMagazine GVAR(center);
GVAR(currentItems) set [20, (handgunItems GVAR(center)) + ([_handgunMags + [""], _handgunMags] select (count _handgunMags > 1))]; GVAR(currentItems) set [20, (handgunItems GVAR(center)) + ([_handgunMags + [""], _handgunMags] select (count _handgunMags > 1))];
}; };

View File

@ -26,5 +26,4 @@ _target selectWeapon _weapon;
if (currentWeapon _target != _weapon) exitWith {}; if (currentWeapon _target != _weapon) exitWith {};
if (currentMagazine _target != "") exitWith {}; if (currentMagazine _target != "") exitWith {};
// command is wip, reload time for launchers is not intended.
_target addWeaponItem [_weapon, _magazine, true]; _target addWeaponItem [_weapon, _magazine, true];