Remove calls to FormattedMessage obsolete methods (#31706)

* Remove FormattedMessage obsolete methods

* Oops
This commit is contained in:
Winkarst
2024-09-01 14:00:53 +03:00
committed by GitHub
parent ff4c347a21
commit 88dcc831c1
40 changed files with 82 additions and 82 deletions

View File

@@ -1,4 +1,4 @@
using Content.Shared.Administration.Notes; using Content.Shared.Administration.Notes;
using Robust.Client.AutoGenerated; using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface; using Robust.Client.UserInterface;
using Robust.Client.UserInterface.XAML; using Robust.Client.UserInterface.XAML;
@@ -13,7 +13,7 @@ public sealed partial class AdminMessagePopupMessage : Control
{ {
RobustXamlLoader.Load(this); RobustXamlLoader.Load(this);
Admin.SetMessage(FormattedMessage.FromMarkup(Loc.GetString( Admin.SetMessage(FormattedMessage.FromMarkupOrThrow(Loc.GetString(
"admin-notes-message-admin", "admin-notes-message-admin",
("admin", message.AdminName), ("admin", message.AdminName),
("date", message.AddedOn.ToLocalTime())))); ("date", message.AddedOn.ToLocalTime()))));

View File

@@ -49,7 +49,7 @@ public sealed partial class AdminMessagePopupWindow : Control
MessageContainer.AddChild(new AdminMessagePopupMessage(message)); MessageContainer.AddChild(new AdminMessagePopupMessage(message));
} }
Description.SetMessage(FormattedMessage.FromMarkup(Loc.GetString("admin-notes-message-desc", ("count", state.Messages.Length)))); Description.SetMessage(FormattedMessage.FromMarkupOrThrow(Loc.GetString("admin-notes-message-desc", ("count", state.Messages.Length))));
} }
private void OnDismissButtonPressed(BaseButton.ButtonEventArgs obj) private void OnDismissButtonPressed(BaseButton.ButtonEventArgs obj)

View File

@@ -59,7 +59,7 @@ namespace Content.Client.Administration.UI.Bwoink
Unread++; Unread++;
var formatted = new FormattedMessage(1); var formatted = new FormattedMessage(1);
formatted.AddMarkup($"[color=gray]{message.SentAt.ToShortTimeString()}[/color] {message.Text}"); formatted.AddMarkupOrThrow($"[color=gray]{message.SentAt.ToShortTimeString()}[/color] {message.Text}");
TextOutput.AddMessage(formatted); TextOutput.AddMessage(formatted);
LastMessage = message.SentAt; LastMessage = message.SentAt;
} }

View File

