mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #1293 from acemod/nametagFireteamColors
Add assignedTeam color propagation to nametags from the leader
This commit is contained in:
commit
c4393862aa
@ -22,6 +22,41 @@ GVAR(ShowNamesTime) = -10;
|
||||
{false},
|
||||
[29, [false, false, false]], false] call cba_fnc_addKeybind; //LeftControl Key
|
||||
|
||||
// Monitor the assigned teams, and propegate them appropriately for the player
|
||||
// This allows for assigned team colors to match across the entire group
|
||||
[{
|
||||
private["_leader", "_playerIsLeader", "_unitTeam"];
|
||||
if (!(isNull ACE_player) && { alive ACE_player } ) then {
|
||||
_leader = leader (group ACE_player);
|
||||
_playerIsLeader = false;
|
||||
|
||||
if(alive _leader) then {
|
||||
if(_leader == ACE_player) then {
|
||||
_playerIsLeader = true;
|
||||
};
|
||||
};
|
||||
|
||||
if (_playerIsLeader) then {
|
||||
{
|
||||
if(alive _x) then {
|
||||
_unitTeam = _x getVariable [QGVAR(teamAssignment),"MAIN"];
|
||||
if (_unitTeam != assignedTeam _x) then {
|
||||
_x setVariable [QGVAR(teamAssignment), assignedTeam _x,true];
|
||||
};
|
||||
};
|
||||
} forEach units (group ACE_player);
|
||||
} else {
|
||||
{
|
||||
if(alive _x) then {
|
||||
_unitTeam = _x getVariable [QGVAR(teamAssignment),"MAIN"];
|
||||
if (_unitTeam != assignedTeam _x) then {
|
||||
_x assignTeam _unitTeam;
|
||||
};
|
||||
};
|
||||
} forEach units (group ACE_player);
|
||||
};
|
||||
};
|
||||
}, 5, []] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
// Draw handle
|
||||
addMissionEventHandler ["Draw3D", {_this call FUNC(onDraw3d);}];
|
||||
|
Loading…
Reference in New Issue
Block a user