]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Truncate lathe announcement lists (#36945)
authorpathetic meowmeow <uhhadd@gmail.com>
Sat, 26 Apr 2025 21:45:53 +0000 (17:45 -0400)
committerGitHub <noreply@github.com>
Sat, 26 Apr 2025 21:45:53 +0000 (17:45 -0400)
Content.Server/Lathe/Components/LatheAnnouncingComponent.cs
Content.Server/Lathe/LatheSystem.cs
Resources/Locale/en-US/lathe/lathesystem.ftl

index 16c30d98ebac35f77b5470542ffc93884c6bda61..e5a6fbf3523324a2579fb87a796aabec94713fca 100644 (file)
@@ -14,4 +14,10 @@ public sealed partial class LatheAnnouncingComponent : Component
     /// </summary>
     [DataField(required: true)]
     public List<ProtoId<RadioChannelPrototype>> Channels = new();
+
+    /// <summary>
+    /// How many items should be announced in a message before it truncates
+    /// </summary>
+    [DataField]
+    public int MaximumItems = 5;
 }
index 0212bb6eebd0a3fb8e5883366c8abf92257bd98e..3c5ecde1c617dcc5246da14ea35177b18b1075ca 100644 (file)
@@ -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)
             {
index 93e0107f6816d0efd27a1036a10eb97c5da425da..ecf01b331766a5f450e8e10188f4700d7997f30e 100644 (file)
@@ -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]