Skip to content

Commit

Permalink
Modules - Fix Change Side module (#763)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnb432 authored May 5, 2024
1 parent f1d3835 commit c954c00
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions addons/common/functions/fnc_changeGroupSide.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,18 @@ if (allGroups findIf {side _x isEqualTo _side && {groupId _x isEqualTo _groupId}
_newGroup setGroupIdGlobal [_groupId];
};

private _units = units _unit;

// Preserve assigned team for each unit
{
// Teams need to be gotten before removing units from group
private _teams = _units apply {
private _team = assignedTeam _x;
[_team, "MAIN"] select (_team == "")
};

{
[_x] joinSilent _newGroup;
_x assignTeam _team;
} forEach units _group;
_x assignTeam (_teams select _forEachIndex);
} forEach _units;

deleteGroup _group;

0 comments on commit c954c00

Please sign in to comment.