@@ -131,13 +131,13 @@ public sealed partial class ChangelogTab : Control
Margin = new Thickness(6, 0, 0, 0), Margin = new Thickness(6, 0, 0, 0),
}; };
authorLabel.SetMessage( authorLabel.SetMessage(
FormattedMessage.FromMarkup(Loc.GetString("changelog-author-changed", ("author", author)))); FormattedMessage.FromMarkupOrThrow(Loc.GetString("changelog-author-changed", ("author", author))));
ChangelogBody.AddChild(authorLabel); ChangelogBody.AddChild(authorLabel);
foreach (var change in groupedEntry.SelectMany(c => c.Changes)) foreach (var change in groupedEntry.SelectMany(c => c.Changes))
{ {
var text = new RichTextLabel(); var text = new RichTextLabel();
text.SetMessage(FormattedMessage.FromMarkup(change.Message)); text.SetMessage(FormattedMessage.FromMarkupOrThrow(change.Message));
ChangelogBody.AddChild(new BoxContainer ChangelogBody.AddChild(new BoxContainer
{ {
Orientation = LayoutOrientation.Horizontal, Orientation = LayoutOrientation.Horizontal,

View File

@@ -180,7 +180,7 @@ namespace Content.Client.Chat.UI
var msg = new FormattedMessage(); var msg = new FormattedMessage();
if (fontColor != null) if (fontColor != null)
msg.PushColor(fontColor.Value); msg.PushColor(fontColor.Value);
msg.AddMarkup(message); msg.AddMarkupOrThrow(message);
return msg; return msg;
} }

View File

@@ -145,7 +145,7 @@ namespace Content.Client.Credits
var text = _resourceManager.ContentFileReadAllText($"/Credits/{path}"); var text = _resourceManager.ContentFileReadAllText($"/Credits/{path}");
if (markup) if (markup)
{ {
label.SetMessage(FormattedMessage.FromMarkup(text.Trim())); label.SetMessage(FormattedMessage.FromMarkupOrThrow(text.Trim()));
} }
else else
{ {

View File

@@ -227,7 +227,7 @@ public sealed partial class CriminalRecordsConsoleWindow : FancyWindow
StatusOptionButton.SelectId((int) criminalRecord.Status); StatusOptionButton.SelectId((int) criminalRecord.Status);
if (criminalRecord.Reason is {} reason) if (criminalRecord.Reason is {} reason)
{ {
var message = FormattedMessage.FromMarkup(Loc.GetString("criminal-records-console-wanted-reason")); var message = FormattedMessage.FromMarkupOrThrow(Loc.GetString("criminal-records-console-wanted-reason"));
message.AddText($": {reason}"); message.AddText($": {reason}");
WantedReason.SetMessage(message); WantedReason.SetMessage(message);
WantedReason.Visible = true; WantedReason.Visible = true;

View File

@@ -140,7 +140,7 @@ public sealed partial class GuideReagentEmbed : BoxContainer, IDocumentTag, ISea
var i = 0; var i = 0;
foreach (var effectString in effect.EffectDescriptions) foreach (var effectString in effect.EffectDescriptions)
{ {
descMsg.AddMarkup(effectString); descMsg.AddMarkupOrThrow(effectString);
i++; i++;
if (i < descriptionsCount) if (i < descriptionsCount)
descMsg.PushNewline(); descMsg.PushNewline();
@@ -174,7 +174,7 @@ public sealed partial class GuideReagentEmbed : BoxContainer, IDocumentTag, ISea
var i = 0; var i = 0;
foreach (var effectString in guideEntryRegistryPlant.PlantMetabolisms) foreach (var effectString in guideEntryRegistryPlant.PlantMetabolisms)
{ {
descMsg.AddMarkup(effectString); descMsg.AddMarkupOrThrow(effectString);
i++; i++;
if (i < descriptionsCount) if (i < descriptionsCount)
descMsg.PushNewline(); descMsg.PushNewline();
@@ -195,7 +195,7 @@ public sealed partial class GuideReagentEmbed : BoxContainer, IDocumentTag, ISea
FormattedMessage description = new(); FormattedMessage description = new();
description.AddText(reagent.LocalizedDescription); description.AddText(reagent.LocalizedDescription);
description.PushNewline(); description.PushNewline();
description.AddMarkup(Loc.GetString("guidebook-reagent-physical-description", description.AddMarkupOrThrow(Loc.GetString("guidebook-reagent-physical-description",
("description", reagent.LocalizedPhysicalDescription))); ("description", reagent.LocalizedPhysicalDescription)));
ReagentDescription.SetMessage(description); ReagentDescription.SetMessage(description);
} }

View File

@@ -155,7 +155,7 @@ public sealed partial class GuideReagentReaction : BoxContainer, ISearchableCont
var i = 0; var i = 0;
foreach (var (product, amount) in reagents.OrderByDescending(p => p.Value)) foreach (var (product, amount) in reagents.OrderByDescending(p => p.Value))
{ {
msg.AddMarkup(Loc.GetString("guidebook-reagent-recipes-reagent-display", msg.AddMarkupOrThrow(Loc.GetString("guidebook-reagent-recipes-reagent-display",
("reagent", protoMan.Index<ReagentPrototype>(product).LocalizedName), ("ratio", amount))); ("reagent", protoMan.Index<ReagentPrototype>(product).LocalizedName), ("ratio", amount)));
i++; i++;
if (i < reagentCount) if (i < reagentCount)

View File

@@ -1,4 +1,4 @@
using Robust.Client.AutoGenerated; using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML; using Robust.Client.UserInterface.XAML;
using Robust.Shared.Utility; using Robust.Shared.Utility;
@@ -18,7 +18,7 @@ public sealed partial class InfoSection : BoxContainer
{ {
TitleLabel.Text = title; TitleLabel.Text = title;
if (markup) if (markup)
Content.SetMessage(FormattedMessage.FromMarkup(text.Trim())); Content.SetMessage(FormattedMessage.FromMarkupOrThrow(text.Trim()));
else else
Content.SetMessage(text); Content.SetMessage(text);
} }

View File

@@ -24,7 +24,7 @@ namespace Content.Client.Info
} }
public void SetInfoBlob(string markup) public void SetInfoBlob(string markup)
{ {
_richTextLabel.SetMessage(FormattedMessage.FromMarkup(markup)); _richTextLabel.SetMessage(FormattedMessage.FromMarkupOrThrow(markup));
} }
} }
} }

View File

@@ -15,7 +15,7 @@ public static class RichTextLabelExt
/// </remarks> /// </remarks>
public static RichTextLabel SetMarkup(this RichTextLabel label, string markup) public static RichTextLabel SetMarkup(this RichTextLabel label, string markup)
{ {
label.SetMessage(FormattedMessage.FromMarkup(markup)); label.SetMessage(FormattedMessage.FromMarkupOrThrow(markup));
return label; return label;
} }

View File

@@ -1,4 +1,4 @@
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using Content.Client.Lobby; using Content.Client.Lobby;
using Content.Shared.CCVar; using Content.Shared.CCVar;
using Content.Shared.Players; using Content.Shared.Players;
@@ -133,7 +133,7 @@ public sealed class JobRequirementsManager : ISharedPlaytimeManager
reasons.Add(jobReason.ToMarkup()); reasons.Add(jobReason.ToMarkup());
} }
reason = reasons.Count == 0 ? null : FormattedMessage.FromMarkup(string.Join('\n', reasons)); reason = reasons.Count == 0 ? null : FormattedMessage.FromMarkupOrThrow(string.Join('\n', reasons));
return reason == null; return reason == null;
} }

View File

@@ -309,7 +309,7 @@ public sealed partial class PowerMonitoringWindow
BorderThickness = new Thickness(2), BorderThickness = new Thickness(2),
}; };
msg.AddMarkup(Loc.GetString("power-monitoring-window-rogue-power-consumer")); msg.AddMarkupOrThrow(Loc.GetString("power-monitoring-window-rogue-power-consumer"));
SystemWarningPanel.Visible = true; SystemWarningPanel.Visible = true;
} }
@@ -322,7 +322,7 @@ public sealed partial class PowerMonitoringWindow
BorderThickness = new Thickness(2), BorderThickness = new Thickness(2),
}; };
msg.AddMarkup(Loc.GetString("power-monitoring-window-power-net-abnormalities")); msg.AddMarkupOrThrow(Loc.GetString("power-monitoring-window-power-net-abnormalities"));
SystemWarningPanel.Visible = true; SystemWarningPanel.Visible = true;
} }

