Merge pull request #1093 from acemod/fixDisarming

Fix disarming
This commit is contained in:
ViperMaul 2015-05-11 08:38:56 -07:00
commit 4e1370cbc3
5 changed files with 20 additions and 10 deletions

View File

@ -79,7 +79,7 @@ _holderMagazinesStart = magazinesAmmoCargo _holder;
{
EXPLODE_2_PVT(_x,_xClassname,_xAmmo);
if ((_xClassname in _listOfItemsToRemove) && {!(_xClassname in UNIQUE_MAGAZINES)}) then {
if ((_xClassname in _listOfItemsToRemove) && {(getNumber (configFile >> "CfgMagazines" >> _xClassname >> "ACE_isUnique")) == 0}) then {
_holder addMagazineAmmoCargo [_xClassname, 1, _xAmmo];
_target removeMagazine _xClassname;
};
@ -89,7 +89,7 @@ _targetMagazinesEnd = magazinesAmmo _target;
_holderMagazinesEnd = magazinesAmmoCargo _holder;
//Verify Mags dropped from unit:
if ( ({((_x select 0) in _listOfItemsToRemove) && {!((_x select 0) in UNIQUE_MAGAZINES)}} count _targetMagazinesEnd) != 0) exitWith {
if (({((_x select 0) in _listOfItemsToRemove) && {(getNumber (configFile >> "CfgMagazines" >> (_x select 0) >> "ACE_isUnique")) == 0}} count _targetMagazinesEnd) != 0) exitWith {
_holder setVariable [QGVAR(holderInUse), false];
[_caller, _target, "Debug: Didn't Remove Magazines"] call FUNC(eventTargetFinish);
};
@ -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

View File

@ -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);

View File

@ -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);

View File

@ -13,4 +13,3 @@
#define DISARM_CONTAINER "GroundWeaponHolder"
#define DUMMY_ITEM "ACE_DebugPotato"
#define UNIQUE_MAGAZINES ["ACE_key_customKeyMagazine"]

View File

@ -6,5 +6,6 @@ class CfgMagazines {
descriptionShort = "$STR_ACE_Vehicle_Item_Custom_Description";
count = 1;
mass = 0;
ACE_isUnique = 1;
};
};