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

Interaction - Add action to drop distant units from group #10228

Merged
merged 5 commits into from
Aug 22, 2024
Merged
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
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