Seems like it's working

This commit is contained in:
PabstMirror 2015-02-27 18:38:23 -06:00
parent 32f67487b5
commit d31c19c3eb
7 changed files with 49 additions and 20 deletions

View File

@ -2,14 +2,16 @@ class CfgVehicles {
class Man;
class CAManBase: Man {
class ACE_Actions {
class ACE_Disarm {
displayName = "Disarm";
distance = 3;
class ACE_MainActions {
class ACE_DisarmInventory {
displayName = "Open Inventory";
distance = 4;
condition = QUOTE([_target] call FUNC(canDisarm));
statement = "";
showDisabled = 0;
priority = 3.2;
enableInside = 0;
statement = QUOTE([ARR_2(_player,_target)] call FUNC(openDisarmDialog));
icon = "\a3\Modules_F_Curator\Data\portraitRespawnInventory_ca.paa"; //todo
selection = "spine3";
exceptions[] = {};
};
};
};
};

View File

@ -1,4 +1,4 @@
#include "script_component.hpp"
["DisarmStart", {_this call FUNC(startDisarmTarget)}] call EFUNC(common,addEventHandler);
["DisarmDropItems", {_this call FUNC(eventTargetStart)}] call EFUNC(common,addEventHandler);
["DisarmDebugCallback", {_this call FUNC(eventCallerFinish)}] call EFUNC(common,addEventHandler);

View File

@ -66,7 +66,7 @@ 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);
}, _this, 0.05, 0.05] call EFUNC(common,waitAndExecute);
};
_holder setVariable [QGVAR(holderInUse), true];
@ -100,7 +100,10 @@ if (((count _targetMagazinesStart) - (count _targetMagazinesEnd)) != ((count _ho
//Remove Items, Assigned Items and NVG
_holderItemsStart = getitemCargo _holder;
_targetItemsStart = ((assignedItems _target) + (items _target) + [headgear _target]);
_targetItemsStart = (assignedItems _target) + (items _target);
if ((headgear _target) != "") then {_targetItemsStart pushBack (headgear _target);};
if ((goggles _target) != "") then {_targetItemsStart pushBack (goggles _target);};
_addToCrateClassnames = [];
_addToCrateCount = [];
@ -127,11 +130,13 @@ _addToCrateCount = [];
} forEach _addToCrateClassnames;
_holderItemsEnd = getitemCargo _holder;
_targetItemsEnd = ((assignedItems _target) + (items _target) + [headgear _target]);
_targetItemsEnd = (assignedItems _target) + (items _target);
if ((headgear _target) != "") then {_targetItemsEnd pushBack (headgear _target);};
if ((goggles _target) != "") then {_targetItemsEnd pushBack (goggles _target);};
//Verify Items Added (lazy count)
if (((count _targetItemsStart) - (count _targetItemsEnd)) != ([_addToCrateCount] call _fncSumArray)) exitWith {
ERR = [_targetItemsStart, _targetItemsEnd, _addToCrateClassnames, _addToCrateCount];
_holder setVariable [QGVAR(holderInUse), false];
[_caller, _target, "Debug: Items Not Removed From Player"] call FUNC(eventTargetFinish);
};
@ -144,7 +149,7 @@ if ((([_holderItemsEnd select 1] call _fncSumArray) - ([_holderItemsStart select
//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
_holderIsEmpty = (([_holderItemsEnd select 1] call _fncSumArray) + (count _holderMagazinesEnd)) == 0;
_holderIsEmpty = ([_holder] call FUNC(getAllGearContainer)) isEqualTo [[],[]];
if (_holderIsEmpty) then {
systemChat "Debug: making dummy";
_holder addItemCargoGlobal [DUMMY_ITEM, 1];
@ -248,7 +253,7 @@ systemChat format ["PFEh start %1", time];
};
_holder setVariable [QGVAR(holderInUse), false];
[_caller, _target, "Debug: Victory!!!"] call FUNC(eventTargetFinish);
[_caller, _target, ""] call FUNC(eventTargetFinish);
};
}, 0.0, [_caller,_target, _listOfItemsToRemove, _holder, _holderIsEmpty, (time + TIME_MAX_WAIT), _doNotDropAmmo, _targetMagazinesEnd]] call CBA_fnc_addPerFrameHandler;

View File

@ -22,3 +22,4 @@ PARAMS_3(_caller,_target,_errorMsg);
if (_caller != ACE_player) exitWith {};
systemChat format ["Debug-Caller: Disarm finished from [%1] with code [%2]", _target, _errorMsg];
[format ["Problem Removing Item<br/>%1", _errorMsg]] call EFUNC(common,displayTextStructured);

View File

@ -11,7 +11,7 @@
* Nothing
*
* Example:
* finishDisarmTarget
* eventTargetStart
*
* Public: No
*/
@ -19,4 +19,20 @@
PARAMS_3(_caller,_target,_listOfObjectsToRemove);
_itemsToAdd = [];
{
if (_x == (uniform _target)) then {
_itemsToAdd = _itemsToAdd + (uniformItems _target);
};
if (_x == (vest _target)) then {
_itemsToAdd = _itemsToAdd + (vestItems _target);
};
} forEach _listOfObjectsToRemove;
{
if (!(_x in _listOfObjectsToRemove)) then {
_listOfObjectsToRemove pushBack _x;
};
} forEach _itemsToAdd;
[_caller, _target, _listOfObjectsToRemove] call FUNC(disarmDropItems);

View File

@ -1,3 +1,5 @@
//openDisarmDialog
#include "script_component.hpp"
PARAMS_2(_caller,_target);
@ -23,9 +25,12 @@ GVAR(disarmTarget) = _target;
PARAMS_5(_ctrl,_xPos,_yPos,_idc,_itemInfo);
EXPLODE_3_PVT((_itemInfo select 0),_displayText,_value,_data);
if (isNull GVAR(disarmTarget)) exitWith {ERROR("disarmTarget is null");};
systemChat format ["Debug: Droping %1 from %2", _data, GVAR(disarmTarget)];
[ACE_player, GVAR(disarmTarget), [_data]] call FUNC(disarmDropItems);
false
["DisarmDropItems", [GVAR(disarmTarget)], [ACE_player, GVAR(disarmTarget), [_data]]] call EFUNC(common,targetEvent);
false //not sure what this does
}];
//Setup PFEH

View File

@ -39,8 +39,8 @@ PARAMS_2(_listBoxCtrl,_itemsCountArray);
_picture = getText (configFile >> "CfgVehicles" >> _x >> "picture");
};
case (isClass (configFile >> "CfgGlasses" >> _x)): {
_displayName = getText (configFile >> "CfgGoggles" >> _x >> "displayName");
_picture = getText (configFile >> "CfgGoggles" >> _x >> "picture");
_displayName = getText (configFile >> "CfgGlasses" >> _x >> "displayName");
_picture = getText (configFile >> "CfgGlasses" >> _x >> "picture");
};
};