diff --git a/Content.Server/GameTicking/Rules/RevolutionaryRuleSystem.cs b/Content.Server/GameTicking/Rules/RevolutionaryRuleSystem.cs index c5f88ab6cf1..8ace9d951c7 100644 --- a/Content.Server/GameTicking/Rules/RevolutionaryRuleSystem.cs +++ b/Content.Server/GameTicking/Rules/RevolutionaryRuleSystem.cs @@ -194,7 +194,8 @@ private void OnHeadRevMobStateChanged(EntityUid uid, HeadRevolutionaryComponent /// private bool CheckRevsLose() { - var stunTime = TimeSpan.FromSeconds(4); + ///ADT метод полностью переписан + ///ADT start var headRevList = new List(); var headRevs = AllEntityQuery(); @@ -204,37 +205,51 @@ private bool CheckRevsLose() } // If no Head Revs are alive all normal Revs will lose their Rev status and rejoin Nanotrasen - // Cuffing Head Revs is not enough - they must be killed. - if (IsGroupDetainedOrDead(headRevList, false, false)) + if (IsGroupDead(headRevList, false)) { - var rev = AllEntityQuery(); - while (rev.MoveNext(out var uid, out _, out var mc)) + var headrev = AllEntityQuery(); + while (headrev.MoveNext(out var uid, out _, out var mc)) { if (HasComp(uid)) continue; + if (TryComp(uid, out var mobstate) && mobstate.CurrentState != MobState.Dead) + { + AddComp(uid); + return false; + } + } + } + return true; - _npcFaction.RemoveFaction(uid, RevolutionaryNpcFaction); - _stun.TryParalyze(uid, stunTime, true); - RemCompDeferred(uid); - _popup.PopupEntity(Loc.GetString("rev-break-control", ("name", Identity.Entity(uid, EntityManager))), uid); - _adminLogManager.Add(LogType.Mind, LogImpact.Medium, $"{ToPrettyString(uid)} was deconverted due to all Head Revolutionaries dying."); - - if (!_mind.TryGetMind(uid, out var mindId, out _, mc)) - continue; - - // remove their antag role - _role.MindTryRemoveRole(mindId); - - // make it very obvious to the rev they've been deconverted since - // they may not see the popup due to antag and/or new player tunnel vision - if (_mind.TryGetSession(mindId, out var session)) - _euiMan.OpenEui(new DeconvertedEui(), session); + } + private bool IsGroupDead(List list, bool checkOffStation) + { + var dead = 0; + foreach (var entity in list) + { + if (TryComp(entity, out var state)) + { + if (state.CurrentState == MobState.Dead || state.CurrentState == MobState.Invalid) + { + dead++; + } + else if (checkOffStation && _stationSystem.GetOwningStation(entity) == null && !_emergencyShuttle.EmergencyShuttleArrived) + { + dead++; + } + } + //If they don't have the MobStateComponent they might as well be dead. + else + { + dead++; } - return true; } - return false; + return dead == list.Count || list.Count == 0; } + ///ADT end + + /// /// Will take a group of entities and check if these entities are alive, dead or cuffed.