Interaction - Add remote squad management (#10258)

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com>
This commit is contained in:
PabstMirror 2024-08-27 16:30:06 -05:00 committed by GitHub
parent c5fb3d4cb0
commit 884ae78704
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 116 additions and 79 deletions

View File

@ -78,7 +78,7 @@ class CfgVehicles {
class ACE_AssignTeamRed { class ACE_AssignTeamRed {
displayName = CSTRING(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)); statement = QUOTE([ARR_3(_target,'RED',true)] call DFUNC(joinTeam));
exceptions[] = {"isNotSwimming"}; exceptions[] = {"isNotSwimming"};
showDisabled = 1; showDisabled = 1;
@ -86,7 +86,7 @@ class CfgVehicles {
}; };
class ACE_AssignTeamGreen { class ACE_AssignTeamGreen {
displayName = CSTRING(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)); statement = QUOTE([ARR_3(_target,'GREEN',true)] call DFUNC(joinTeam));
exceptions[] = {"isNotSwimming"}; exceptions[] = {"isNotSwimming"};
showDisabled = 1; showDisabled = 1;
@ -94,7 +94,7 @@ class CfgVehicles {
}; };
class ACE_AssignTeamBlue { class ACE_AssignTeamBlue {
displayName = CSTRING(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)); statement = QUOTE([ARR_3(_target,'BLUE',true)] call DFUNC(joinTeam));
exceptions[] = {"isNotSwimming"}; exceptions[] = {"isNotSwimming"};
showDisabled = 1; showDisabled = 1;
@ -102,14 +102,14 @@ class CfgVehicles {
}; };
class ACE_AssignTeamYellow { class ACE_AssignTeamYellow {
displayName = CSTRING(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)); statement = QUOTE([ARR_3(_target,'YELLOW',true)] call DFUNC(joinTeam));
exceptions[] = {"isNotSwimming"}; exceptions[] = {"isNotSwimming"};
showDisabled = 1; showDisabled = 1;
modifierFunction = QUOTE([ARR_3('YELLOW','PATHTOF(UI\team\team_white_ca.paa)',_this select 3)] call FUNC(modifyTeamManagementAction)); modifierFunction = QUOTE([ARR_3('YELLOW','PATHTOF(UI\team\team_white_ca.paa)',_this select 3)] call FUNC(modifyTeamManagementAction));
}; };
class ACE_UnassignTeam { class ACE_AssignTeamMain {
displayName = CSTRING(LeaveTeam); displayName = "$str_assign_main";
condition = QUOTE([ARR_2(_player,_target)] call DFUNC(canJoinTeam) && {assignedTeam _target != 'MAIN'}); condition = QUOTE([ARR_2(_player,_target)] call DFUNC(canJoinTeam) && {assignedTeam _target != 'MAIN'});
statement = QUOTE([ARR_3(_target,'MAIN',true)] call DFUNC(joinTeam)); statement = QUOTE([ARR_3(_target,'MAIN',true)] call DFUNC(joinTeam));
exceptions[] = {"isNotSwimming"}; 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)); modifierFunction = QUOTE([ARR_3(assignedTeam _target,'PATHTOF(UI\team\team_management_ca.paa)',_this select 3)] call FUNC(modifyTeamManagementAction));
showDisabled = 1; 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 { class ACE_JoinTeamRed {
displayName = CSTRING(JoinTeamRed); displayName = CSTRING(JoinTeamRed);
condition = QUOTE(true); condition = QUOTE(assignedTeam _player != 'RED');
exceptions[] = {"isNotSwimming", "isNotInside", "isNotSitting", "isNotOnLadder", "isNotRefueling"}; exceptions[] = {"isNotSwimming", "isNotInside", "isNotSitting", "isNotOnLadder", "isNotRefueling"};
statement = QUOTE([ARR_3(_player,'RED',true)] call DFUNC(joinTeam)); statement = QUOTE([ARR_3(_player,'RED',true)] call DFUNC(joinTeam));
showDisabled = 1; showDisabled = 1;
@ -263,7 +270,7 @@ class CfgVehicles {
}; };
class ACE_JoinTeamGreen { class ACE_JoinTeamGreen {
displayName = CSTRING(JoinTeamGreen); displayName = CSTRING(JoinTeamGreen);
condition = QUOTE(true); condition = QUOTE(assignedTeam _player != 'GREEN');
exceptions[] = {"isNotSwimming", "isNotInside", "isNotSitting", "isNotOnLadder", "isNotRefueling"}; exceptions[] = {"isNotSwimming", "isNotInside", "isNotSitting", "isNotOnLadder", "isNotRefueling"};
statement = QUOTE([ARR_3(_player,'GREEN',true)] call DFUNC(joinTeam)); statement = QUOTE([ARR_3(_player,'GREEN',true)] call DFUNC(joinTeam));
showDisabled = 1; showDisabled = 1;
@ -271,7 +278,7 @@ class CfgVehicles {
}; };
class ACE_JoinTeamBlue { class ACE_JoinTeamBlue {
displayName = CSTRING(JoinTeamBlue); displayName = CSTRING(JoinTeamBlue);
condition = QUOTE(true); condition = QUOTE(assignedTeam _player != 'BLUE');
exceptions[] = {"isNotSwimming", "isNotInside", "isNotSitting", "isNotOnLadder", "isNotRefueling"}; exceptions[] = {"isNotSwimming", "isNotInside", "isNotSitting", "isNotOnLadder", "isNotRefueling"};
statement = QUOTE([ARR_3(_player,'BLUE',true)] call DFUNC(joinTeam)); statement = QUOTE([ARR_3(_player,'BLUE',true)] call DFUNC(joinTeam));
showDisabled = 1; showDisabled = 1;
@ -279,14 +286,14 @@ class CfgVehicles {
}; };
class ACE_JoinTeamYellow { class ACE_JoinTeamYellow {
displayName = CSTRING(JoinTeamYellow); displayName = CSTRING(JoinTeamYellow);
condition = QUOTE(true); condition = QUOTE(assignedTeam _player != 'YELLOW');
exceptions[] = {"isNotSwimming", "isNotInside", "isNotSitting", "isNotOnLadder", "isNotRefueling"}; exceptions[] = {"isNotSwimming", "isNotInside", "isNotSitting", "isNotOnLadder", "isNotRefueling"};
statement = QUOTE([ARR_3(_player,'YELLOW',true)] call DFUNC(joinTeam)); statement = QUOTE([ARR_3(_player,'YELLOW',true)] call DFUNC(joinTeam));
showDisabled = 1; showDisabled = 1;
modifierFunction = QUOTE([ARR_3('YELLOW','PATHTOF(UI\team\team_white_ca.paa)',_this select 3)] call FUNC(modifyTeamManagementAction)); modifierFunction = QUOTE([ARR_3('YELLOW','PATHTOF(UI\team\team_white_ca.paa)',_this select 3)] call FUNC(modifyTeamManagementAction));
}; };
class ACE_LeaveTeam { class ACE_JoinTeamMain {
displayName = CSTRING(LeaveTeam); displayName = CSTRING(JoinTeamMain);
condition = QUOTE(assignedTeam _player != 'MAIN'); condition = QUOTE(assignedTeam _player != 'MAIN');
exceptions[] = {"isNotSwimming", "isNotInside", "isNotSitting", "isNotOnLadder", "isNotRefueling"}; exceptions[] = {"isNotSwimming", "isNotInside", "isNotSitting", "isNotOnLadder", "isNotRefueling"};
statement = QUOTE([ARR_3(_player,'MAIN',true)] call DFUNC(joinTeam)); statement = QUOTE([ARR_3(_player,'MAIN',true)] call DFUNC(joinTeam));
@ -316,12 +323,6 @@ class CfgVehicles {
statement = QUOTE(_player call FUNC(renameGroupUI)); statement = QUOTE(_player call FUNC(renameGroupUI));
showDisabled =1; 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 { class ACE_Equipment {

View File

@ -13,6 +13,7 @@ PREP(showMouseHint);
PREP(hideMouseHint); PREP(hideMouseHint);
// interaction with units // interaction with units
PREP(addSquadChildren);
PREP(canInteractWithCivilian); PREP(canInteractWithCivilian);
PREP(canInteractWithVehicleCrew); PREP(canInteractWithVehicleCrew);
PREP(getDown); PREP(getDown);
@ -36,8 +37,6 @@ PREP(pullOutBody);
PREP(canRenameGroup); PREP(canRenameGroup);
PREP(renameGroupUI); PREP(renameGroupUI);
PREP(renameGroup); PREP(renameGroup);
PREP(canGroupDropDistantUnits);
PREP(groupDropDistantUnits);
// Weapon Attachments // Weapon Attachments
PREP(getWeaponAttachmentsActions); PREP(getWeaponAttachmentsActions);

View File

@ -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

View File

@ -1,20 +0,0 @@
#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}

View File

@ -1,25 +0,0 @@
#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);

View File

@ -22,16 +22,8 @@ params ["_unit", "_team", ["_displayHint", false, [false]]];
_unit assignTeam _team; _unit assignTeam _team;
// display message // display message
if (_unit == ACE_player) then { if (_displayHint && {_unit == ACE_player}) then {
private _message = ""; private _team = localize format ["str_team_%1", _team];
private _message = format [LLSTRING(JoinedTeam), _team];
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); [_message] call EFUNC(common,displayTextStructured);
};
}; };

View File

@ -6,6 +6,14 @@
true true
] call CBA_fnc_addSetting; ] 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", QGVAR(enableMagazinePassing), "CHECKBOX",
LSTRING(PassMagazineSetting), LSTRING(PassMagazineSetting),

View File

@ -582,8 +582,27 @@
<Chinese>小隊管理</Chinese> <Chinese>小隊管理</Chinese>
<Turkish>Takım Yönetimi</Turkish> <Turkish>Takım Yönetimi</Turkish>
</Key> </Key>
<Key ID="STR_ACE_Interaction_groupDropDistantUnits"> <Key ID="STR_ACE_Interaction_remoteTeamManagement_DisplayName">
<English>Drop Distant Members</English> <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>
<Key ID="STR_ACE_Interaction_TeamRED"> <Key ID="STR_ACE_Interaction_TeamRED">
<English>Red</English> <English>Red</English>
@ -789,6 +808,18 @@
<Chinese>加入黃組</Chinese> <Chinese>加入黃組</Chinese>
<Turkish>Sarıya Katıl</Turkish> <Turkish>Sarıya Katıl</Turkish>
</Key> </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"> <Key ID="STR_ACE_Interaction_JoinedTeam">
<English>You joined Team %1</English> <English>You joined Team %1</English>
<German>Du bist Gruppe %1 beigetreten</German> <German>Du bist Gruppe %1 beigetreten</German>