diff --git a/addons/interaction/CfgVehicles.hpp b/addons/interaction/CfgVehicles.hpp index 128e79c9f5c..643b5448955 100644 --- a/addons/interaction/CfgVehicles.hpp +++ b/addons/interaction/CfgVehicles.hpp @@ -78,7 +78,7 @@ class CfgVehicles { class ACE_AssignTeamRed { displayName = CSTRING(AssignTeamRed); - condition = QUOTE([ARR_2(_player,_target)] call DFUNC(canJoinTeam)); + condition = QUOTE([ARR_2(_player,_target)] call DFUNC(canJoinTeam) && {assignedTeam _target != 'RED'}); statement = QUOTE([ARR_3(_target,'RED',true)] call DFUNC(joinTeam)); exceptions[] = {"isNotSwimming"}; showDisabled = 1; @@ -86,7 +86,7 @@ class CfgVehicles { }; class ACE_AssignTeamGreen { displayName = CSTRING(AssignTeamGreen); - condition = QUOTE([ARR_2(_player,_target)] call DFUNC(canJoinTeam)); + condition = QUOTE([ARR_2(_player,_target)] call DFUNC(canJoinTeam) && {assignedTeam _target != 'GREEN'}); statement = QUOTE([ARR_3(_target,'GREEN',true)] call DFUNC(joinTeam)); exceptions[] = {"isNotSwimming"}; showDisabled = 1; @@ -94,7 +94,7 @@ class CfgVehicles { }; class ACE_AssignTeamBlue { displayName = CSTRING(AssignTeamBlue); - condition = QUOTE([ARR_2(_player,_target)] call DFUNC(canJoinTeam)); + condition = QUOTE([ARR_2(_player,_target)] call DFUNC(canJoinTeam) && {assignedTeam _target != 'BLUE'}); statement = QUOTE([ARR_3(_target,'BLUE',true)] call DFUNC(joinTeam)); exceptions[] = {"isNotSwimming"}; showDisabled = 1; @@ -102,14 +102,14 @@ class CfgVehicles { }; class ACE_AssignTeamYellow { displayName = CSTRING(AssignTeamYellow); - condition = QUOTE([ARR_2(_player,_target)] call DFUNC(canJoinTeam)); + condition = QUOTE([ARR_2(_player,_target)] call DFUNC(canJoinTeam) && {assignedTeam _target != 'YELLOW'}); statement = QUOTE([ARR_3(_target,'YELLOW',true)] call DFUNC(joinTeam)); exceptions[] = {"isNotSwimming"}; showDisabled = 1; modifierFunction = QUOTE([ARR_3('YELLOW','PATHTOF(UI\team\team_white_ca.paa)',_this select 3)] call FUNC(modifyTeamManagementAction)); }; - class ACE_UnassignTeam { - displayName = CSTRING(LeaveTeam); + class ACE_AssignTeamMain { + displayName = "$str_assign_main"; condition = QUOTE([ARR_2(_player,_target)] call DFUNC(canJoinTeam) && {assignedTeam _target != 'MAIN'}); statement = QUOTE([ARR_3(_target,'MAIN',true)] call DFUNC(joinTeam)); exceptions[] = {"isNotSwimming"}; @@ -253,9 +253,16 @@ class CfgVehicles { modifierFunction = QUOTE([ARR_3(assignedTeam _target,'PATHTOF(UI\team\team_management_ca.paa)',_this select 3)] call FUNC(modifyTeamManagementAction)); showDisabled = 1; + class ACE_remoteTeamManagement { + displayName = CSTRING(Squad); + icon = QPATHTOF(UI\team\team_management_ca.paa); + condition = QUOTE(GVAR(remoteTeamManagement)); + exceptions[] = {"isNotSwimming", "isNotInside", "isNotSitting", "isNotOnLadder", "isNotRefueling"}; + insertChildren = QUOTE(call FUNC(addSquadChildren)); + }; class ACE_JoinTeamRed { displayName = CSTRING(JoinTeamRed); - condition = QUOTE(true); + condition = QUOTE(assignedTeam _player != 'RED'); exceptions[] = {"isNotSwimming", "isNotInside", "isNotSitting", "isNotOnLadder", "isNotRefueling"}; statement = QUOTE([ARR_3(_player,'RED',true)] call DFUNC(joinTeam)); showDisabled = 1; @@ -263,7 +270,7 @@ class CfgVehicles { }; class ACE_JoinTeamGreen { displayName = CSTRING(JoinTeamGreen); - condition = QUOTE(true); + condition = QUOTE(assignedTeam _player != 'GREEN'); exceptions[] = {"isNotSwimming", "isNotInside", "isNotSitting", "isNotOnLadder", "isNotRefueling"}; statement = QUOTE([ARR_3(_player,'GREEN',true)] call DFUNC(joinTeam)); showDisabled = 1; @@ -271,7 +278,7 @@ class CfgVehicles { }; class ACE_JoinTeamBlue { displayName = CSTRING(JoinTeamBlue); - condition = QUOTE(true); + condition = QUOTE(assignedTeam _player != 'BLUE'); exceptions[] = {"isNotSwimming", "isNotInside", "isNotSitting", "isNotOnLadder", "isNotRefueling"}; statement = QUOTE([ARR_3(_player,'BLUE',true)] call DFUNC(joinTeam)); showDisabled = 1; @@ -279,14 +286,14 @@ class CfgVehicles { }; class ACE_JoinTeamYellow { displayName = CSTRING(JoinTeamYellow); - condition = QUOTE(true); + condition = QUOTE(assignedTeam _player != 'YELLOW'); exceptions[] = {"isNotSwimming", "isNotInside", "isNotSitting", "isNotOnLadder", "isNotRefueling"}; statement = QUOTE([ARR_3(_player,'YELLOW',true)] call DFUNC(joinTeam)); showDisabled = 1; modifierFunction = QUOTE([ARR_3('YELLOW','PATHTOF(UI\team\team_white_ca.paa)',_this select 3)] call FUNC(modifyTeamManagementAction)); }; - class ACE_LeaveTeam { - displayName = CSTRING(LeaveTeam); + class ACE_JoinTeamMain { + displayName = CSTRING(JoinTeamMain); condition = QUOTE(assignedTeam _player != 'MAIN'); exceptions[] = {"isNotSwimming", "isNotInside", "isNotSitting", "isNotOnLadder", "isNotRefueling"}; statement = QUOTE([ARR_3(_player,'MAIN',true)] call DFUNC(joinTeam)); @@ -316,12 +323,6 @@ 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 23695702783..63053fd5122 100644 --- a/addons/interaction/XEH_PREP.hpp +++ b/addons/interaction/XEH_PREP.hpp @@ -13,6 +13,7 @@ PREP(showMouseHint); PREP(hideMouseHint); // interaction with units +PREP(addSquadChildren); PREP(canInteractWithCivilian); PREP(canInteractWithVehicleCrew); PREP(getDown); @@ -36,8 +37,6 @@ PREP(pullOutBody); PREP(canRenameGroup); PREP(renameGroupUI); PREP(renameGroup); -PREP(canGroupDropDistantUnits); -PREP(groupDropDistantUnits); // Weapon Attachments PREP(getWeaponAttachmentsActions); diff --git a/addons/interaction/functions/fnc_addSquadChildren.sqf b/addons/interaction/functions/fnc_addSquadChildren.sqf new file mode 100644 index 00000000000..39cbb22f2ab --- /dev/null +++ b/addons/interaction/functions/fnc_addSquadChildren.sqf @@ -0,0 +1,51 @@ +#include "..\script_component.hpp" +/* + * Author: PabstMirror + * Gets the squad child actions + * + * Arguments: + * 1: Player + * + * Return Value: + * Children actions + * + * Example: + * [player, player] call ace_interaction_fnc_addSquadChildren + * + * Public: No + */ + +params ["", "_player"]; + +private _fnc_color = { + (switch (toUpper _this) do { + case "RED": {missionNamespace getVariable [QEGVAR(nametags,nametagColorRed), [221, 0, 0]]}; + case "GREEN": {missionNamespace getVariable [QEGVAR(nametags,nametagColorGreen), [0, 221, 0]]}; + case "BLUE": {missionNamespace getVariable [QEGVAR(nametags,nametagColorBlue), [0, 0, 221]]}; + case "YELLOW": {missionNamespace getVariable [QEGVAR(nametags,nametagColorYellow), [221, 221, 0]]}; + default {missionNamespace getVariable [QEGVAR(nametags,nametagColorMain), [255, 255, 255]]}; + }) call BIS_fnc_colorRGBtoHTML +}; + +private _units = (units group _player) - [_player]; + +private _subActions = []; +_subActions pushBack (["drop", localize "str_a3_endgame_notifications_title_drop", "\a3\ui_f\data\igui\cfg\actions\ico_off_ca.paa", + {[_target] joinSilent grpNull}, {true}] call EFUNC(interact_menu,createAction)); + +{ + private _icon = [QPATHTOF(UI\team\team_white_ca.paa), _x call _fnc_color]; + private _name = localize format ["str_assign_%1", _x]; + _subActions pushBack ([_x, _name, _icon, + {[_target, _this#2] call FUNC(joinTeam)}, {assignedTeam _target != _this#2}, {}, _x] call EFUNC(interact_menu,createAction)); +} forEach ["RED", "GREEN", "BLUE", "YELLOW", "MAIN"]; + +private _actions = _units apply { + private _unit = _x; + private _icon = [QPATHTOF(UI\team\team_white_ca.paa), (assignedTeam _unit) call _fnc_color]; + private _actionUnit = [hashValue _x, [_x, true] call EFUNC(common,getName), _icon, {}, {true}] call EFUNC(interact_menu,createAction); + + [_actionUnit, _subActions apply { [_x, [], _unit] }, _unit] +}; + +_actions diff --git a/addons/interaction/functions/fnc_canGroupDropDistantUnits.sqf b/addons/interaction/functions/fnc_canGroupDropDistantUnits.sqf deleted file mode 100644 index b13abc10392..00000000000 --- a/addons/interaction/functions/fnc_canGroupDropDistantUnits.sqf +++ /dev/null @@ -1,20 +0,0 @@ -#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 deleted file mode 100644 index 40875b8580f..00000000000 --- a/addons/interaction/functions/fnc_groupDropDistantUnits.sqf +++ /dev/null @@ -1,25 +0,0 @@ -#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/functions/fnc_joinTeam.sqf b/addons/interaction/functions/fnc_joinTeam.sqf index 977e9022229..0d1928eb2fc 100644 --- a/addons/interaction/functions/fnc_joinTeam.sqf +++ b/addons/interaction/functions/fnc_joinTeam.sqf @@ -22,16 +22,8 @@ params ["_unit", "_team", ["_displayHint", false, [false]]]; _unit assignTeam _team; // display message -if (_unit == ACE_player) then { - private _message = ""; - - if (_team == "MAIN") then { - _message = localize LSTRING(LeftTeam); - } else { - _team = localize format [LSTRING(Team%1), _team]; - _message = format [localize LSTRING(JoinedTeam), _team]; - }; - if (_displayHint) then { - [_message] call EFUNC(common,displayTextStructured); - }; +if (_displayHint && {_unit == ACE_player}) then { + private _team = localize format ["str_team_%1", _team]; + private _message = format [LLSTRING(JoinedTeam), _team]; + [_message] call EFUNC(common,displayTextStructured); }; diff --git a/addons/interaction/initSettings.inc.sqf b/addons/interaction/initSettings.inc.sqf index bba27769c0f..f634b44313f 100644 --- a/addons/interaction/initSettings.inc.sqf +++ b/addons/interaction/initSettings.inc.sqf @@ -6,6 +6,14 @@ true ] call CBA_fnc_addSetting; +[ + QGVAR(remoteTeamManagement), "CHECKBOX", + [LSTRING(remoteTeamManagement_DisplayName), LSTRING(remoteTeamManagement_Description)], + format ["ACE %1", LLSTRING(DisplayName)], + true, + true +] call CBA_fnc_addSetting; + [ QGVAR(enableMagazinePassing), "CHECKBOX", LSTRING(PassMagazineSetting), diff --git a/addons/interaction/stringtable.xml b/addons/interaction/stringtable.xml index 4b0a74cc752..89a263f651a 100644 --- a/addons/interaction/stringtable.xml +++ b/addons/interaction/stringtable.xml @@ -582,8 +582,27 @@ 小隊管理 Takım Yönetimi - - Drop Distant Members + + Remote Squad Management + + + Allow dropping and changing team colors of any unit in player's squad + + + Squad + Družstvo + Trupp + Отряд + Drużyna + Squadra + Escuadrón + Escouade + 分隊 + 分隊 + 분대 + Esquadrão + 小队 + Manga Red @@ -789,6 +808,18 @@ 加入黃組 Sarıya Katıl + + Join White + Weiss beitreten + Unirse a Blanco + Dołącz do Biała + Entrar em Branco + Připojit k Bílý Tým + Присоединиться к Белая + Rejoindre Blanc + Unirsi al team Bianco + 백팀 참여 + You joined Team %1 Du bist Gruppe %1 beigetreten