View File

@@ -128,12 +128,12 @@ public sealed partial class RoboticsConsoleWindow : FancyWindow
}; };
var text = new FormattedMessage(); var text = new FormattedMessage();
text.PushMarkup(Loc.GetString("robotics-console-model", ("name", model))); text.AddMarkupOrThrow($"{Loc.GetString("robotics-console-model", ("name", model))}\n");
text.AddMarkup(Loc.GetString("robotics-console-designation")); text.AddMarkupOrThrow(Loc.GetString("robotics-console-designation"));
text.AddText($" {data.Name}\n"); // prevent players trolling by naming borg [color=red]satan[/color] text.AddText($" {data.Name}\n"); // prevent players trolling by naming borg [color=red]satan[/color]
text.PushMarkup(Loc.GetString("robotics-console-battery", ("charge", (int) (data.Charge * 100f)), ("color", batteryColor))); text.AddMarkupOrThrow($"{Loc.GetString("robotics-console-battery", ("charge", (int)(data.Charge * 100f)), ("color", batteryColor))}\n");
text.PushMarkup(Loc.GetString("robotics-console-brain", ("brain", data.HasBrain))); text.AddMarkupOrThrow($"{Loc.GetString("robotics-console-brain", ("brain", data.HasBrain))}\n");
text.AddMarkup(Loc.GetString("robotics-console-modules", ("count", data.ModuleCount))); text.AddMarkupOrThrow(Loc.GetString("robotics-console-modules", ("count", data.ModuleCount)));
BorgInfo.SetMessage(text); BorgInfo.SetMessage(text);
// how the turntables // how the turntables

View File

@@ -61,9 +61,9 @@ namespace Content.Client.RoundEnd
//Gamemode Name //Gamemode Name
var gamemodeLabel = new RichTextLabel(); var gamemodeLabel = new RichTextLabel();
var gamemodeMessage = new FormattedMessage(); var gamemodeMessage = new FormattedMessage();
gamemodeMessage.AddMarkup(Loc.GetString("round-end-summary-window-round-id-label", ("roundId", roundId))); gamemodeMessage.AddMarkupOrThrow(Loc.GetString("round-end-summary-window-round-id-label", ("roundId", roundId)));
gamemodeMessage.AddText(" "); gamemodeMessage.AddText(" ");
gamemodeMessage.AddMarkup(Loc.GetString("round-end-summary-window-gamemode-name-label", ("gamemode", gamemode))); gamemodeMessage.AddMarkupOrThrow(Loc.GetString("round-end-summary-window-gamemode-name-label", ("gamemode", gamemode)));
gamemodeLabel.SetMessage(gamemodeMessage); gamemodeLabel.SetMessage(gamemodeMessage);
roundEndSummaryContainer.AddChild(gamemodeLabel); roundEndSummaryContainer.AddChild(gamemodeLabel);

View File

@@ -1,4 +1,4 @@
using System.Numerics; using System.Numerics;
using Content.Client.Actions.UI; using Content.Client.Actions.UI;
using Content.Client.Cooldown; using Content.Client.Cooldown;
using Content.Shared.Alert; using Content.Shared.Alert;
@@ -69,8 +69,8 @@ namespace Content.Client.UserInterface.Systems.Alerts.Controls
private Control SupplyTooltip(Control? sender) private Control SupplyTooltip(Control? sender)
{ {
var msg = FormattedMessage.FromMarkup(Loc.GetString(Alert.Name)); var msg = FormattedMessage.FromMarkupOrThrow(Loc.GetString(Alert.Name));
var desc = FormattedMessage.FromMarkup(Loc.GetString(Alert.Description)); var desc = FormattedMessage.FromMarkupOrThrow(Loc.GetString(Alert.Description));
return new ActionAlertTooltip(msg, desc) {Cooldown = Cooldown}; return new ActionAlertTooltip(msg, desc) {Cooldown = Cooldown};
} }

