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 remote squad management #10258

Merged
merged 4 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
37 changes: 19 additions & 18 deletions addons/interaction/CfgVehicles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,38 +78,38 @@ 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;
modifierFunction = QUOTE([ARR_3('RED','PATHTOF(UI\team\team_white_ca.paa)',_this select 3)] call FUNC(modifyTeamManagementAction));
};
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;
modifierFunction = QUOTE([ARR_3('GREEN','PATHTOF(UI\team\team_white_ca.paa)',_this select 3)] call FUNC(modifyTeamManagementAction));
};
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;
modifierFunction = QUOTE([ARR_3('BLUE','PATHTOF(UI\team\team_white_ca.paa)',_this select 3)] call FUNC(modifyTeamManagementAction));
};
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"};
Expand Down Expand Up @@ -253,40 +253,47 @@ 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));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

should this have (_unit == leader _unit)?

Copy link
Contributor

Choose a reason for hiding this comment

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

It probably should.

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;
modifierFunction = QUOTE([ARR_3('RED','PATHTOF(UI\team\team_white_ca.paa)',_this select 3)] call FUNC(modifyTeamManagementAction));
};
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;
modifierFunction = QUOTE([ARR_3('GREEN','PATHTOF(UI\team\team_white_ca.paa)',_this select 3)] call FUNC(modifyTeamManagementAction));
};
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;
modifierFunction = QUOTE([ARR_3('BLUE','PATHTOF(UI\team\team_white_ca.paa)',_this select 3)] call FUNC(modifyTeamManagementAction));
};
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));
Expand Down Expand Up @@ -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 {
Expand Down
3 changes: 1 addition & 2 deletions addons/interaction/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ PREP(showMouseHint);
PREP(hideMouseHint);

// interaction with units
PREP(addSquadChildren);
PREP(canInteractWithCivilian);
PREP(canInteractWithVehicleCrew);
PREP(getDown);
Expand All @@ -36,8 +37,6 @@ PREP(pullOutBody);
PREP(canRenameGroup);
PREP(renameGroupUI);
PREP(renameGroup);
PREP(canGroupDropDistantUnits);
PREP(groupDropDistantUnits);

// Weapon Attachments
PREP(getWeaponAttachmentsActions);
Expand Down
51 changes: 51 additions & 0 deletions addons/interaction/functions/fnc_addSquadChildren.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#include "..\script_component.hpp"
/*
* Author: PabstMirror
* Gets the squad child actions
*
* Arguments:
* 1: Player <OBJECT>
*
* Return Value:
* Children actions <ARRAY>
*
* 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
20 changes: 0 additions & 20 deletions addons/interaction/functions/fnc_canGroupDropDistantUnits.sqf

This file was deleted.

25 changes: 0 additions & 25 deletions addons/interaction/functions/fnc_groupDropDistantUnits.sqf

This file was deleted.

16 changes: 4 additions & 12 deletions addons/interaction/functions/fnc_joinTeam.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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 [localize LSTRING(JoinedTeam), _team];
LinkIsGrim marked this conversation as resolved.
Show resolved Hide resolved
[_message] call EFUNC(common,displayTextStructured);
};
8 changes: 8 additions & 0 deletions addons/interaction/initSettings.inc.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
35 changes: 33 additions & 2 deletions addons/interaction/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -582,8 +582,27 @@
<Chinese>小隊管理</Chinese>
<Turkish>Takım Yönetimi</Turkish>
</Key>
<Key ID="STR_ACE_Interaction_groupDropDistantUnits">
<English>Drop Distant Members</English>
<Key ID="STR_ACE_Interaction_remoteTeamManagement_DisplayName">
<English>Remote Squad Management</English>
</Key>
<Key ID="STR_ACE_Interaction_remoteTeamManagement_Description">
<English>Allow dropping and changing team colors of any unit in player's squad</English>
</Key>
<Key ID="STR_ACE_Interaction_Squad">
<English>Squad</English>
<Czech>Družstvo</Czech>
<German>Trupp</German>
<Russian>Отряд</Russian>
<Polish>Drużyna</Polish>
<Italian>Squadra</Italian>
<Spanish>Escuadrón</Spanish>
<French>Escouade</French>
<Chinese>分隊</Chinese>
<Japanese>分隊</Japanese>
<Korean>분대</Korean>
<Portuguese>Esquadrão</Portuguese>
<Chinesesimp>小队</Chinesesimp>
<Turkish>Manga</Turkish>
</Key>
<Key ID="STR_ACE_Interaction_TeamRED">
<English>Red</English>
Expand Down Expand Up @@ -789,6 +808,18 @@
<Chinese>加入黃組</Chinese>
<Turkish>Sarıya Katıl</Turkish>
</Key>
<Key ID="STR_ACE_Interaction_JoinTeamMain">
<English>Join White</English>
<German>Weiss beitreten</German>
<Spanish>Unirse a Blanco</Spanish>
<Polish>Dołącz do Biała</Polish>
<Portuguese>Entrar em Branco</Portuguese>
<Czech>Připojit k Bílý Tým</Czech>
<Russian>Присоединиться к Белая</Russian>
<French>Rejoindre Blanc</French>
<Italian>Unirsi al team Bianco</Italian>
<Korean>백팀 참여</Korean>
</Key>
<Key ID="STR_ACE_Interaction_JoinedTeam">
<English>You joined Team %1</English>
<German>Du bist Gruppe %1 beigetreten</German>
Expand Down