mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Inv Screen Rough WIP
This commit is contained in:
parent
e94d7e33dc
commit
d55aed0813
@ -3,66 +3,13 @@ class CfgVehicles {
|
||||
class CAManBase: Man {
|
||||
class ACE_Actions {
|
||||
class ACE_Disarm {
|
||||
displayName = "Disarm >>";
|
||||
displayName = "Disarm";
|
||||
distance = 3;
|
||||
condition = QUOTE([ARR_2(_player, _target)] call FUNC(canDisarm));
|
||||
condition = QUOTE([_target] call FUNC(canDisarm));
|
||||
statement = "";
|
||||
showDisabled = 0;
|
||||
priority = 3.2;
|
||||
// icon = PATHTOF(UI\team\team_management_ca.paa);
|
||||
subMenu[] = {"ACE_Disarm", 0};
|
||||
// hotkey = "M";
|
||||
enableInside = 0;
|
||||
|
||||
class ACE_primaryweapononly {
|
||||
displayName = "primaryweapononly";
|
||||
distance = 3;
|
||||
condition = QUOTE([ARR_3(_player, _target, 'primaryweapononly')] call FUNC(canDisarm));
|
||||
statement = QUOTE([ARR_3(_player, _target, 'primaryweapononly')] call FUNC(startDisarmCaller));
|
||||
exceptions[] = {};
|
||||
showDisabled = 1;
|
||||
priority = 80085;
|
||||
// icon = QUOTE(PATHTOF(UI\handcuff_ca.paa));
|
||||
// hotkey = "C";
|
||||
};
|
||||
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));
|
||||
priority = 80082;
|
||||
};
|
||||
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;
|
||||
};
|
||||
|
||||
class ACE_openFrisk2: ACE_primaryweapononly {
|
||||
displayName = "Frisk2";
|
||||
condition = QUOTE([ARR_2(_player, _target)] call FUNC(canFrisk2));
|
||||
statement = QUOTE([ARR_2(_player, _target)] call FUNC(doFrisk2));
|
||||
priority = 80078;
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
["Disarm", {_this call FUNC(startDisarmTarget)}] call EFUNC(common,addEventHandler);
|
||||
["DisarmFinished", {_this call FUNC(finishDisarmCaller)}] call EFUNC(common,addEventHandler);
|
||||
["DisarmFinished", {_this call FUNC(eventCallerFinish)}] call EFUNC(common,addEventHandler);
|
||||
|
@ -1,41 +1,25 @@
|
||||
/*
|
||||
* Author: PabstMirror
|
||||
* Checks the conditions for being able to disarm
|
||||
* Checks the conditions for being able to disarm a unit
|
||||
*
|
||||
* Arguments:
|
||||
* 0: caller (player) <OBJECT>
|
||||
* 1: target <OBJECT>
|
||||
* 2: type of disarm <STRING><OPTIONAL>
|
||||
* 0: target <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* The return value <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* [player, cursorTarget, "backpack"] call ace_disarming_fnc_canDisarm
|
||||
* [cursorTarget] call ace_disarming_fnc_canDisarm
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_2(_caller,_target);
|
||||
DEFAULT_PARAM(2,_type,"");
|
||||
PARAMS_2(_target);
|
||||
|
||||
_returnValue = false;
|
||||
|
||||
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 ("primaryweapononly"): {_returnValue = ((primaryWeapon _target) != "");};
|
||||
case ("secondaryweapononly"): {_returnValue = ((secondaryWeapon _target) != "");};
|
||||
case ("handgunweapononly"): {_returnValue = ((handgunWeapon _target) != "");};
|
||||
case ("backpack"): {_returnValue = ((backpack _target) != "");};
|
||||
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");};
|
||||
};
|
||||
};
|
||||
|
||||
_returnValue
|
||||
(alive _target) &&
|
||||
{(abs (speed _target)) < 0.1} &&
|
||||
{(_target getVariable ["ACE_isUnconscious", false]) ||
|
||||
{_target getVariable [QEGVAR(captives,isHandcuffed), false]} ||
|
||||
{_target getVariable [QEGVAR(captives,isSurrendering), false]}}
|
||||
|
@ -1,8 +0,0 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_2(_caller,_target);
|
||||
|
||||
(_target getVariable ["ACE_isUnconscious", false]) ||
|
||||
{_target getVariable [QEGVAR(captives,isHandcuffed), false]} ||
|
||||
{_target getVariable [QEGVAR(captives,isSurrendering), false]}
|
@ -1,3 +1,21 @@
|
||||
/*
|
||||
* Author: PabstMirror
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* 0: caller (player) <OBJECT>
|
||||
* 1: target <OBJECT>
|
||||
* 2: classnamess <ARRAY>
|
||||
* 3: Do Not Drop Ammo <BOOL><OPTIONAL>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* [player, cursorTarget, ["ace_bandage"]] call ace_disarming_fnc_disarmDropItems
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
#define TIME_MAX_WAIT 5
|
||||
@ -13,17 +31,23 @@ _fncSumArray = {
|
||||
_return
|
||||
};
|
||||
|
||||
//Sanity Check
|
||||
//Sanity Checks
|
||||
if (!([_target] call FUNC(canDisarm))) exitWith {
|
||||
[_caller, _target, "Debug: Cannot disarm target"] call FUNC(eventTargetFinish);
|
||||
};
|
||||
if (_doNotDropAmmo && {({_x in _listOfItemsToRemove} count (magazines _target)) > 0}) exitWith {
|
||||
[_caller, _target, "magazines and _doNotDropAmmo error"] call FUNC(finishDisarmTarget);
|
||||
[_caller, _target, "Debug: Trying to drop magazine with _doNotDropAmmo flag"] call FUNC(eventTargetFinish);
|
||||
};
|
||||
|
||||
_holder = objNull;
|
||||
{
|
||||
if ((_x getVariable [QGVAR(disarmUnit), objNull]) == _target) exitWith {
|
||||
_holder = _x;
|
||||
};
|
||||
} forEach ((getpos _target) nearObjects ["WeaponHolderSimulated", 3]);
|
||||
if (!_doNotDropAmmo) then {
|
||||
//Try to use the same container, if one exists
|
||||
{
|
||||
if ((_x getVariable [QGVAR(disarmUnit), objNull]) == _target) exitWith {
|
||||
_holder = _x;
|
||||
};
|
||||
} forEach ((getpos _target) nearObjects ["WeaponHolderSimulated", 3]);
|
||||
};
|
||||
|
||||
if (isNull _holder) then {
|
||||
_dropPos = _target modelToWorld [-0.75, 0.75, 0];
|
||||
@ -34,8 +58,16 @@ if (isNull _holder) then {
|
||||
|
||||
//Verify holder created
|
||||
if (isNull _holder) exitWith {
|
||||
[_caller, _target, "Create Holder"] call FUNC(finishDisarmTarget);
|
||||
[_caller, _target, "Debug: Null Holder"] call FUNC(eventTargetFinish);
|
||||
};
|
||||
//Make sure only one drop operation at a time...
|
||||
if (_holder getVariable [QGVAR(holderInUse), false]) exitWith {
|
||||
systemChat format ["Debug: %1 - Ground Container In Use, waiting until free", time];
|
||||
[{
|
||||
_this call FUNC(disarmDropItems);
|
||||
}, 0.05, 0.05, _this] call EFUNC(common,waitAndExecute);
|
||||
};
|
||||
_holder setVariable [QGVAR(holderInUse), true];
|
||||
|
||||
|
||||
//Remove Magazines
|
||||
@ -55,12 +87,13 @@ _holderMagazinesEnd = magazinesAmmoCargo _holder;
|
||||
|
||||
//Verify Mags dropped from unit:
|
||||
if ( ({(_x select 0) in _listOfItemsToRemove} count _targetMagazinesEnd) != 0) exitWith {
|
||||
[_caller, _target, "Didn't Remove Magazines"] call FUNC(finishDisarmTarget);
|
||||
_holder setVariable [QGVAR(holderInUse), false];
|
||||
[_caller, _target, "Debug: Didn't Remove Magazines"] call FUNC(eventTargetFinish);
|
||||
};
|
||||
//Verify holder has mags unit had (lazy count for now)
|
||||
if (((count _targetMagazinesStart) - (count _targetMagazinesEnd)) != ((count _holderMagazinesEnd) - (count _holderMagazinesStart))) exitWith {
|
||||
ERR = [_targetMagazinesEnd, _targetMagazinesStart, _holderMagazinesEnd, _holderMagazinesStart];
|
||||
[_caller, _target, "Crate Magazines"] call FUNC(finishDisarmTarget);
|
||||
_holder setVariable [QGVAR(holderInUse), false];
|
||||
[_caller, _target, "Debug: Crate Magazines not in holder"] call FUNC(eventTargetFinish);
|
||||
};
|
||||
|
||||
|
||||
@ -97,11 +130,14 @@ _targetItemsEnd = ((assignedItems _target) + (items _target) + [headgear _target
|
||||
|
||||
//Verify Items Added (lazy count)
|
||||
if (((count _targetItemsStart) - (count _targetItemsEnd)) != ([_addToCrateCount] call _fncSumArray)) exitWith {
|
||||
ERR = [_targetItemsStart, _targetItemsEnd, _addToCrateClassnames, _addToCrateCount];
|
||||
[_caller, _target, "Items Not Removed From Player"] call FUNC(finishDisarmTarget);
|
||||
|
||||
_holder setVariable [QGVAR(holderInUse), false];
|
||||
[_caller, _target, "Debug: Items Not Removed From Player"] call FUNC(eventTargetFinish);
|
||||
};
|
||||
if ((([_holderItemsEnd select 1] call _fncSumArray) - ([_holderItemsStart select 1] call _fncSumArray)) != ([_addToCrateCount] call _fncSumArray)) exitWith {
|
||||
[_caller, _target, "Items Not Added to Holder"] call FUNC(finishDisarmTarget);
|
||||
|
||||
_holder setVariable [QGVAR(holderInUse), false];
|
||||
[_caller, _target, "Debug: Items Not Added to Holder"] call FUNC(eventTargetFinish);
|
||||
};
|
||||
|
||||
|
||||
@ -109,7 +145,7 @@ if ((([_holderItemsEnd select 1] call _fncSumArray) - ([_holderItemsStart select
|
||||
//So add a dummy item and just remove at the end
|
||||
_holderIsEmpty = (([_holderItemsEnd select 1] call _fncSumArray) + (count _holderMagazinesEnd)) == 0;
|
||||
if (_holderIsEmpty) then {
|
||||
systemChat "Empty: making dummy";
|
||||
systemChat "Debug: making dummy";
|
||||
_holder addItemCargoGlobal [DUMMY_ITEM, 1];
|
||||
};
|
||||
|
||||
@ -178,7 +214,9 @@ systemChat format ["PFEh start %1", time];
|
||||
|
||||
//If we added a dummy item, remove it now
|
||||
if (_holderIsEmpty && {!((getItemCargo _holder) isEqualTo [[DUMMY_ITEM],[1]])}) exitWith {
|
||||
[_caller, _target, "Holder should only have dummy item"] call FUNC(finishDisarmTarget);
|
||||
|
||||
_holder setVariable [QGVAR(holderInUse), false];
|
||||
[_caller, _target, "Debug: Holder should only have dummy item"] call FUNC(eventTargetFinish);
|
||||
};
|
||||
if (_holderIsEmpty) then {
|
||||
systemChat "Debug: Deleting Dummy";
|
||||
@ -187,25 +225,29 @@ systemChat format ["PFEh start %1", time];
|
||||
|
||||
//Verify we didn't timeout waiting on drop action
|
||||
if (time >= _maxWaitTime) exitWith {
|
||||
[_caller, _target, "Drop Actions Timeout"] call FUNC(finishDisarmTarget);
|
||||
_holder setVariable [QGVAR(holderInUse), false];
|
||||
[_caller, _target, "Debug: Drop Actions Timeout"] call FUNC(eventTargetFinish);
|
||||
};
|
||||
|
||||
if (_needToRemoveVest && {!((vestItems _target) isEqualTo [])}) exitWith {
|
||||
[_caller, _target, "Vest Not Empty"] call FUNC(finishDisarmTarget);
|
||||
_holder setVariable [QGVAR(holderInUse), false];
|
||||
[_caller, _target, "Debug: Vest Not Empty"] call FUNC(eventTargetFinish);
|
||||
};
|
||||
if (_needToRemoveVest) then {
|
||||
removeVest _target;
|
||||
_holder addItemCargoGlobal [(vest _target), 1];
|
||||
};
|
||||
if (_needToRemoveUniform && {!((uniformItems _target) isEqualTo [])}) exitWith {
|
||||
[_caller, _target, "Uniform Not Empty"] call FUNC(finishDisarmTarget);
|
||||
_holder setVariable [QGVAR(holderInUse), false];
|
||||
[_caller, _target, "Debug: Uniform Not Empty"] call FUNC(eventTargetFinish);
|
||||
};
|
||||
if (_needToRemoveUniform) then {
|
||||
removeUniform _target;
|
||||
_holder addItemCargoGlobal [(uniform _target), 1];
|
||||
};
|
||||
|
||||
[_caller, _target, "Victory"] call FUNC(finishDisarmTarget);
|
||||
_holder setVariable [QGVAR(holderInUse), false];
|
||||
[_caller, _target, "Debug: Victory!!!"] call FUNC(eventTargetFinish);
|
||||
};
|
||||
|
||||
}, 0.0, [_caller,_target, _listOfItemsToRemove, _holder, _holderIsEmpty, (time + TIME_MAX_WAIT), _doNotDropAmmo, _targetMagazinesEnd]] call CBA_fnc_addPerFrameHandler;
|
||||
|
@ -1,68 +0,0 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_2(_caller,_target);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
closeDialog 0;
|
||||
createDialog "ace_disarming_friskInventory";
|
||||
|
||||
disableSerialization;
|
||||
|
||||
|
||||
_display = uiNamespace getVariable ['PABST_friskInventory', displayNull];
|
||||
|
||||
_pc = _display displayCtrl 633;
|
||||
_pc ctrlAddEventHandler ["LBDrop", {
|
||||
x2 = _this;
|
||||
systemChat format ["LBDrop pc %1", _this];
|
||||
|
||||
// PARAMS_5(_ctrl,_xPos,_yPos,_idc,_itemInfo);
|
||||
// EXPLODE_PVT_3((_itemInfo select 0),_displayText,_value,_data);
|
||||
|
||||
// _ctrl lbAdd _data;
|
||||
(x2 select 0) lbAdd (((x2 select 4) select 0) select 2);
|
||||
}];
|
||||
|
||||
|
||||
_gc = _display displayCtrl 632;
|
||||
// _gc ctrlAddEventHandler ["LBDrag", {x1 = _this;systemChat format ["LBDrag %1", _this]}];
|
||||
// _gc ctrlAddEventHandler ["LBDragging", {systemChat format ["LBDragging %1", _this]}];
|
||||
// _gc ctrlAddEventHandler ["LBDrop", {systemChat format ["LBDrop gc %1", _this]}];
|
||||
|
||||
// _gc ctrlSetActiveColor [0,0,0,1];
|
||||
|
||||
_uniqueItems = [player] call ace_disarming_fnc_getAllGear;
|
||||
|
||||
{
|
||||
_displayName = "";
|
||||
_picture = "";
|
||||
_count = (_uniqueItems select 1) select _forEachIndex;
|
||||
|
||||
switch (true) do {
|
||||
case (isClass (configFile >> "CfgWeapons" >> _x)): {
|
||||
_displayName = getText (configFile >> "CfgWeapons" >> _x >> "displayName");
|
||||
_picture = getText (configFile >> "CfgWeapons" >> _x >> "picture");
|
||||
};
|
||||
case (isClass (configFile >> "CfgMagazines" >> _x)): {
|
||||
_displayName = getText (configFile >> "CfgMagazines" >> _x >> "displayName");
|
||||
_picture = getText (configFile >> "CfgMagazines" >> _x >> "picture");
|
||||
};
|
||||
case (isClass (configFile >> "CfgVehicles" >> _x)): {
|
||||
_displayName = getText (configFile >> "CfgVehicles" >> _x >> "displayName");
|
||||
_picture = getText (configFile >> "CfgVehicles" >> _x >> "picture");
|
||||
};
|
||||
case (isClass (configFile >> "CfgGlasses" >> _x)): {
|
||||
_displayName = getText (configFile >> "CfgGoggles" >> _x >> "displayName");
|
||||
_picture = getText (configFile >> "CfgGoggles" >> _x >> "picture");
|
||||
};
|
||||
};
|
||||
_gc lbAdd format ["1x %2", _count, _displayName];
|
||||
_gc lbSetData [_forEachIndex, _x];
|
||||
_gc lbSetPicture [_forEachIndex, _picture];
|
||||
} forEach (_uniqueItems select 0);
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
* Arguments:
|
||||
* 0: caller (player) <OBJECT>
|
||||
* 1: target <OBJECT>
|
||||
* 2: type of disarm <STRING>
|
||||
* 2: error message <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
@ -17,6 +17,8 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_3(_caller,_target,_type);
|
||||
PARAMS_3(_caller,_target,_errorMsg);
|
||||
|
||||
["Disarm", [_target], [_caller,_target,_type]] call EFUNC(common,targetEvent);
|
||||
if (_caller != ACE_player) exitWith {};
|
||||
|
||||
systemChat format ["Debug-Caller: Disarm finished from [%1] with code [%2]", _target, _errorMsg];
|
@ -3,23 +3,22 @@
|
||||
* TODO
|
||||
*
|
||||
* Arguments:
|
||||
* 0: caller (player) <OBJECT>
|
||||
* 0: caller <OBJECT>
|
||||
* 1: target <OBJECT>
|
||||
* 1: type of disarm <STRING>
|
||||
* 2: errorMsg <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* The return value <BOOL>
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* finishDisarmTarget
|
||||
* eventTargetFinish
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
|
||||
PARAMS_3(_caller,_target,_errorMsg);
|
||||
|
||||
systemChat format ["Debug-Target: Disarm finished with code [%1]", _errorMsg];
|
||||
_target setVariable [QGVAR(disarmInProgress), false];
|
||||
|
||||
["DisarmFinished", [_caller], [_caller, _target, _errorMsg]] call EFUNC(common,targetEvent);
|
34
addons/disarming/functions/fnc_eventTargetStart.sqf
Normal file
34
addons/disarming/functions/fnc_eventTargetStart.sqf
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Author: PabstMirror
|
||||
* TODO
|
||||
*
|
||||
* Arguments:
|
||||
* 0: caller (player) <OBJECT>
|
||||
* 1: target <OBJECT>
|
||||
* 2: type of disarm <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* finishDisarmTarget
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_3(_caller,_target,_listOfObjectsToRemove);
|
||||
|
||||
[{
|
||||
PARAMS_2(_args,_pfID);
|
||||
EXPLODE_3_PVT(_args,_caller,_target,_listOfObjectsToRemove);
|
||||
|
||||
if (!([_target] call FUNC(canDisarm))) exitWith {
|
||||
[_pfID] call CBA_fnc_removePerFrameHandler;
|
||||
}:
|
||||
|
||||
if (!(_target getVariable [QGVAR(disarmInProgress), false])) then {
|
||||
[_pfID] call CBA_fnc_removePerFrameHandler;
|
||||
_args call FUNC(disarmDropItems);
|
||||
};
|
||||
}, 0, _this] call CBA_fnc_addPerFrameHandler;
|
@ -1,23 +0,0 @@
|
||||
/*
|
||||
* Author: PabstMirror
|
||||
* TODO
|
||||
*
|
||||
* Arguments:
|
||||
* 0: caller (player) <OBJECT>
|
||||
* 1: target <OBJECT>
|
||||
* 1: type of disarm <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* The return value <BOOL>
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
|
||||
PARAMS_3(_caller,_target,_errorMsg);
|
||||
|
||||
systemChat format ["Debug-Caller: Disarm finished with code [%1]", _errorMsg];
|
11
addons/disarming/functions/fnc_getAllGearContainer.sqf
Normal file
11
addons/disarming/functions/fnc_getAllGearContainer.sqf
Normal file
@ -0,0 +1,11 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_1(_target);
|
||||
|
||||
_allGear = [[],[]];
|
||||
|
||||
{
|
||||
//todo: Use 1.40 Append
|
||||
_allGear set [0, (_allGear select 0) + (_x select 0)];
|
||||
_allGear set [1, (_allGear select 1) + (_x select 1)];
|
||||
} forEach [(getWeaponCargo _target), (getItemCargo _target), (getMagazineCargo _target), (getBackpackCargo _target)];
|
@ -16,6 +16,10 @@ if ((uniform _target) != "") then {
|
||||
if ((headgear _target) != "") then {
|
||||
_allItems pushBack (headgear _target);
|
||||
};
|
||||
//What kind of asshole takes a man's glasses?
|
||||
if ((goggles _target) != "") then {
|
||||
_allItems pushBack (goggles _target);
|
||||
};
|
||||
|
||||
_uniqueClassnames = [];
|
||||
_classnamesCount = [];
|
77
addons/disarming/functions/fnc_openDisarmDialog.sqf
Normal file
77
addons/disarming/functions/fnc_openDisarmDialog.sqf
Normal file
@ -0,0 +1,77 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_2(_caller,_target);
|
||||
|
||||
//Sanity Checks
|
||||
if (_caller != ACE_player) exitwith {ERROR("Player isn't caller?");};
|
||||
if (!([_target] call FUNC(canDisarm))) exitWith {ERROR("Unit Cannot Be Disarmed");};
|
||||
if (!([] call EGVAR(common,canInteract))) exitWith {ERROR("Player cannot Interact");};
|
||||
|
||||
closeDialog 0;
|
||||
createDialog "friskInventory";
|
||||
|
||||
disableSerialization;
|
||||
|
||||
_display = uiNamespace getVariable ['PABST_friskInventory', displayNull];
|
||||
if (isNull _display) exitWith {ERROR("Display is Null");};
|
||||
|
||||
GVAR(disarmTarget) = _target;
|
||||
|
||||
//Setup Drop Event (on right pannel)
|
||||
(_display displayCtrl 632) ctrlAddEventHandler ["LBDrop", {
|
||||
if (isNull GVAR(disarmTarget)) exitWith {};
|
||||
PARAMS_5(_ctrl,_xPos,_yPos,_idc,_itemInfo);
|
||||
EXPLODE_3_PVT((_itemInfo select 0),_displayText,_value,_data);
|
||||
|
||||
systemChat format ["Debug: Droping %1 from %2", _data, GVAR(disarmTarget)];
|
||||
[ACE_player, GVAR(disarmTarget), [_data]] call FUNC(disarmDropItems);
|
||||
false
|
||||
}];
|
||||
|
||||
//Setup PFEH
|
||||
[{
|
||||
disableSerialization;
|
||||
EXPLODE_2_PVT(_this,_args,_pfID);
|
||||
EXPLODE_3_PVT(_args,_player,_target,_display);
|
||||
|
||||
|
||||
if ((!([_target] call FUNC(unitCanBeDisarmed))) ||
|
||||
{isNull _display} ||
|
||||
{_player != ACE_player} ||
|
||||
{!([] call EGVAR(common,canInteract))}) then {
|
||||
|
||||
[_pfID] call CBA_fnc_removePerFrameHandler;
|
||||
GVAR(disarmTarget) = objNull;
|
||||
if (!isNull _display) then {closeDialog 0;}; //close dialog if still open
|
||||
} else {
|
||||
_groundContainer = _display displayCtrl 632;
|
||||
_targetContainer = _display displayCtrl 633;
|
||||
_playerName = _display displayCtrl 111;
|
||||
_rankPicture = _display displayCtrl 1203;
|
||||
|
||||
_rankPicture ctrlSetText "\A3\Ui_f\data\GUI\Cfg\Ranks\corporal_gs.paa";
|
||||
_playerName ctrlSetText ([GVAR(disarmTarget)] call EFUNC(common,getName));
|
||||
|
||||
lbClear _groundContainer;
|
||||
lbClear _targetContainer;
|
||||
|
||||
_targetUniqueItems = [GVAR(disarmTarget)] call FUNC(getAllGearUnit);
|
||||
[_targetContainer, _targetUniqueItems] call FUNC(showItemsInListbox);
|
||||
|
||||
|
||||
_holder = objNull;
|
||||
{
|
||||
if ((_x getVariable [QGVAR(disarmUnit), objNull]) == _target) exitWith {
|
||||
_holder = _x;
|
||||
};
|
||||
} forEach ((getpos _target) nearObjects ["WeaponHolderSimulated", 3]);
|
||||
|
||||
if (!isNull _holder) then {
|
||||
|
||||
_targetUniqueItems = [_holder] call FUNC(getAllGearContainer);
|
||||
[_groundContainer, _targetUniqueItems] call FUNC(showItemsInListbox);
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
}, 0.05, [_caller, _target, _display]] call CBA_fnc_addPerFrameHandler;
|
50
addons/disarming/functions/fnc_showItemsInListbox.sqf
Normal file
50
addons/disarming/functions/fnc_showItemsInListbox.sqf
Normal file
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Author: PabstMirror
|
||||
* Checks the conditions for being able to disarm
|
||||
*
|
||||
* Arguments:
|
||||
* 0: RscListBox <CONTROL>
|
||||
* 1: ItemArray [["items"],[counts]] <ARRAY>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* [theListBox, [["ace_bandage"],[2]]] call ace_disarming_fnc_showItemsInListbox
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
disableSerialization;
|
||||
PARAMS_2(_listBoxCtrl,_itemsCountArray);
|
||||
|
||||
{
|
||||
_displayName = "";
|
||||
_picture = "";
|
||||
_count = (_itemsCountArray select 1) select _forEachIndex;
|
||||
|
||||
switch (true) do {
|
||||
case (isClass (configFile >> "CfgWeapons" >> _x)): {
|
||||
_displayName = getText (configFile >> "CfgWeapons" >> _x >> "displayName");
|
||||
_picture = getText (configFile >> "CfgWeapons" >> _x >> "picture");
|
||||
};
|
||||
case (isClass (configFile >> "CfgMagazines" >> _x)): {
|
||||
_displayName = getText (configFile >> "CfgMagazines" >> _x >> "displayName");
|
||||
_picture = getText (configFile >> "CfgMagazines" >> _x >> "picture");
|
||||
};
|
||||
case (isClass (configFile >> "CfgVehicles" >> _x)): {
|
||||
_displayName = getText (configFile >> "CfgVehicles" >> _x >> "displayName");
|
||||
_picture = getText (configFile >> "CfgVehicles" >> _x >> "picture");
|
||||
};
|
||||
case (isClass (configFile >> "CfgGlasses" >> _x)): {
|
||||
_displayName = getText (configFile >> "CfgGoggles" >> _x >> "displayName");
|
||||
_picture = getText (configFile >> "CfgGoggles" >> _x >> "picture");
|
||||
};
|
||||
};
|
||||
|
||||
_listBoxCtrl lbAdd format ["%1", _displayName];
|
||||
_listBoxCtrl lbSetData [_forEachIndex, _x];
|
||||
_listBoxCtrl lbSetPicture [_forEachIndex, _picture];
|
||||
_listBoxCtrl lbSetTextRight [_forEachIndex, str _count];
|
||||
} forEach (_itemsCountArray select 0);
|
@ -1,66 +0,0 @@
|
||||
/*
|
||||
* Author: PabstMirror
|
||||
* Starts disarming the target from the target
|
||||
* Generates the specific list of items that should be removed from a disarm type
|
||||
*
|
||||
* Arguments:
|
||||
* 0: caller (player) <OBJECT>
|
||||
* 1: target <OBJECT>
|
||||
* 1: type of disarm <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_3(_caller,_target,_type);
|
||||
|
||||
_listOfItemsToRemove = [];
|
||||
_doNotDropAmmo = false;
|
||||
|
||||
switch (toLower _type) do {
|
||||
case ("primaryweapononly"): {
|
||||
_listOfItemsToRemove = [(primaryWeapon _target)];
|
||||
_doNotDropAmmo = true;
|
||||
};
|
||||
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);
|
Loading…
Reference in New Issue
Block a user