View File

@@ -100,7 +100,7 @@ public partial class ChatBox : UIWidget
{ {
var formatted = new FormattedMessage(3); var formatted = new FormattedMessage(3);
formatted.PushColor(color); formatted.PushColor(color);
formatted.AddMarkup(message); formatted.AddMarkupOrThrow(message);
formatted.Pop(); formatted.Pop();
Contents.AddMessage(formatted); Contents.AddMessage(formatted);
} }

View File

@@ -139,11 +139,11 @@ public sealed partial class AnalysisConsoleMenu : FancyWindow
{ {
if (state.Paused) if (state.Paused)
{ {
message.AddMarkup(Loc.GetString("analysis-console-info-scanner-paused")); message.AddMarkupOrThrow(Loc.GetString("analysis-console-info-scanner-paused"));
} }
else else
{ {
message.AddMarkup(Loc.GetString("analysis-console-info-scanner")); message.AddMarkupOrThrow(Loc.GetString("analysis-console-info-scanner"));
} }
Information.SetMessage(message); Information.SetMessage(message);
UpdateArtifactIcon(null); //set it to blank UpdateArtifactIcon(null); //set it to blank
@@ -155,11 +155,11 @@ public sealed partial class AnalysisConsoleMenu : FancyWindow
if (state.ScanReport == null) if (state.ScanReport == null)
{ {
if (!state.AnalyzerConnected) //no analyzer connected if (!state.AnalyzerConnected) //no analyzer connected
message.AddMarkup(Loc.GetString("analysis-console-info-no-scanner")); message.AddMarkupOrThrow(Loc.GetString("analysis-console-info-no-scanner"));
else if (!state.CanScan) //no artifact else if (!state.CanScan) //no artifact
message.AddMarkup(Loc.GetString("analysis-console-info-no-artifact")); message.AddMarkupOrThrow(Loc.GetString("analysis-console-info-no-artifact"));
else if (state.Artifact == null) //ready to go else if (state.Artifact == null) //ready to go
message.AddMarkup(Loc.GetString("analysis-console-info-ready")); message.AddMarkupOrThrow(Loc.GetString("analysis-console-info-ready"));
} }
else else
{ {

View File

@@ -658,7 +658,7 @@ public record struct CommandPermissionsUnassignedError(CommandSpec Command) : IC
{ {
public FormattedMessage DescribeInner() public FormattedMessage DescribeInner()
{ {
return FormattedMessage.FromMarkup($"The command {Command.FullName()} is missing permission flags and cannot be executed."); return FormattedMessage.FromMarkupOrThrow($"The command {Command.FullName()} is missing permission flags and cannot be executed.");
} }
public string? Expression { get; set; } public string? Expression { get; set; }
@@ -671,7 +671,7 @@ public record struct NoPermissionError(CommandSpec Command) : IConError
{ {
public FormattedMessage DescribeInner() public FormattedMessage DescribeInner()
{ {
return FormattedMessage.FromMarkup($"You do not have permission to execute {Command.FullName()}"); return FormattedMessage.FromMarkupOrThrow($"You do not have permission to execute {Command.FullName()}");
} }
public string? Expression { get; set; } public string? Expression { get; set; }

View File

@@ -119,12 +119,12 @@ public sealed partial class CargoSystem
msg.PushNewline(); msg.PushNewline();
foreach (var entry in prototype.Entries) foreach (var entry in prototype.Entries)
{ {
msg.AddMarkup($"- {Loc.GetString("bounty-console-manifest-entry", msg.AddMarkupOrThrow($"- {Loc.GetString("bounty-console-manifest-entry",
("amount", entry.Amount), ("amount", entry.Amount),
("item", Loc.GetString(entry.Name)))}"); ("item", Loc.GetString(entry.Name)))}");
msg.PushNewline(); msg.PushNewline();
} }
msg.AddMarkup(Loc.GetString("bounty-console-manifest-reward", ("reward", prototype.Reward))); msg.AddMarkupOrThrow(Loc.GetString("bounty-console-manifest-reward", ("reward", prototype.Reward)));
_paperSystem.SetContent((uid, paper), msg.ToMarkup()); _paperSystem.SetContent((uid, paper), msg.ToMarkup());
} }

View File

@@ -495,7 +495,7 @@ public sealed partial class ChatSystem : SharedChatSystem
if (!_actionBlocker.CanSpeak(source) && !ignoreActionBlocker) if (!_actionBlocker.CanSpeak(source) && !ignoreActionBlocker)
return; return;
var message = TransformSpeech(source, FormattedMessage.RemoveMarkup(originalMessage)); var message = TransformSpeech(source, FormattedMessage.RemoveMarkupOrThrow(originalMessage));
if (message.Length == 0) if (message.Length == 0)
return; return;
@@ -593,7 +593,7 @@ public sealed partial class ChatSystem : SharedChatSystem
var wrappedMessage = Loc.GetString("chat-manager-entity-me-wrap-message", var wrappedMessage = Loc.GetString("chat-manager-entity-me-wrap-message",
("entityName", name), ("entityName", name),
("entity", ent), ("entity", ent),
("message", FormattedMessage.RemoveMarkup(action))); ("message", FormattedMessage.RemoveMarkupOrThrow(action)));
if (checkEmote) if (checkEmote)
TryEmoteChatInput(source, action); TryEmoteChatInput(source, action);

View File

@@ -1,4 +1,4 @@
using Content.Shared.Examine; using Content.Shared.Examine;
using Content.Shared.IdentityManagement; using Content.Shared.IdentityManagement;
using Content.Shared.Verbs; using Content.Shared.Verbs;
using Robust.Shared.Utility; using Robust.Shared.Utility;
@@ -28,7 +28,7 @@ namespace Content.Server.DetailExaminable
Act = () => Act = () =>
{ {
var markup = new FormattedMessage(); var markup = new FormattedMessage();
markup.AddMarkup(component.Content); markup.AddMarkupOrThrow(component.Content);
_examineSystem.SendExamineTooltip(args.User, uid, markup, false, false); _examineSystem.SendExamineTooltip(args.User, uid, markup, false, false);
}, },
Text = Loc.GetString("detail-examinable-verb-text"), Text = Loc.GetString("detail-examinable-verb-text"),

View File

@@ -71,7 +71,7 @@ public sealed class DragonRiftSystem : EntitySystem
Dirty(uid, comp); Dirty(uid, comp);
var msg = Loc.GetString("carp-rift-warning", var msg = Loc.GetString("carp-rift-warning",
("location", FormattedMessage.RemoveMarkup(_navMap.GetNearestBeaconString((uid, xform))))); ("location", FormattedMessage.RemoveMarkupOrThrow(_navMap.GetNearestBeaconString((uid, xform)))));
_chat.DispatchGlobalAnnouncement(msg, playSound: false, colorOverride: Color.Red); _chat.DispatchGlobalAnnouncement(msg, playSound: false, colorOverride: Color.Red);
_audio.PlayGlobal("/Audio/Misc/notice1.ogg", Filter.Broadcast(), true); _audio.PlayGlobal("/Audio/Misc/notice1.ogg", Filter.Broadcast(), true);
_navMap.SetBeaconEnabled(uid, true); _navMap.SetBeaconEnabled(uid, true);

View File

@@ -211,7 +211,7 @@ namespace Content.Server.Explosion.EntitySystems
return; return;
// Gets location of the implant // Gets location of the implant
var posText = FormattedMessage.RemoveMarkup(_navMap.GetNearestBeaconString(uid)); var posText = FormattedMessage.RemoveMarkupOrThrow(_navMap.GetNearestBeaconString(uid));
var critMessage = Loc.GetString(component.CritMessage, ("user", implanted.ImplantedEntity.Value), ("position", posText)); var critMessage = Loc.GetString(component.CritMessage, ("user", implanted.ImplantedEntity.Value), ("position", posText));
var deathMessage = Loc.GetString(component.DeathMessage, ("user", implanted.ImplantedEntity.Value), ("position", posText)); var deathMessage = Loc.GetString(component.DeathMessage, ("user", implanted.ImplantedEntity.Value), ("position", posText));

View File

@@ -138,7 +138,7 @@ public sealed class GatewayGeneratorSystem : EntitySystem
// Create the gateway. // Create the gateway.
var gatewayUid = SpawnAtPosition(generator.Proto, originCoords); var gatewayUid = SpawnAtPosition(generator.Proto, originCoords);
var gatewayComp = Comp<GatewayComponent>(gatewayUid); var gatewayComp = Comp<GatewayComponent>(gatewayUid);
_gateway.SetDestinationName(gatewayUid, FormattedMessage.FromMarkup($"[color=#D381C996]{gatewayName}[/color]"), gatewayComp); _gateway.SetDestinationName(gatewayUid, FormattedMessage.FromMarkupOrThrow($"[color=#D381C996]{gatewayName}[/color]"), gatewayComp);
_gateway.SetEnabled(gatewayUid, true, gatewayComp); _gateway.SetEnabled(gatewayUid, true, gatewayComp);
generator.Generated.Add(mapUid); generator.Generated.Add(mapUid);
} }

View File

@@ -124,7 +124,7 @@ namespace Content.Server.Nuke
} }
codesMessage.PushNewline(); codesMessage.PushNewline();
codesMessage.AddMarkup(Loc.GetString("nuke-codes-list", ("name", MetaData(nukeUid).EntityName), ("code", nuke.Code))); codesMessage.AddMarkupOrThrow(Loc.GetString("nuke-codes-list", ("name", MetaData(nukeUid).EntityName), ("code", nuke.Code)));
break; break;
} }

