Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experiment on disarming #1621

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions AGM_Interaction/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class CfgFunctions {
class canInteractWith;
class canLockDoor;
class canTapShoulder;
class disarm;
class getActions2;
class GetActions;
class getDoor;
Expand Down Expand Up @@ -303,6 +304,15 @@ class CfgVehicles {
showDisabled = 0;
priority = 2.5;
};

class AGM_Disarm {
displayName = "$STR_AGM_Interaction_Disarm";
distance = 4;
condition = "_target getVariable ['AGM_isUnconscious' false] || _target getVariable ['AGM_isCaptive' false]";
statement = "[[_target, _player], AGM_Interacion_fnc_disarm, _target] call AGM_Core_fnc_execRemoteFnc";
showDisabled = 0;
priority = 1.5;
};
};

class AGM_SelfActions {
Expand Down
123 changes: 123 additions & 0 deletions AGM_Interaction/functions/fn_disarm.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
/*
Author: CAA-Picard

Description:
Disarm the player

Arguments:
0: The local unit being disarmed
1: The unit doing the disarming

Return value:
None
*/

private ["_unit", "_guard", "_allGear", "_wh"];

_unit = _this select 0;
_guard = _this select 1;

_allGear = [
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reminder: Move AGM_Respawn_fnc_getAllGear to Core.

(headgear _unit),
(goggles _unit),
(uniform _unit),
(uniformItems _unit),
(vest _unit),
(vestItems _unit),
(backpack _unit),
(backpackItems _unit),
(primaryWeapon _unit),
(primaryWeaponItems _unit),
(primaryWeaponMagazine _unit),
(secondaryWeapon _unit),
(secondaryWeaponItems _unit),
(secondaryWeaponMagazine _unit),
(handgunWeapon _unit),
(handgunItems _unit),
(handgunMagazine _unit),
(assignedItems _unit),
(binocular _unit)
];

// Make the unit drop it's backpack
_unit addBackpack "Bag_Base";
removeBackpack _unit;

// Remove the uniform items
removeUniform _unit;
_unit forceAddUniform (_allGear select 2);

// Remove the vest and all it's content
removeVest _unit;

// Remove the rest of the stuff
removeAllWeapons _unit;
removeAllAssignedItems _unit;


_wh = createVehicle ["WeaponHolderSimulated", [0,0,0], [], 0, "CAN_COLLIDE"];

// Store vest and vest items
if (_allGear select 4 != "") then {
_wh addItemCargoGlobal [_allGear select 4,1];
{
_wh addItemCargoGlobal [_x,1];
}forEach (_allGear select 5);
};

// Store main weapon and accesories
if (_allGear select 8 != "") then {
_wh addItemCargoGlobal [_allGear select 8,1];
{
if (_x != "") then {
_wh addItemCargoGlobal [_x,1];
};
}forEach (_allGear select 9);
{
if (_x != "") then {
_wh addItemCargoGlobal [_x,1];
};
}forEach (_allGear select 10);
};

// Store secondary weapon and accesories
if (_allGear select 11 != "") then {
_wh addItemCargoGlobal [_allGear select 11,1];
{
if (_x != "") then {
_wh addItemCargoGlobal [_x,1];
};
}forEach (_allGear select 12);
{
if (_x != "") then {
_wh addItemCargoGlobal [_x,1];
};
}forEach (_allGear select 13);
};

// Store pistol and accesories
if (_allGear select 14 != "") then {
_wh addItemCargoGlobal [_allGear select 14,1];
{
if (_x != "") then {
_wh addItemCargoGlobal [_x,1];
};
}forEach (_allGear select 15);
{
if (_x != "") then {
_wh addItemCargoGlobal [_x,1];
};
}forEach (_allGear select 16);
};

// Store uniform items
{
_wh addItemCargoGlobal [_x,1];
}forEach (_allGear select 3);

// Store assigned items
{
_wh addItemCargoGlobal [_x,1];
}forEach (_allGear select 17);

_wh setPos getPos _unit;
3 changes: 3 additions & 0 deletions AGM_Interaction/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,9 @@
<Portuguese>Abaixe-se!</Portuguese>
<Italian>A Terra!</Italian>
</Key>
<Key ID="STR_AGM_Interaction_Disarm">
<English>Disarm</English>
</Key>
<Key ID="STR_AGM_Interaction_TeamManagement">
<English>Team Management &gt;&gt;</English>
<German>Team Management &gt;&gt;</German>
Expand Down