diff --git a/Content.Server/Antag/AntagSelectionSystem.cs b/Content.Server/Antag/AntagSelectionSystem.cs index 860e2b986529..e90e4ebab6bc 100644 --- a/Content.Server/Antag/AntagSelectionSystem.cs +++ b/Content.Server/Antag/AntagSelectionSystem.cs @@ -332,12 +332,19 @@ public void MakeAntag(Entity ent, ICommonSession? sessi if (session != null) { - var curMind = _mind.CreateMind(session.UserId, Name(antagEnt.Value)); - _mind.SetUserId(curMind, session.UserId); + // start 220 AntagSelectionFix + var curMind = session.GetMind(); - _mind.TransferTo(curMind, antagEnt, ghostCheckOverride: true); - _role.MindAddRoles(curMind, def.MindComponents, null, true); - ent.Comp.SelectedMinds.Add((curMind, Name(player))); + if (curMind == null || session.AttachedEntity != antagEnt) + { + curMind = _mind.CreateMind(session.UserId, Name(antagEnt.Value)); + _mind.SetUserId(curMind.Value, session.UserId); + } + + _mind.TransferTo(curMind.Value, antagEnt, ghostCheckOverride: true); + _role.MindAddRoles(curMind.Value, def.MindComponents, null, true); + ent.Comp.SelectedMinds.Add((curMind.Value, Name(player))); + // end 220 AntagSelectionFix SendBriefing(session, def.Briefing); }