Fix HMD bug and disarm types

This commit is contained in:
PabstMirror 2015-02-11 14:37:18 -06:00
parent a7004cf0e9
commit 69835ec7fb
5 changed files with 85 additions and 42 deletions

View File

@ -14,39 +14,48 @@ class CfgVehicles {
// hotkey = "M";
enableInside = 0;
class ACE_removeWeapons {
displayName = "Remove Weapons";
class ACE_primaryweapononly {
displayName = "primaryweapononly";
distance = 3;
condition = QUOTE([ARR_3(_player, _target, 'weapons')] call FUNC(canDisarm));
statement = QUOTE([ARR_3(_player, _target, 'weapons')] call FUNC(startDisarmCaller));
condition = QUOTE([ARR_3(_player, _target, 'primaryweapononly')] call FUNC(canDisarm));
statement = QUOTE([ARR_3(_player, _target, 'primaryweapononly')] call FUNC(startDisarmCaller));
exceptions[] = {};
showDisabled = 1;
priority = 2.4;
priority = 80085;
// icon = QUOTE(PATHTOF(UI\handcuff_ca.paa));
// hotkey = "C";
};
class ACE_removeBackpack {
displayName = "Remove Backpack";
distance = 3;
class ACE_secondaryweapononly: ACE_primaryweapononly {
displayName = "secondaryweapononly";
condition = QUOTE([ARR_3(_player, _target, 'secondaryweapononly')] call FUNC(canDisarm));
statement = QUOTE([ARR_3(_player, _target, 'secondaryweapononly')] call FUNC(startDisarmCaller));
priority = 80084;
};
class ACE_handgunweapononly: ACE_primaryweapononly {
displayName = "handgunweapononly";
condition = QUOTE([ARR_3(_player, _target, 'handgunweapononly')] call FUNC(canDisarm));
statement = QUOTE([ARR_3(_player, _target, 'handgunweapononly')] call FUNC(startDisarmCaller));
priority = 80083;
};
class ACE_backpack: ACE_primaryweapononly {
displayName = "handgunweapononly";
condition = QUOTE([ARR_3(_player, _target, 'backpack')] call FUNC(canDisarm));
statement = QUOTE([ARR_3(_player, _target, 'backpack')] call FUNC(startDisarmCaller));
exceptions[] = {};
showDisabled = 1;
priority = 2.4;
// icon = QUOTE(PATHTOF(UI\handcuff_ca.paa));
// hotkey = "C";
priority = 80082;
};
class ACE_removeUniform {
displayName = "Remove Uniform";
distance = 3;
condition = QUOTE([ARR_3(_player, _target, 'uniform')] call FUNC(canDisarm));
statement = QUOTE([ARR_3(_player, _target, 'uniform')] call FUNC(startDisarmCaller));
exceptions[] = {};
showDisabled = 1;
priority = 2.4;
// icon = QUOTE(PATHTOF(UI\handcuff_ca.paa));
// hotkey = "C";
class ACE_alldangerous: ACE_primaryweapononly {
displayName = "alldangerous";
condition = QUOTE([ARR_3(_player, _target, 'alldangerous')] call FUNC(canDisarm));
statement = QUOTE([ARR_3(_player, _target, 'alldangerous')] call FUNC(startDisarmCaller));
priority = 80081;
};
class ACE_strip: ACE_primaryweapononly {
displayName = "strip";
condition = QUOTE([ARR_3(_player, _target, 'strip')] call FUNC(canDisarm));
statement = QUOTE([ARR_3(_player, _target, 'strip')] call FUNC(startDisarmCaller));
priority = 80080;
};
};
};
};

View File

@ -22,12 +22,18 @@ DEFAULT_PARAM(2,_type,"");
_returnValue = false;
if ((_target getVariable ["ACE_isUnconscious", false]) || {_target getVariable [QEGVAR(captives,isHandcuffed), false]} || {_target getVariable [QEGVAR(captives,isSurrendering), false]}) then {
switch (_type) do {
if ((_target getVariable ["ACE_isUnconscious", false]) ||
{_target getVariable [QEGVAR(captives,isHandcuffed), false]} ||
{_target getVariable [QEGVAR(captives,isSurrendering), false]}) then {
switch (toLower _type) do {
case (""): {_returnValue = true;};
case ("uniform"): {_returnValue = ((uniform _target) != "");};
case ("primaryweapononly"): {_returnValue = ((primaryWeapon _target) != "");};
case ("secondaryweapononly"): {_returnValue = ((secondaryWeapon _target) != "");};
case ("handgunweapononly"): {_returnValue = ((handgunWeapon _target) != "");};
case ("backpack"): {_returnValue = ((backpack _target) != "");};
case ("weapons"): {_returnValue = ((count (weapons _target)) > 0);};
case ("alldangerous"): {_returnValue = ((count (weapons _target)) > 0) || {(count (magazines _target)) > 0} || {({_x in DANGEROUS_ITEMS} count ((items _target) + (assignedItems _target))) > 0};};
case ("strip"): {_returnValue = true;};
default {systemChat "type unknown"; ERROR("type unknown");};
};
};

View File

@ -58,14 +58,15 @@ if ( ({(_x select 0) in _listOfItemsToRemove} count _targetMagazinesEnd) != 0) e
[_caller, _target, "Didn't Remove Magazines"] call FUNC(finishDisarmTarget);
};
//Verify holder has mags unit had (lazy count for now)
if (((count _targetMagazinesEnd) - (count _targetMagazinesStart)) != ((count _holderMagazinesEnd) - (count _holderMagazinesStart))) exitWith {
if (((count _targetMagazinesStart) - (count _targetMagazinesEnd)) != ((count _holderMagazinesEnd) - (count _holderMagazinesStart))) exitWith {
ERR = [_targetMagazinesEnd, _targetMagazinesStart, _holderMagazinesEnd, _holderMagazinesStart];
[_caller, _target, "Crate Magazines"] call FUNC(finishDisarmTarget);
};
//Remove Items, Assigned Items and NVG
_holderItemsStart = getitemCargo _holder;
_targetItemsStart = ((assignedItems _target) + (items _target) + [hmd _target] + [headgear _target]);
_targetItemsStart = ((assignedItems _target) + (items _target) + [headgear _target]);
_addToCrateClassnames = [];
_addToCrateCount = [];
@ -92,10 +93,11 @@ _addToCrateCount = [];
} forEach _addToCrateClassnames;
_holderItemsEnd = getitemCargo _holder;
_targetItemsEnd = ((assignedItems _target) + (items _target) + [hmd _target] + [headgear _target]);
_targetItemsEnd = ((assignedItems _target) + (items _target) + [headgear _target]);
//Verify Items Added (lazy count)
if (((count _targetItemsEnd) - (count _targetItemsStart)) != ([_addToCrateCount] call _fncSumArray)) exitWith {
if (((count _targetItemsStart) - (count _targetItemsEnd)) != ([_addToCrateCount] call _fncSumArray)) exitWith {
ERR = [_targetItemsStart, _targetItemsEnd, _addToCrateClassnames, _addToCrateCount];
[_caller, _target, "Items Not Removed From Player"] call FUNC(finishDisarmTarget);
};
if ((([_holderItemsEnd select 1] call _fncSumArray) - ([_holderItemsStart select 1] call _fncSumArray)) != ([_addToCrateCount] call _fncSumArray)) exitWith {

View File

@ -24,19 +24,43 @@ _listOfItemsToRemove = [];
_doNotDropAmmo = false;
switch (toLower _type) do {
case ("backpack"): {
_listOfItemsToRemove pushBack (backpack _target);
};
case ("weapons"): {
_listOfItemsToRemove = _listOfItemsToRemove + (weapons _target);
case ("primaryweapononly"): {
_listOfItemsToRemove = [(primaryWeapon _target)];
_doNotDropAmmo = true;
};
case ("uniform"): {
_listOfItemsToRemove = [(uniform _target)];
case ("secondaryweapononly"): {
_listOfItemsToRemove = [(secondaryWeapon _target)];
_doNotDropAmmo = true;
};
case ("handgunweapononly"): {
_listOfItemsToRemove = [(handgunWeapon _target)];
_doNotDropAmmo = true;
};
case ("backpack"): {
_listOfItemsToRemove = [(backpack _target)];
};
case ("alldangerous"): {
_listOfItemsToRemove = weapons _target;
{
if (!(_x in _listOfItemsToRemove)) then {
_listOfItemsToRemove pushBack _x;
};
} forEach (magazines _target);
{
if ((!(_x in _listOfItemsToRemove)) && {_x in DANGEROUS_ITEMS} && {_x != ""}) then {
_listOfItemsToRemove pushBack _x;
};
} forEach ((items _target) + (assignedItems _target));
};
case ("strip"): {
// _listOfItemsToRemove = [_target] call EFUNC(common,getAllGear);
_listOfItemsToRemove = [];
{
if ((!(_x in _listOfItemsToRemove)) && {_x != ""}) then {
_listOfItemsToRemove pushBack _x;
};
} forEach ((weapons _target) + (magazines _target) + (items _target) + (assignedItems _target) + [(backpack _target), (vest _target), (uniform _target)]);
};
};
[_caller, _target, _listOfItemsToRemove, _doNotDropAmmo] call FUNC(disarmDropItems);

View File

@ -9,4 +9,6 @@
#define DEBUG_SETTINGS DEBUG_SETTINGS_DISARMING
#endif
#include "\z\ace\addons\main\script_macros.hpp"
#include "\z\ace\addons\main\script_macros.hpp"
#define DANGEROUS_ITEMS ["ACE_Clacker", "ACE_M26_Clacker", "ACE_DeadManSwitch"]