View File

@@ -461,7 +461,7 @@ public sealed class NukeSystem : EntitySystem
// warn a crew // warn a crew
var announcement = Loc.GetString("nuke-component-announcement-armed", var announcement = Loc.GetString("nuke-component-announcement-armed",
("time", (int) component.RemainingTime), ("time", (int) component.RemainingTime),
("location", FormattedMessage.RemoveMarkup(_navMap.GetNearestBeaconString((uid, nukeXform))))); ("location", FormattedMessage.RemoveMarkupOrThrow(_navMap.GetNearestBeaconString((uid, nukeXform)))));
var sender = Loc.GetString("nuke-component-announcement-sender"); var sender = Loc.GetString("nuke-component-announcement-sender");
_chatSystem.DispatchStationAnnouncement(stationUid ?? uid, announcement, sender, false, null, Color.Red); _chatSystem.DispatchStationAnnouncement(stationUid ?? uid, announcement, sender, false, null, Color.Red);

View File

@@ -1,4 +1,4 @@
using System.Linq; using System.Linq;
using Content.Shared.FixedPoint; using Content.Shared.FixedPoint;
using Content.Shared.Points; using Content.Shared.Points;
using JetBrains.Annotations; using JetBrains.Annotations;
@@ -76,7 +76,7 @@ public sealed class PointSystem : SharedPointSystem
if (!_player.TryGetPlayerData(id, out var data)) if (!_player.TryGetPlayerData(id, out var data))
continue; continue;
msg.AddMarkup(Loc.GetString("point-scoreboard-list", msg.AddMarkupOrThrow(Loc.GetString("point-scoreboard-list",
("place", place), ("place", place),
("name", data.UserName), ("name", data.UserName),
("points", points.Int()))); ("points", points.Int())));

