mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Verify Mag counts, headers, check animation
This commit is contained in:
parent
7058e48f15
commit
9f25641f54
@ -4,7 +4,7 @@ class CfgVehicles {
|
|||||||
class ACE_Actions {
|
class ACE_Actions {
|
||||||
class ACE_MainActions {
|
class ACE_MainActions {
|
||||||
class ACE_DisarmInventory {
|
class ACE_DisarmInventory {
|
||||||
displayName = "Open Inventory";
|
displayName = "$STR_ACE_Disarming_OpenInventory";
|
||||||
distance = 4;
|
distance = 4;
|
||||||
condition = QUOTE([_target] call FUNC(canDisarm));
|
condition = QUOTE([_target] call FUNC(canDisarm));
|
||||||
statement = QUOTE([ARR_2(_player,_target)] call FUNC(openDisarmDialog));
|
statement = QUOTE([ARR_2(_player,_target)] call FUNC(openDisarmDialog));
|
||||||
|
@ -11,5 +11,6 @@ PREP(getAllGearContainer);
|
|||||||
PREP(getAllGearUnit);
|
PREP(getAllGearUnit);
|
||||||
PREP(openDisarmDialog);
|
PREP(openDisarmDialog);
|
||||||
PREP(showItemsInListbox);
|
PREP(showItemsInListbox);
|
||||||
|
PREP(verifyMagazinesMoved);
|
||||||
|
|
||||||
ADDON = true;
|
ADDON = true;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* Checks the conditions for being able to disarm a unit
|
* Checks the conditions for being able to disarm a unit
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: target <OBJECT>
|
* 0: Target <OBJECT>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* The return value <BOOL>
|
* The return value <BOOL>
|
||||||
@ -15,11 +15,18 @@
|
|||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
PARAMS_2(_target);
|
PARAMS_1(_target);
|
||||||
|
|
||||||
|
//Check animationState for putDown anim:
|
||||||
|
_animationStateCfgMoves = getText (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState _target) >> "actions");
|
||||||
|
if (_animationStateCfgMoves == "") exitWith {false};
|
||||||
|
_putDownAnim = getText (configFile >> "CfgMovesBasic" >> "Actions" >> _animationStateCfgMoves >> "PutDown");
|
||||||
|
if (_putDownAnim != "") exitWith {false};
|
||||||
|
|
||||||
|
|
||||||
(alive _target) &&
|
(alive _target) &&
|
||||||
{(abs (speed _target)) < 0.1} &&
|
{(abs (speed _target)) < 1} &&
|
||||||
|
{(vehicle _target) == _target} &&
|
||||||
{(_target getVariable ["ACE_isUnconscious", false]) ||
|
{(_target getVariable ["ACE_isUnconscious", false]) ||
|
||||||
{_target getVariable [QEGVAR(captives,isHandcuffed), false]} ||
|
{_target getVariable [QEGVAR(captives,isHandcuffed), false]} ||
|
||||||
{_target getVariable [QEGVAR(captives,isSurrendering), false]}}
|
{_target getVariable [QEGVAR(captives,isSurrendering), false]}}
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Author: PabstMirror
|
* Author: PabstMirror
|
||||||
*
|
* Makes a unit drop items:
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: caller (player) <OBJECT>
|
* 0: caller (player) <OBJECT>
|
||||||
@ -19,8 +19,6 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
#define TIME_MAX_WAIT 5
|
#define TIME_MAX_WAIT 5
|
||||||
#define DUMMY_ITEM "ACE_DebugPotato"
|
|
||||||
#define UNIQUE_MAGAZINES ["ACE_key_customKeyMagazine"]
|
|
||||||
|
|
||||||
PARAMS_3(_caller,_target,_listOfItemsToRemove);
|
PARAMS_3(_caller,_target,_listOfItemsToRemove);
|
||||||
DEFAULT_PARAM(3,_doNotDropAmmo,false); //By default units drop all weapon mags when dropping a weapon
|
DEFAULT_PARAM(3,_doNotDropAmmo,false); //By default units drop all weapon mags when dropping a weapon
|
||||||
@ -91,13 +89,13 @@ if ( ({(_x select 0) in _listOfItemsToRemove} count _targetMagazinesEnd) != 0) e
|
|||||||
_holder setVariable [QGVAR(holderInUse), false];
|
_holder setVariable [QGVAR(holderInUse), false];
|
||||||
[_caller, _target, "Debug: Didn't Remove Magazines"] call FUNC(eventTargetFinish);
|
[_caller, _target, "Debug: Didn't Remove Magazines"] call FUNC(eventTargetFinish);
|
||||||
};
|
};
|
||||||
//Verify holder has mags unit had (lazy count for now)
|
//Verify holder has mags unit had
|
||||||
if (((count _targetMagazinesStart) - (count _targetMagazinesEnd)) != ((count _holderMagazinesEnd) - (count _holderMagazinesStart))) exitWith {
|
if (!([_targetMagazinesStart, _targetMagazinesEnd, _holderMagazinesStart, _holderMagazinesEnd] call FUNC(verifyMagazinesMoved))) then {
|
||||||
|
ERR = [_targetMagazinesStart, _targetMagazinesEnd, _holderMagazinesStart, _holderMagazinesEnd];
|
||||||
_holder setVariable [QGVAR(holderInUse), false];
|
_holder setVariable [QGVAR(holderInUse), false];
|
||||||
[_caller, _target, "Debug: Crate Magazines not in holder"] call FUNC(eventTargetFinish);
|
[_caller, _target, "Debug: Crate Magazines not in holder"] call FUNC(eventTargetFinish);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//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);
|
||||||
@ -134,9 +132,8 @@ _targetItemsEnd = (assignedItems _target) + (items _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);};
|
||||||
|
|
||||||
//Verify Items Added (lazy count)
|
//Verify Items Added
|
||||||
if (((count _targetItemsStart) - (count _targetItemsEnd)) != ([_addToCrateCount] call _fncSumArray)) exitWith {
|
if (((count _targetItemsStart) - (count _targetItemsEnd)) != ([_addToCrateCount] call _fncSumArray)) exitWith {
|
||||||
ERR = [_targetItemsStart, _targetItemsEnd, _addToCrateClassnames, _addToCrateCount];
|
|
||||||
_holder setVariable [QGVAR(holderInUse), false];
|
_holder setVariable [QGVAR(holderInUse), false];
|
||||||
[_caller, _target, "Debug: Items Not Removed From Player"] call FUNC(eventTargetFinish);
|
[_caller, _target, "Debug: Items Not Removed From Player"] call FUNC(eventTargetFinish);
|
||||||
};
|
};
|
||||||
@ -167,9 +164,7 @@ systemChat format ["PFEh start %1", time];
|
|||||||
_needToRemoveVest = ((vest _target) != "") && {(vest _target) in _listOfItemsToRemove};
|
_needToRemoveVest = ((vest _target) != "") && {(vest _target) in _listOfItemsToRemove};
|
||||||
_needToRemoveUniform = ((uniform _target) != "") && {(uniform _target) in _listOfItemsToRemove};
|
_needToRemoveUniform = ((uniform _target) != "") && {(uniform _target) in _listOfItemsToRemove};
|
||||||
|
|
||||||
// systemChat format ["%1 - (%2 %3 %4 %5)", time, _maxWaitTime, _needToRemoveWeapon, _needToRemoveMagazines, _needToRemoveBackpack];
|
if ((time < _maxWaitTime) && {[_target] call FUNC(canDisarm)} && {_needToRemoveWeapon || _needToRemoveMagazines || _needToRemoveBackpack}) then {
|
||||||
|
|
||||||
if ((time < _maxWaitTime) && {_needToRemoveWeapon || _needToRemoveMagazines || _needToRemoveBackpack}) then {
|
|
||||||
//action drop weapons (keeps loaded magazine and attachements)
|
//action drop weapons (keeps loaded magazine and attachements)
|
||||||
{
|
{
|
||||||
if (_x in _listOfItemsToRemove) then {
|
if (_x in _listOfItemsToRemove) then {
|
||||||
@ -220,7 +215,6 @@ systemChat format ["PFEh start %1", time];
|
|||||||
|
|
||||||
//If we added a dummy item, remove it now
|
//If we added a dummy item, remove it now
|
||||||
if (_holderIsEmpty && {!((getItemCargo _holder) isEqualTo [[DUMMY_ITEM],[1]])}) exitWith {
|
if (_holderIsEmpty && {!((getItemCargo _holder) isEqualTo [[DUMMY_ITEM],[1]])}) exitWith {
|
||||||
|
|
||||||
_holder setVariable [QGVAR(holderInUse), false];
|
_holder setVariable [QGVAR(holderInUse), false];
|
||||||
[_caller, _target, "Debug: Holder should only have dummy item"] call FUNC(eventTargetFinish);
|
[_caller, _target, "Debug: Holder should only have dummy item"] call FUNC(eventTargetFinish);
|
||||||
};
|
};
|
||||||
@ -234,6 +228,11 @@ systemChat format ["PFEh start %1", time];
|
|||||||
_holder setVariable [QGVAR(holderInUse), false];
|
_holder setVariable [QGVAR(holderInUse), false];
|
||||||
[_caller, _target, "Debug: Drop Actions Timeout"] call FUNC(eventTargetFinish);
|
[_caller, _target, "Debug: Drop Actions Timeout"] call FUNC(eventTargetFinish);
|
||||||
};
|
};
|
||||||
|
//If target lost disarm status:
|
||||||
|
if (!([_target] call FUNC(canDisarm))) exitWith {
|
||||||
|
_holder setVariable [QGVAR(holderInUse), false];
|
||||||
|
[_caller, _target, "Debug: Target cannot be disarmed"] call FUNC(eventTargetFinish);
|
||||||
|
};
|
||||||
|
|
||||||
if (_needToRemoveVest && {!((vestItems _target) isEqualTo [])}) exitWith {
|
if (_needToRemoveVest && {!((vestItems _target) isEqualTo [])}) exitWith {
|
||||||
_holder setVariable [QGVAR(holderInUse), false];
|
_holder setVariable [QGVAR(holderInUse), false];
|
||||||
|
@ -1,13 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Author: PabstMirror
|
||||||
|
* Helper function to get all gear of a container
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Container <OBJECT>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* Array of 2 arrays, classnames and count<ARRAY>
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [["ace_bandage"],[2]] = [box] call ace_disarming_fnc_getAllGearContainer
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
PARAMS_1(_target);
|
PARAMS_1(_target);
|
||||||
|
|
||||||
|
private ["_allGear"];
|
||||||
|
|
||||||
_allGear = [[],[]];
|
_allGear = [[],[]];
|
||||||
|
|
||||||
{
|
{
|
||||||
//todo: Use 1.40 Append
|
(_allGear select 0) append (_x select 0);
|
||||||
_allGear set [0, (_allGear select 0) + (_x select 0)];
|
(_allGear select 1) append (_x select 1);
|
||||||
_allGear set [1, (_allGear select 1) + (_x select 1)];
|
|
||||||
} forEach [(getWeaponCargo _target), (getItemCargo _target), (getMagazineCargo _target), (getBackpackCargo _target)];
|
} forEach [(getWeaponCargo _target), (getItemCargo _target), (getMagazineCargo _target), (getBackpackCargo _target)];
|
||||||
|
|
||||||
_allGear
|
_allGear
|
||||||
|
@ -1,3 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* Author: PabstMirror
|
||||||
|
* Helper function to get all gear of a unit.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Target <OBJECT>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* Array of 2 arrays, classnames and count<ARRAY>
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [["ace_bandage"],[2]] = [bob] call ace_disarming_fnc_getAllGearUnit
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
PARAMS_1(_target);
|
PARAMS_1(_target);
|
||||||
|
@ -1,5 +1,19 @@
|
|||||||
//openDisarmDialog
|
/*
|
||||||
|
* Author: PabstMirror
|
||||||
|
* Opens the disarm dialog (allowing a person to remove items)
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Caller (player) <OBJECT>
|
||||||
|
* 1: Target <OBJECT>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [player, bob] call ace_disarming_fnc_openDisarmDialog
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
PARAMS_2(_caller,_target);
|
PARAMS_2(_caller,_target);
|
||||||
@ -9,7 +23,7 @@ if (_caller != ACE_player) exitwith {ERROR("Player isn't caller?");};
|
|||||||
if (!([_target] call FUNC(canDisarm))) exitWith {ERROR("Unit Cannot Be Disarmed");};
|
if (!([_target] call FUNC(canDisarm))) exitWith {ERROR("Unit Cannot Be Disarmed");};
|
||||||
if (!([] call EGVAR(common,canInteract))) exitWith {ERROR("Player cannot Interact");};
|
if (!([] call EGVAR(common,canInteract))) exitWith {ERROR("Player cannot Interact");};
|
||||||
|
|
||||||
closeDialog 0;
|
if (dialog) then {closeDialog 0;};
|
||||||
createDialog QGVAR(remoteInventory);
|
createDialog QGVAR(remoteInventory);
|
||||||
|
|
||||||
disableSerialization;
|
disableSerialization;
|
||||||
@ -39,12 +53,11 @@ GVAR(disarmTarget) = _target;
|
|||||||
EXPLODE_2_PVT(_this,_args,_pfID);
|
EXPLODE_2_PVT(_this,_args,_pfID);
|
||||||
EXPLODE_3_PVT(_args,_player,_target,_display);
|
EXPLODE_3_PVT(_args,_player,_target,_display);
|
||||||
|
|
||||||
|
|
||||||
if ((!([_target] call FUNC(canDisarm))) ||
|
if ((!([_target] call FUNC(canDisarm))) ||
|
||||||
{isNull _display} ||
|
{isNull _display} ||
|
||||||
{_player != ACE_player} ||
|
{_player != ACE_player} ||
|
||||||
{!([] call EGVAR(common,canInteract))}) then {
|
{!([_player, _target, []] call EFUNC(common,canInteractWith))}) then {
|
||||||
|
systemChat "Debug: closeing dialog";
|
||||||
[_pfID] call CBA_fnc_removePerFrameHandler;
|
[_pfID] call CBA_fnc_removePerFrameHandler;
|
||||||
GVAR(disarmTarget) = objNull;
|
GVAR(disarmTarget) = objNull;
|
||||||
if (!isNull _display) then {closeDialog 0;}; //close dialog if still open
|
if (!isNull _display) then {closeDialog 0;}; //close dialog if still open
|
||||||
@ -60,10 +73,10 @@ GVAR(disarmTarget) = _target;
|
|||||||
lbClear _groundContainer;
|
lbClear _groundContainer;
|
||||||
lbClear _targetContainer;
|
lbClear _targetContainer;
|
||||||
|
|
||||||
|
//Show the items in the ground disarmTarget's inventory
|
||||||
_targetUniqueItems = [GVAR(disarmTarget)] call FUNC(getAllGearUnit);
|
_targetUniqueItems = [GVAR(disarmTarget)] call FUNC(getAllGearUnit);
|
||||||
[_targetContainer, _targetUniqueItems] call FUNC(showItemsInListbox);
|
[_targetContainer, _targetUniqueItems] call FUNC(showItemsInListbox);
|
||||||
|
|
||||||
|
|
||||||
_holder = objNull;
|
_holder = objNull;
|
||||||
{
|
{
|
||||||
if ((_x getVariable [QGVAR(disarmUnit), objNull]) == _target) exitWith {
|
if ((_x getVariable [QGVAR(disarmUnit), objNull]) == _target) exitWith {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Author: PabstMirror
|
* Author: PabstMirror
|
||||||
* Checks the conditions for being able to disarm
|
* Shows a list of inventory items in a listBox control.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: RscListBox <CONTROL>
|
* 0: RscListBox <CONTROL>
|
||||||
@ -19,7 +19,6 @@
|
|||||||
disableSerialization;
|
disableSerialization;
|
||||||
PARAMS_2(_listBoxCtrl,_itemsCountArray);
|
PARAMS_2(_listBoxCtrl,_itemsCountArray);
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
_displayName = "";
|
_displayName = "";
|
||||||
_picture = "";
|
_picture = "";
|
||||||
|
44
addons/disarming/functions/fnc_verifyMagazinesMoved.sqf
Normal file
44
addons/disarming/functions/fnc_verifyMagazinesMoved.sqf
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* Author: PabstMirror
|
||||||
|
* Verifies magazines moved with exact ammo counts preserved.
|
||||||
|
* Arrays will be in format from magazinesAmmo/magazinesAmmoCargo
|
||||||
|
* e.g.: [["30Rnd_65x39_caseless_mag",15], ["30Rnd_65x39_caseless_mag",30]]
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Start on container A <ARRAY>
|
||||||
|
* 1: End on container A <ARRAY>
|
||||||
|
* 2: Start on container B <ARRAY>
|
||||||
|
* 3: End on container B <ARRAY>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* Verified Good <BOOL>
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [] call ace_disarming_fnc_verifyMagazinesMoved
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
private ["_problem", "_beginingArray"];
|
||||||
|
|
||||||
|
PARAMS_4(_startA,_endA,_startB,_endB);
|
||||||
|
|
||||||
|
//Quick Lazy Count Check
|
||||||
|
if (((count _startA) + (count _startB)) != ((count _endA) + (count _endB))) exitWith {
|
||||||
|
systemChat format ["%1 - %2", ((count _startA) + (count _startB)), ((count _endA) + (count _endB))];
|
||||||
|
false
|
||||||
|
};
|
||||||
|
|
||||||
|
_beginingArray = (_startA + _startB);
|
||||||
|
|
||||||
|
_problem = false;
|
||||||
|
{
|
||||||
|
_index = _beginingArray find _x;
|
||||||
|
if (_index == -1) exitWith {_problem = true;};
|
||||||
|
_beginingArray deleteAt _index;
|
||||||
|
} forEach (_endA + _endB);
|
||||||
|
|
||||||
|
systemChat format ["%1 - %2", _problem, _beginingArray];
|
||||||
|
|
||||||
|
(!_problem) && {_beginingArray isEqualTo []}
|
@ -11,4 +11,5 @@
|
|||||||
|
|
||||||
#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"]
|
#define DUMMY_ITEM "ACE_DebugPotato"
|
||||||
|
#define UNIQUE_MAGAZINES ["ACE_key_customKeyMagazine"]
|
@ -1,5 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!-- Edited with tabler - 2015-02-10 -->
|
<!-- Edited with tabler - 2015-03-17 -->
|
||||||
<Project name="ACE">
|
<Project name="ACE">
|
||||||
<Package name="Disarming" />
|
<Package name="Disarming">
|
||||||
|
<Key ID="STR_ACE_Disarming_OpenInventory">
|
||||||
|
<English>Open Inventory</English>
|
||||||
|
</Key>
|
||||||
|
</Package>
|
||||||
</Project>
|
</Project>
|
Loading…
Reference in New Issue
Block a user