Truncate lathe announcement lists (#36945)

This commit is contained in:
pathetic meowmeow
2025-04-26 17:45:53 -04:00
committed by GitHub
parent f74b1c35bb
commit b7d020570f
3 changed files with 18 additions and 4 deletions

View File

@@ -14,4 +14,10 @@ public sealed partial class LatheAnnouncingComponent : Component
/// </summary> /// </summary>
[DataField(required: true)] [DataField(required: true)]
public List<ProtoId<RadioChannelPrototype>> Channels = new(); 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;
} }

View File

@@ -385,10 +385,17 @@ namespace Content.Server.Lathe
if (recipeNames.Count == 0) if (recipeNames.Count == 0)
return; return;
var message = Loc.GetString( var message =
"lathe-unlock-recipe-radio-broadcast", recipeNames.Count > ent.Comp.MaximumItems ?
("items", ContentLocalizationManager.FormatList(recipeNames)) 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) foreach (var channel in ent.Comp.Channels)
{ {

View File

@@ -1,3 +1,4 @@
lathe-popup-material-not-used = This material is not used in this machine. 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 = 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] lathe-unlock-recipe-radio-broadcast-item = [bold]{$item}[/bold]