View File

@@ -31,7 +31,7 @@ namespace Content.Server.Power.EntitySystems
if (args.Handled || args.Target == null || !args.CanReach || !_toolSystem.HasQuality(args.Used, SharedToolSystem.PulseQuality)) if (args.Handled || args.Target == null || !args.CanReach || !_toolSystem.HasQuality(args.Used, SharedToolSystem.PulseQuality))
return; return;
var markup = FormattedMessage.FromMarkup(GenerateCableMarkup(uid)); var markup = FormattedMessage.FromMarkupOrThrow(GenerateCableMarkup(uid));
_examineSystem.SendExamineTooltip(args.User, uid, markup, false, false); _examineSystem.SendExamineTooltip(args.User, uid, markup, false, false);
args.Handled = true; args.Handled = true;
} }
@@ -56,7 +56,7 @@ namespace Content.Server.Power.EntitySystems
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/zap.svg.192dpi.png")), Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/zap.svg.192dpi.png")),
Act = () => Act = () =>
{ {
var markup = FormattedMessage.FromMarkup(GenerateCableMarkup(uid)); var markup = FormattedMessage.FromMarkupOrThrow(GenerateCableMarkup(uid));
_examineSystem.SendExamineTooltip(args.User, uid, markup, false, false); _examineSystem.SendExamineTooltip(args.User, uid, markup, false, false);
} }
}; };

View File

@@ -1,4 +1,4 @@
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
using Content.Server.Administration; using Content.Server.Administration;
using Content.Server.Cargo.Systems; using Content.Server.Cargo.Systems;
@@ -128,7 +128,7 @@ public record struct OnlyOneStationsError : IConError
{ {
public FormattedMessage DescribeInner() public FormattedMessage DescribeInner()
{ {
return FormattedMessage.FromMarkup("This command doesn't function if there is more than one or no stations, explicitly specify a station with the ent command or similar."); return FormattedMessage.FromMarkupOrThrow("This command doesn't function if there is more than one or no stations, explicitly specify a station with the ent command or similar.");
} }
public string? Expression { get; set; } public string? Expression { get; set; }

View File

@@ -79,7 +79,7 @@ public sealed class TraitorCodePaperSystem : EntitySystem
break; break;
codesMessage.PushNewline(); codesMessage.PushNewline();
codesMessage.AddMarkup(code); codesMessage.AddMarkupOrThrow(code);
} }
if (!codesMessage.IsEmpty) if (!codesMessage.IsEmpty)

View File

