From 2e3e203d9f68a44699c96ca300ac52f4f5295b9d Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sat, 9 May 2015 14:41:46 -0500 Subject: [PATCH] #1081 - Fix binocular dupe binocs are weapons and items at the same time. need to properly drop binocs because stuff like deisgnator can have ammo --- addons/disarming/functions/fnc_disarmDropItems.sqf | 14 ++++++++++++-- addons/disarming/functions/fnc_getAllGearUnit.sqf | 2 +- .../disarming/functions/fnc_showItemsInListbox.sqf | 8 ++++---- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/addons/disarming/functions/fnc_disarmDropItems.sqf b/addons/disarming/functions/fnc_disarmDropItems.sqf index 2cb3e89b5d..cb5da77dd6 100644 --- a/addons/disarming/functions/fnc_disarmDropItems.sqf +++ b/addons/disarming/functions/fnc_disarmDropItems.sqf @@ -102,7 +102,7 @@ if (!([_targetMagazinesStart, _targetMagazinesEnd, _holderMagazinesStart, _holde //Remove Items, Assigned Items and NVG _holderItemsStart = getitemCargo _holder; -_targetItemsStart = (assignedItems _target) + (items _target); +_targetItemsStart = (assignedItems _target) + (items _target) - (weapons _target); if ((headgear _target) != "") then {_targetItemsStart pushBack (headgear _target);}; if ((goggles _target) != "") then {_targetItemsStart pushBack (goggles _target);}; @@ -132,7 +132,7 @@ _addToCrateCount = []; } forEach _addToCrateClassnames; _holderItemsEnd = getitemCargo _holder; -_targetItemsEnd = (assignedItems _target) + (items _target); +_targetItemsEnd = (assignedItems _target) + (items _target) - (weapons _target); if ((headgear _target) != "") then {_targetItemsEnd pushBack (headgear _target);}; if ((goggles _target) != "") then {_targetItemsEnd pushBack (goggles _target);}; @@ -146,6 +146,16 @@ if ((([_holderItemsEnd select 1] call _fncSumArray) - ([_holderItemsStart select [_caller, _target, "Debug: Items Not Added to Holder"] call FUNC(eventTargetFinish); }; +//Script drop uniforms/vest if empty +if (((uniform _target) != "") && {(uniform _target) in _listOfItemsToRemove} && {(uniformItems _target) isEqualTo []}) then { + _holder addItemCargoGlobal [(uniform _target), 1]; + removeUniform _target; +}; +if (((vest _target) != "") && {(vest _target) in _listOfItemsToRemove} && {(vestItems _target) isEqualTo []}) then { + _holder addItemCargoGlobal [(vest _target), 1]; + removeVest _target; +}; + //If holder is still empty, it will be 'garbage collected' while we wait for the drop 'action' to take place //So add a dummy item and just remove at the end diff --git a/addons/disarming/functions/fnc_getAllGearUnit.sqf b/addons/disarming/functions/fnc_getAllGearUnit.sqf index a319c006ee..99d4b2d7f2 100644 --- a/addons/disarming/functions/fnc_getAllGearUnit.sqf +++ b/addons/disarming/functions/fnc_getAllGearUnit.sqf @@ -19,7 +19,7 @@ PARAMS_1(_target); private ["_allItems", "_classnamesCount", "_index", "_uniqueClassnames"]; -_allItems = ((weapons _target) + (magazines _target) + (items _target) + (assignedItems _target)); +_allItems = (((items _target) + (assignedItems _target)) - (weapons _target)) + (weapons _target) + (magazines _target); if ((backpack _target) != "") then { _allItems pushBack (backpack _target); diff --git a/addons/disarming/functions/fnc_showItemsInListbox.sqf b/addons/disarming/functions/fnc_showItemsInListbox.sqf index 5c809de4a2..b36e53e820 100644 --- a/addons/disarming/functions/fnc_showItemsInListbox.sqf +++ b/addons/disarming/functions/fnc_showItemsInListbox.sqf @@ -28,7 +28,7 @@ private ["_classname", "_count", "_displayName", "_picture"]; _classname = _x; _count = (_itemsCountArray select 1) select _forEachIndex; - if (_classname != DUMMY_ITEM) then { //Don't show the dummy potato + if ((_classname != DUMMY_ITEM) && {_classname != "ACE_FakePrimaryWeapon"}) then { //Don't show the dummy potato or fake weapon switch (true) do { case (isClass (configFile >> "CfgWeapons" >> _classname)): { @@ -53,8 +53,8 @@ private ["_classname", "_count", "_displayName", "_picture"]; }; _listBoxCtrl lbAdd format ["%1", _displayName]; - _listBoxCtrl lbSetData [_forEachIndex, _classname]; - _listBoxCtrl lbSetPicture [_forEachIndex, _picture]; - _listBoxCtrl lbSetTextRight [_forEachIndex, str _count]; + _listBoxCtrl lbSetData [((lbSize _listBoxCtrl) - 1), _classname]; + _listBoxCtrl lbSetPicture [((lbSize _listBoxCtrl) - 1), _picture]; + _listBoxCtrl lbSetTextRight [((lbSize _listBoxCtrl) - 1), str _count]; }; } forEach (_itemsCountArray select 0);