From: pathetic meowmeow Date: Sat, 26 Apr 2025 21:45:53 +0000 (-0400) Subject: Truncate lathe announcement lists (#36945) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=b7d020570fcf317c95b3a798fb8464d54311081b;p=space-station-14.git Truncate lathe announcement lists (#36945) --- diff --git a/Content.Server/Lathe/Components/LatheAnnouncingComponent.cs b/Content.Server/Lathe/Components/LatheAnnouncingComponent.cs index 16c30d98eb..e5a6fbf352 100644 --- a/Content.Server/Lathe/Components/LatheAnnouncingComponent.cs +++ b/Content.Server/Lathe/Components/LatheAnnouncingComponent.cs @@ -14,4 +14,10 @@ public sealed partial class LatheAnnouncingComponent : Component /// [DataField(required: true)] public List> Channels = new(); + + /// + /// How many items should be announced in a message before it truncates + /// + [DataField] + public int MaximumItems = 5; } diff --git a/Content.Server/Lathe/LatheSystem.cs b/Content.Server/Lathe/LatheSystem.cs index 0212bb6eeb..3c5ecde1c6 100644 --- a/Content.Server/Lathe/LatheSystem.cs +++ b/Content.Server/Lathe/LatheSystem.cs @@ -385,10 +385,17 @@ namespace Content.Server.Lathe if (recipeNames.Count == 0) return; - var message = Loc.GetString( - "lathe-unlock-recipe-radio-broadcast", - ("items", ContentLocalizationManager.FormatList(recipeNames)) - ); + var message = + recipeNames.Count > ent.Comp.MaximumItems ? + Loc.GetString( + "lathe-unlock-recipe-radio-broadcast-overflow", + ("items", ContentLocalizationManager.FormatList(recipeNames.GetRange(0, ent.Comp.MaximumItems))), + ("count", recipeNames.Count) + ) : + Loc.GetString( + "lathe-unlock-recipe-radio-broadcast", + ("items", ContentLocalizationManager.FormatList(recipeNames)) + ); foreach (var channel in ent.Comp.Channels) { diff --git a/Resources/Locale/en-US/lathe/lathesystem.ftl b/Resources/Locale/en-US/lathe/lathesystem.ftl index 93e0107f68..ecf01b3317 100644 --- a/Resources/Locale/en-US/lathe/lathesystem.ftl +++ b/Resources/Locale/en-US/lathe/lathesystem.ftl @@ -1,3 +1,4 @@ lathe-popup-material-not-used = This material is not used in this machine. lathe-unlock-recipe-radio-broadcast = This lathe is now capable of producing the following recipes: {$items} +lathe-unlock-recipe-radio-broadcast-overflow = This lathe is now capable of producing {$count} new recipes, including: {$items} lathe-unlock-recipe-radio-broadcast-item = [bold]{$item}[/bold]