Skip to content

Commit

Permalink
фикс лимита
Browse files Browse the repository at this point in the history
  • Loading branch information
babaevlsdd committed Dec 22, 2024
1 parent c71c9bc commit 663a9e9
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Content.Server/RatKing/RatKingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -46,7 +48,16 @@ private void OnRaiseArmy(EntityUid uid, RatKingComponent component, RatKingRaise
if (!TryComp<HungerComponent>(uid, out var hunger))
return;

if (component.Servants.Count >= component.MaxArmyCount)
// Sunrise-Edit
var livingServants = 0;
foreach (var servantId in component.Servants)
{
if (TryComp<MobStateComponent>(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;
Expand Down

0 comments on commit 663a9e9

Please sign in to comment.