@@ -304,15 +304,15 @@ public sealed class ArtifactAnalyzerSystem : EntitySystem
var n = component.LastAnalyzedNode; var n = component.LastAnalyzedNode;
msg.AddMarkup(Loc.GetString("analysis-console-info-id", ("id", n.Id))); msg.AddMarkupOrThrow(Loc.GetString("analysis-console-info-id", ("id", n.Id)));
msg.PushNewline(); msg.PushNewline();
msg.AddMarkup(Loc.GetString("analysis-console-info-depth", ("depth", n.Depth))); msg.AddMarkupOrThrow(Loc.GetString("analysis-console-info-depth", ("depth", n.Depth)));
msg.PushNewline(); msg.PushNewline();
var activated = n.Triggered var activated = n.Triggered
? "analysis-console-info-triggered-true" ? "analysis-console-info-triggered-true"
: "analysis-console-info-triggered-false"; : "analysis-console-info-triggered-false";
msg.AddMarkup(Loc.GetString(activated)); msg.AddMarkupOrThrow(Loc.GetString(activated));
msg.PushNewline(); msg.PushNewline();
msg.PushNewline(); msg.PushNewline();
@@ -321,7 +321,7 @@ public sealed class ArtifactAnalyzerSystem : EntitySystem
var triggerProto = _prototype.Index<ArtifactTriggerPrototype>(n.Trigger); var triggerProto = _prototype.Index<ArtifactTriggerPrototype>(n.Trigger);
if (triggerProto.TriggerHint != null) if (triggerProto.TriggerHint != null)
{ {
msg.AddMarkup(Loc.GetString("analysis-console-info-trigger", msg.AddMarkupOrThrow(Loc.GetString("analysis-console-info-trigger",
("trigger", Loc.GetString(triggerProto.TriggerHint))) + "\n"); ("trigger", Loc.GetString(triggerProto.TriggerHint))) + "\n");
needSecondNewline = true; needSecondNewline = true;
} }
@@ -329,7 +329,7 @@ public sealed class ArtifactAnalyzerSystem : EntitySystem
var effectproto = _prototype.Index<ArtifactEffectPrototype>(n.Effect); var effectproto = _prototype.Index<ArtifactEffectPrototype>(n.Effect);
if (effectproto.EffectHint != null) if (effectproto.EffectHint != null)
{ {
msg.AddMarkup(Loc.GetString("analysis-console-info-effect", msg.AddMarkupOrThrow(Loc.GetString("analysis-console-info-effect",
("effect", Loc.GetString(effectproto.EffectHint))) + "\n"); ("effect", Loc.GetString(effectproto.EffectHint))) + "\n");
needSecondNewline = true; needSecondNewline = true;
} }
@@ -337,11 +337,11 @@ public sealed class ArtifactAnalyzerSystem : EntitySystem
if (needSecondNewline) if (needSecondNewline)
msg.PushNewline(); msg.PushNewline();
msg.AddMarkup(Loc.GetString("analysis-console-info-edges", ("edges", n.Edges.Count))); msg.AddMarkupOrThrow(Loc.GetString("analysis-console-info-edges", ("edges", n.Edges.Count)));
msg.PushNewline(); msg.PushNewline();
if (component.LastAnalyzerPointValue != null) if (component.LastAnalyzerPointValue != null)
msg.AddMarkup(Loc.GetString("analysis-console-info-value", ("value", component.LastAnalyzerPointValue))); msg.AddMarkupOrThrow(Loc.GetString("analysis-console-info-value", ("value", component.LastAnalyzerPointValue)));
return msg; return msg;
} }

View File

@@ -75,7 +75,7 @@ namespace Content.Shared.Examine
if (group.Title != null) if (group.Title != null)
{ {
message.AddMarkup(Loc.GetString(group.Title)); message.AddMarkupOrThrow(Loc.GetString(group.Title));
message.PushNewline(); message.PushNewline();
} }
message.AddMessage(GetFormattedMessageFromExamineEntries(group.Entries)); message.AddMessage(GetFormattedMessageFromExamineEntries(group.Entries));

View File

@@ -447,7 +447,7 @@ namespace Content.Shared.Examine
/// <seealso cref="PushMessage"/> /// <seealso cref="PushMessage"/>
public void PushMarkup(string markup, int priority=0) public void PushMarkup(string markup, int priority=0)
{ {
PushMessage(FormattedMessage.FromMarkup(markup), priority); PushMessage(FormattedMessage.FromMarkupOrThrow(markup), priority);
} }
/// <summary> /// <summary>
@@ -495,7 +495,7 @@ namespace Content.Shared.Examine
/// <seealso cref="AddMessage"/> /// <seealso cref="AddMessage"/>
public void AddMarkup(string markup, int priority=0) public void AddMarkup(string markup, int priority=0)
{ {
AddMessage(FormattedMessage.FromMarkup(markup), priority); AddMessage(FormattedMessage.FromMarkupOrThrow(markup), priority);
} }
/// <summary> /// <summary>

View File

@@ -1,4 +1,4 @@
using Content.Shared.Damage; using Content.Shared.Damage;
using Content.Shared.Examine; using Content.Shared.Examine;
using Content.Shared.FixedPoint; using Content.Shared.FixedPoint;
using Content.Shared.IdentityManagement; using Content.Shared.IdentityManagement;
@@ -85,12 +85,12 @@ public sealed class HealthExaminableSystem : EntitySystem
{ {
first = false; first = false;
} }
msg.AddMarkup(chosenLocStr); msg.AddMarkupOrThrow(chosenLocStr);
} }
if (msg.IsEmpty) if (msg.IsEmpty)
{ {
msg.AddMarkup(Loc.GetString($"health-examinable-{component.LocPrefix}-none")); msg.AddMarkupOrThrow(Loc.GetString($"health-examinable-{component.LocPrefix}-none"));
} }
// Anything else want to add on to this? // Anything else want to add on to this?

View File

