#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
This commit is contained in:
PabstMirror 2015-05-09 14:41:46 -05:00
parent 00c28dd146
commit 2e3e203d9f
3 changed files with 17 additions and 7 deletions

View File

@ -102,7 +102,7 @@ if (!([_targetMagazinesStart, _targetMagazinesEnd, _holderMagazinesStart, _holde
//Remove Items, Assigned Items and NVG //Remove Items, Assigned Items and NVG
_holderItemsStart = getitemCargo _holder; _holderItemsStart = getitemCargo _holder;
_targetItemsStart = (assignedItems _target) + (items _target); _targetItemsStart = (assignedItems _target) + (items _target) - (weapons _target);
if ((headgear _target) != "") then {_targetItemsStart pushBack (headgear _target);}; if ((headgear _target) != "") then {_targetItemsStart pushBack (headgear _target);};
if ((goggles _target) != "") then {_targetItemsStart pushBack (goggles _target);}; if ((goggles _target) != "") then {_targetItemsStart pushBack (goggles _target);};
@ -132,7 +132,7 @@ _addToCrateCount = [];
} forEach _addToCrateClassnames; } forEach _addToCrateClassnames;
_holderItemsEnd = getitemCargo _holder; _holderItemsEnd = getitemCargo _holder;
_targetItemsEnd = (assignedItems _target) + (items _target); _targetItemsEnd = (assignedItems _target) + (items _target) - (weapons _target);
if ((headgear _target) != "") then {_targetItemsEnd pushBack (headgear _target);}; if ((headgear _target) != "") then {_targetItemsEnd pushBack (headgear _target);};
if ((goggles _target) != "") then {_targetItemsEnd pushBack (goggles _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); [_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 //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 //So add a dummy item and just remove at the end

View File

@ -19,7 +19,7 @@ PARAMS_1(_target);
private ["_allItems", "_classnamesCount", "_index", "_uniqueClassnames"]; 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 { if ((backpack _target) != "") then {
_allItems pushBack (backpack _target); _allItems pushBack (backpack _target);

View File

@ -28,7 +28,7 @@ private ["_classname", "_count", "_displayName", "_picture"];
_classname = _x; _classname = _x;
_count = (_itemsCountArray select 1) select _forEachIndex; _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 { switch (true) do {
case (isClass (configFile >> "CfgWeapons" >> _classname)): { case (isClass (configFile >> "CfgWeapons" >> _classname)): {
@ -53,8 +53,8 @@ private ["_classname", "_count", "_displayName", "_picture"];
}; };
_listBoxCtrl lbAdd format ["%1", _displayName]; _listBoxCtrl lbAdd format ["%1", _displayName];
_listBoxCtrl lbSetData [_forEachIndex, _classname]; _listBoxCtrl lbSetData [((lbSize _listBoxCtrl) - 1), _classname];
_listBoxCtrl lbSetPicture [_forEachIndex, _picture]; _listBoxCtrl lbSetPicture [((lbSize _listBoxCtrl) - 1), _picture];
_listBoxCtrl lbSetTextRight [_forEachIndex, str _count]; _listBoxCtrl lbSetTextRight [((lbSize _listBoxCtrl) - 1), str _count];
}; };
} forEach (_itemsCountArray select 0); } forEach (_itemsCountArray select 0);