diff --git a/Content.Server/RatKing/RatKingSystem.cs b/Content.Server/RatKing/RatKingSystem.cs index af3d57a043a..776384988cd 100644 --- a/Content.Server/RatKing/RatKingSystem.cs +++ b/Content.Server/RatKing/RatKingSystem.cs @@ -7,6 +7,8 @@ using Content.Server.Popups; using Content.Shared.Atmos; using Content.Shared.Dataset; +using Content.Shared.Mobs; // Sunrise-Edit +using Content.Shared.Mobs.Components; // Sunrise-Edit using Content.Shared.Nutrition.Components; using Content.Shared.Nutrition.EntitySystems; using Content.Shared.Pointing; @@ -46,7 +48,16 @@ private void OnRaiseArmy(EntityUid uid, RatKingComponent component, RatKingRaise if (!TryComp(uid, out var hunger)) return; - if (component.Servants.Count >= component.MaxArmyCount) + // Sunrise-Edit + var livingServants = 0; + foreach (var servantId in component.Servants) + { + if (TryComp(servantId, out var mobState) && mobState.CurrentState != MobState.Dead) + livingServants++; + } + + if (livingServants >= component.MaxArmyCount) + // Sunrise-Edit { _popup.PopupEntity(Loc.GetString("rat-king-max-army", ("amount", component.MaxArmyCount)), uid, uid); return;