From c250f52a46c0f2eb3c6c5eaf17a6c41e92acb2d9 Mon Sep 17 00:00:00 2001 From: pacable <77161122+pxc1984@users.noreply.github.com> Date: Tue, 10 Dec 2024 02:34:54 +0300 Subject: [PATCH] maxcap (#819) Signed-off-by: pacable --- Content.Server/RatKing/RatKingSystem.cs | 8 +++++++- Content.Shared/RatKing/RatKingComponent.cs | 5 +++++ .../ru-RU/_strings/_sunrise/animals/rat-king/rat-king.ftl | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 Resources/Locale/ru-RU/_strings/_sunrise/animals/rat-king/rat-king.ftl diff --git a/Content.Server/RatKing/RatKingSystem.cs b/Content.Server/RatKing/RatKingSystem.cs index 4b82dba335..c0adaab7aa 100644 --- a/Content.Server/RatKing/RatKingSystem.cs +++ b/Content.Server/RatKing/RatKingSystem.cs @@ -46,10 +46,16 @@ namespace Content.Server.RatKing if (!TryComp(uid, out var hunger)) return; + if (component.Servants.Count >= component.MaxArmyCount) + { + _popup.PopupEntity(Loc.GetString("rat-king-max-army"), uid, uid); + return; + } + //make sure the hunger doesn't go into the negatives if (hunger.CurrentHunger < component.HungerPerArmyUse) { - _popup.PopupEntity(Loc.GetString("rat-king-too-hungry"), uid, uid); + _popup.PopupEntity(Loc.GetString("rat-king-too-hungry", ("amount", component.MaxArmyCount)), uid, uid); return; } args.Handled = true; diff --git a/Content.Shared/RatKing/RatKingComponent.cs b/Content.Shared/RatKing/RatKingComponent.cs index 712d4ae3a1..e0b180b4aa 100644 --- a/Content.Shared/RatKing/RatKingComponent.cs +++ b/Content.Shared/RatKing/RatKingComponent.cs @@ -99,6 +99,11 @@ public sealed partial class RatKingComponent : Component { RatKingOrderType.CheeseEm, "RatKingCommandCheeseEm" }, { RatKingOrderType.Loose, "RatKingCommandLoose" } }; + + // Sunrise-start + [DataField] + public int MaxArmyCount = 12; + // Sunrise-end } [Serializable, NetSerializable] diff --git a/Resources/Locale/ru-RU/_strings/_sunrise/animals/rat-king/rat-king.ftl b/Resources/Locale/ru-RU/_strings/_sunrise/animals/rat-king/rat-king.ftl new file mode 100644 index 0000000000..e868bc546e --- /dev/null +++ b/Resources/Locale/ru-RU/_strings/_sunrise/animals/rat-king/rat-king.ftl @@ -0,0 +1 @@ +rat-king-too-hungry = У вас превышено максимальное количество подданных: { $amount }