Skip to content

Commit

Permalink
Interaction - Add action to drop distant units from group (#10228)
Browse files Browse the repository at this point in the history
Co-authored-by: Dystopian <[email protected]>
Co-authored-by: Grim <[email protected]>
  • Loading branch information
3 people authored Aug 22, 2024
1 parent e798050 commit b4700ae
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 0 deletions.
6 changes: 6 additions & 0 deletions addons/interaction/CfgVehicles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,12 @@ class CfgVehicles {
statement = QUOTE(_player call FUNC(renameGroupUI));
showDisabled =1;
};
class ACE_groupDropDistantUnits {
displayName = CSTRING(groupDropDistantUnits);
condition = QUOTE(call FUNC(canGroupDropDistantUnits));
exceptions[] = {"isNotSwimming", "isNotInside", "isNotSitting", "isNotOnLadder", "isNotRefueling"};
statement = QUOTE(call FUNC(groupDropDistantUnits));
};
};

class ACE_Equipment {
Expand Down
2 changes: 2 additions & 0 deletions addons/interaction/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ PREP(pullOutBody);
PREP(canRenameGroup);
PREP(renameGroupUI);
PREP(renameGroup);
PREP(canGroupDropDistantUnits);
PREP(groupDropDistantUnits);

// Weapon Attachments
PREP(getWeaponAttachmentsActions);
Expand Down
20 changes: 20 additions & 0 deletions addons/interaction/functions/fnc_canGroupDropDistantUnits.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include "..\script_component.hpp"
/*
* Author: PabstMirror
* Checks if the unit can drop distant units from their group
*
* Arguments:
* 0: Unit <OBJECT>
*
* Return Value:
* Unit can drop distant units <BOOL>
*
* Example:
* [player] call ace_interaction_fnc_canGroupDropDistantUnits
*
* Public: No
*/

params ["_unit"];

(_unit == leader _unit) && {missionNamespace getVariable [QGVAR(groupDropUnitDistance), 100] > 0}
25 changes: 25 additions & 0 deletions addons/interaction/functions/fnc_groupDropDistantUnits.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include "..\script_component.hpp"
/*
* Author: PabstMirror
* Drops distant units from their group
*
* Arguments:
* 0: Unit <OBJECT>
*
* Return Value:
* None
*
* Example:
* [player] call ace_interaction_fnc_groupDropDistantUnits
*
* Public: No
*/

params ["_unit"];

{
if ((_x distance _unit) > (missionNamespace getVariable [QGVAR(groupDropUnitDistance), 100])) then {
TRACE_1("drop",_x);
[_x] joinSilent grpNull;
};
} forEach (units group _unit);
3 changes: 3 additions & 0 deletions addons/interaction/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,9 @@
<Chinese>小隊管理</Chinese>
<Turkish>Takım Yönetimi</Turkish>
</Key>
<Key ID="STR_ACE_Interaction_groupDropDistantUnits">
<English>Drop Distant Members</English>
</Key>
<Key ID="STR_ACE_Interaction_TeamRED">
<English>Red</English>
<German>Rot</German>
Expand Down

0 comments on commit b4700ae

Please sign in to comment.