diff --git a/addons/interaction/CfgVehicles.hpp b/addons/interaction/CfgVehicles.hpp index b178ed3050..8671ecf9ce 100644 --- a/addons/interaction/CfgVehicles.hpp +++ b/addons/interaction/CfgVehicles.hpp @@ -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 { diff --git a/addons/interaction/XEH_PREP.hpp b/addons/interaction/XEH_PREP.hpp index 26d4cf4d00..2369570278 100644 --- a/addons/interaction/XEH_PREP.hpp +++ b/addons/interaction/XEH_PREP.hpp @@ -36,6 +36,8 @@ PREP(pullOutBody); PREP(canRenameGroup); PREP(renameGroupUI); PREP(renameGroup); +PREP(canGroupDropDistantUnits); +PREP(groupDropDistantUnits); // Weapon Attachments PREP(getWeaponAttachmentsActions); diff --git a/addons/interaction/functions/fnc_canGroupDropDistantUnits.sqf b/addons/interaction/functions/fnc_canGroupDropDistantUnits.sqf new file mode 100644 index 0000000000..b13abc1039 --- /dev/null +++ b/addons/interaction/functions/fnc_canGroupDropDistantUnits.sqf @@ -0,0 +1,20 @@ +#include "..\script_component.hpp" +/* + * Author: PabstMirror + * Checks if the unit can drop distant units from their group + * + * Arguments: + * 0: Unit + * + * Return Value: + * Unit can drop distant units + * + * Example: + * [player] call ace_interaction_fnc_canGroupDropDistantUnits + * + * Public: No + */ + +params ["_unit"]; + +(_unit == leader _unit) && {missionNamespace getVariable [QGVAR(groupDropUnitDistance), 100] > 0} diff --git a/addons/interaction/functions/fnc_groupDropDistantUnits.sqf b/addons/interaction/functions/fnc_groupDropDistantUnits.sqf new file mode 100644 index 0000000000..40875b8580 --- /dev/null +++ b/addons/interaction/functions/fnc_groupDropDistantUnits.sqf @@ -0,0 +1,25 @@ +#include "..\script_component.hpp" +/* + * Author: PabstMirror + * Drops distant units from their group + * + * Arguments: + * 0: Unit + * + * 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); diff --git a/addons/interaction/stringtable.xml b/addons/interaction/stringtable.xml index 3d1daf9c3c..7c80a9d932 100644 --- a/addons/interaction/stringtable.xml +++ b/addons/interaction/stringtable.xml @@ -582,6 +582,9 @@ 小隊管理 Takım Yönetimi + + Drop Distant Members + Red Rot