@@ -541,11 +541,11 @@ namespace Content.Shared.Preferences
string flavortext; string flavortext;
if (FlavorText.Length > MaxDescLength) if (FlavorText.Length > MaxDescLength)
{ {
flavortext = FormattedMessage.RemoveMarkup(FlavorText)[..MaxDescLength]; flavortext = FormattedMessage.RemoveMarkupOrThrow(FlavorText)[..MaxDescLength];
} }
else else
{ {
flavortext = FormattedMessage.RemoveMarkup(FlavorText); flavortext = FormattedMessage.RemoveMarkupOrThrow(FlavorText);
} }
var appearance = HumanoidCharacterAppearance.EnsureValid(Appearance, Species, Sex); var appearance = HumanoidCharacterAppearance.EnsureValid(Appearance, Species, Sex);

View File

@@ -26,7 +26,7 @@ public sealed partial class GroupLoadoutEffect : LoadoutEffect
reasons.Add(reason.ToMarkup()); reasons.Add(reason.ToMarkup());
} }
reason = reasons.Count == 0 ? null : FormattedMessage.FromMarkup(string.Join('\n', reasons)); reason = reasons.Count == 0 ? null : FormattedMessage.FromMarkupOrThrow(string.Join('\n', reasons));
return reason == null; return reason == null;
} }
} }

View File

@@ -233,7 +233,7 @@ public sealed partial class RoleLoadout : IEquatable<RoleLoadout>
if (!protoManager.TryIndex(loadout, out var loadoutProto)) if (!protoManager.TryIndex(loadout, out var loadoutProto))
{ {
// Uhh // Uhh
reason = FormattedMessage.FromMarkup(""); reason = FormattedMessage.FromMarkupOrThrow("");
return false; return false;
} }

View File

@@ -1,4 +1,4 @@
using System.Linq; using System.Linq;
using Content.Shared.Lathe; using Content.Shared.Lathe;
using Content.Shared.Research.Components; using Content.Shared.Research.Components;
using Content.Shared.Research.Prototypes; using Content.Shared.Research.Prototypes;
@@ -157,42 +157,42 @@ public abstract class SharedResearchSystem : EntitySystem
if (includeTier) if (includeTier)
{ {
disciplinePrototype ??= PrototypeManager.Index(technology.Discipline); disciplinePrototype ??= PrototypeManager.Index(technology.Discipline);
description.AddMarkup(Loc.GetString("research-console-tier-discipline-info", description.AddMarkupOrThrow(Loc.GetString("research-console-tier-discipline-info",
("tier", technology.Tier), ("color", disciplinePrototype.Color), ("discipline", Loc.GetString(disciplinePrototype.Name)))); ("tier", technology.Tier), ("color", disciplinePrototype.Color), ("discipline", Loc.GetString(disciplinePrototype.Name))));
description.PushNewline(); description.PushNewline();
} }
if (includeCost) if (includeCost)
{ {
description.AddMarkup(Loc.GetString("research-console-cost", ("amount", technology.Cost))); description.AddMarkupOrThrow(Loc.GetString("research-console-cost", ("amount", technology.Cost)));
description.PushNewline(); description.PushNewline();
} }
if (includePrereqs && technology.TechnologyPrerequisites.Any()) if (includePrereqs && technology.TechnologyPrerequisites.Any())
{ {
description.AddMarkup(Loc.GetString("research-console-prereqs-list-start")); description.AddMarkupOrThrow(Loc.GetString("research-console-prereqs-list-start"));
foreach (var recipe in technology.TechnologyPrerequisites) foreach (var recipe in technology.TechnologyPrerequisites)
{ {
var techProto = PrototypeManager.Index(recipe); var techProto = PrototypeManager.Index(recipe);
description.PushNewline(); description.PushNewline();
description.AddMarkup(Loc.GetString("research-console-prereqs-list-entry", description.AddMarkupOrThrow(Loc.GetString("research-console-prereqs-list-entry",
("text", Loc.GetString(techProto.Name)))); ("text", Loc.GetString(techProto.Name))));
} }
description.PushNewline(); description.PushNewline();
} }
description.AddMarkup(Loc.GetString("research-console-unlocks-list-start")); description.AddMarkupOrThrow(Loc.GetString("research-console-unlocks-list-start"));
foreach (var recipe in technology.RecipeUnlocks) foreach (var recipe in technology.RecipeUnlocks)
{ {
var recipeProto = PrototypeManager.Index(recipe); var recipeProto = PrototypeManager.Index(recipe);
description.PushNewline(); description.PushNewline();
description.AddMarkup(Loc.GetString("research-console-unlocks-list-entry", description.AddMarkupOrThrow(Loc.GetString("research-console-unlocks-list-entry",
("name", _lathe.GetRecipeName(recipeProto)))); ("name", _lathe.GetRecipeName(recipeProto))));
} }
foreach (var generic in technology.GenericUnlocks) foreach (var generic in technology.GenericUnlocks)
{ {
description.PushNewline(); description.PushNewline();
description.AddMarkup(Loc.GetString("research-console-unlocks-list-entry-generic", description.AddMarkupOrThrow(Loc.GetString("research-console-unlocks-list-entry-generic",
("text", Loc.GetString(generic.UnlockDescription)))); ("text", Loc.GetString(generic.UnlockDescription))));
} }