Skip to content

Commit

Permalink
Merge pull request #136 from acemod/disarmingTest
Browse files Browse the repository at this point in the history
Unit Disarming/DropGear Merge
  • Loading branch information
PabstMirror committed Apr 11, 2015
2 parents 0bf32bf + 787df67 commit f5cce94
Show file tree
Hide file tree
Showing 24 changed files with 968 additions and 0 deletions.
1 change: 1 addition & 0 deletions addons/disarming/$PBOPREFIX$
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
z\ace\addons\disarming
11 changes: 11 additions & 0 deletions addons/disarming/CfgEventHandlers.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preInit));
};
};

class Extended_PostInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_postInit));
};
};
17 changes: 17 additions & 0 deletions addons/disarming/CfgVehicles.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
class CfgVehicles {
class Man;
class CAManBase: Man {
class ACE_Actions {
class ACE_MainActions {
class ACE_DisarmInventory {
displayName = "$STR_ACE_Disarming_OpenInventory";
distance = 3.5;
condition = QUOTE([ARR_2(_player,_target)] call FUNC(canPlayerDisarmUnit));
statement = QUOTE([ARR_2(_player,_target)] call FUNC(openDisarmDialog));
icon = "\a3\Modules_F_Curator\Data\portraitRespawnInventory_ca.paa";
exceptions[] = {};
};
};
};
};
};
14 changes: 14 additions & 0 deletions addons/disarming/CfgWeapons.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class CfgWeapons {
class ACE_ItemCore;
class InventoryItem_Base_F;

class ACE_DebugPotato: ACE_ItemCore {
displayName = "ACE Potato (debug)";
descriptionShort = "Glorious Potato<br/>If you see this in game it means someone fucked up";
picture = QUOTE(PATHTOF(UI\potato_ca.paa));
scope = 1;
class ItemInfo: InventoryItem_Base_F {
mass = 1;
};
};
};
11 changes: 11 additions & 0 deletions addons/disarming/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
ace_disarming
============

Adds ability to make units drop items/weapons/magazines.


## Maintainers

The people responsible for merging changes to this component or answering potential questions.

- [PabstMirror](https://github.com/PabstMirror)
Binary file added addons/disarming/UI/potato_ca.paa
Binary file not shown.
4 changes: 4 additions & 0 deletions addons/disarming/XEH_postInit.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#include "script_component.hpp"

["DisarmDropItems", {_this call FUNC(eventTargetStart)}] call EFUNC(common,addEventHandler);
["DisarmDebugCallback", {_this call FUNC(eventCallerFinish)}] call EFUNC(common,addEventHandler);
17 changes: 17 additions & 0 deletions addons/disarming/XEH_preInit.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include "script_component.hpp"

ADDON = false;

PREP(canBeDisarmed);
PREP(canPlayerDisarmUnit);
PREP(disarmDropItems);
PREP(eventCallerFinish);
PREP(eventTargetFinish);
PREP(eventTargetStart);
PREP(getAllGearContainer);
PREP(getAllGearUnit);
PREP(openDisarmDialog);
PREP(showItemsInListbox);
PREP(verifyMagazinesMoved);

ADDON = true;
19 changes: 19 additions & 0 deletions addons/disarming/config.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include "script_component.hpp"

class CfgPatches {
class ADDON {
units[] = {};
weapons[] = {"ACE_DebugPotato"};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ACE_Interaction"};
author[] = {"PabstMirror"};
authorUrl = "https://github.com/PabstMirror/";
VERSION_CONFIG;
};
};

#include "CfgEventHandlers.hpp"
#include "CfgVehicles.hpp"
#include "CfgWeapons.hpp"

#include "gui_disarm.hpp"
34 changes: 34 additions & 0 deletions addons/disarming/functions/fnc_canBeDisarmed.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Author: PabstMirror
* Checks the conditions for being able to disarm a unit
*
* Arguments:
* 0: Target <OBJECT>
*
* Return Value:
* Can Be Disarmed <BOOL>
*
* Example:
* [cursorTarget] call ace_disarming_fnc_canBeDisarmed
*
* Public: No
*/
#include "script_component.hpp"

PARAMS_1(_target);

//Check animationState for putDown anim
//This ensures the unit doesn't have to actualy do any animation to drop something
//This should always be true for the 3 possible status effects that allow disarming
_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) &&
{(abs (speed _target)) < 1} &&
{(vehicle _target) == _target} &&
{(_target getVariable ["ACE_isUnconscious", false]) ||
{_target getVariable [QEGVAR(captives,isHandcuffed), false]} ||
{_target getVariable [QEGVAR(captives,isSurrendering), false]}}
22 changes: 22 additions & 0 deletions addons/disarming/functions/fnc_canPlayerDisarmUnit.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Author: PabstMirror
* Checks the conditions for being able to disarm a unit
*
* Arguments:
* 0: Player <OBJECT>
* 1: Target <OBJECT>
*
* Return Value:
* Can Be Disarm Target <BOOL>
*
* Example:
* [player, cursorTarget] call ace_disarming_fnc_canPlayerDisarmUnit
*
* Public: No
*/
#include "script_component.hpp"

PARAMS_2(_player,_target);

([_target] call FUNC(canBeDisarmed)) &&
{([_player, _target, []] call EFUNC(common,canInteractWith))}
Loading

0 comments on commit f5cce94

Please sign in to comment.