From ee922e37f6539a5c3da94e76a1a0efef4c8e2b59 Mon Sep 17 00:00:00 2001 From: beck-thompson <107373427+beck-thompson@users.noreply.github.com> Date: Sat, 10 Aug 2024 20:06:33 -0700 Subject: [PATCH] Replaced some AddMarkups with AddMarkupOrThrow (#30632) * First commit * Silly me * bruh --- Content.Client/Anomaly/Ui/AnomalyScannerMenu.xaml.cs | 2 +- Content.Server/Anomaly/AnomalySystem.Scanner.cs | 2 +- Content.Server/Body/Systems/BloodstreamSystem.cs | 6 +++--- Content.Shared/Armor/SharedArmorSystem.cs | 7 +++---- Content.Shared/Blocking/BlockingSystem.cs | 7 +++---- .../EntitySystems/SharedSolutionContainerSystem.cs | 8 ++++---- Content.Shared/Damage/Systems/DamageExamineSystem.cs | 6 +++--- 7 files changed, 18 insertions(+), 20 deletions(-) diff --git a/Content.Client/Anomaly/Ui/AnomalyScannerMenu.xaml.cs b/Content.Client/Anomaly/Ui/AnomalyScannerMenu.xaml.cs index 14726952d1..c012edb89e 100644 --- a/Content.Client/Anomaly/Ui/AnomalyScannerMenu.xaml.cs +++ b/Content.Client/Anomaly/Ui/AnomalyScannerMenu.xaml.cs @@ -31,7 +31,7 @@ public sealed partial class AnomalyScannerMenu : FancyWindow msg.PushNewline(); var time = NextPulseTime.Value - _timing.CurTime; var timestring = $"{time.Minutes:00}:{time.Seconds:00}"; - msg.AddMarkup(Loc.GetString("anomaly-scanner-pulse-timer", ("time", timestring))); + msg.AddMarkupOrThrow(Loc.GetString("anomaly-scanner-pulse-timer", ("time", timestring))); } TextDisplay.SetMarkup(msg.ToMarkup()); diff --git a/Content.Server/Anomaly/AnomalySystem.Scanner.cs b/Content.Server/Anomaly/AnomalySystem.Scanner.cs index 65d79de60c..9d81878cd8 100644 --- a/Content.Server/Anomaly/AnomalySystem.Scanner.cs +++ b/Content.Server/Anomaly/AnomalySystem.Scanner.cs @@ -217,7 +217,7 @@ public sealed partial class AnomalySystem msg.PushNewline(); if (secret != null && secret.Secret.Contains(AnomalySecretData.Behavior)) - msg.AddMarkup(Loc.GetString("anomaly-behavior-unknown")); + msg.AddMarkupOrThrow(Loc.GetString("anomaly-behavior-unknown")); else { if (anomalyComp.CurrentBehavior != null) diff --git a/Content.Server/Body/Systems/BloodstreamSystem.cs b/Content.Server/Body/Systems/BloodstreamSystem.cs index 9647634a9e..67246825fe 100644 --- a/Content.Server/Body/Systems/BloodstreamSystem.cs +++ b/Content.Server/Body/Systems/BloodstreamSystem.cs @@ -255,20 +255,20 @@ public sealed class BloodstreamSystem : EntitySystem if (ent.Comp.BleedAmount > ent.Comp.MaxBleedAmount / 2) { args.Message.PushNewline(); - args.Message.AddMarkup(Loc.GetString("bloodstream-component-profusely-bleeding", ("target", ent.Owner))); + args.Message.AddMarkupOrThrow(Loc.GetString("bloodstream-component-profusely-bleeding", ("target", ent.Owner))); } // Shows bleeding message when bleeding, but less than profusely. else if (ent.Comp.BleedAmount > 0) { args.Message.PushNewline(); - args.Message.AddMarkup(Loc.GetString("bloodstream-component-bleeding", ("target", ent.Owner))); + args.Message.AddMarkupOrThrow(Loc.GetString("bloodstream-component-bleeding", ("target", ent.Owner))); } // If the mob's blood level is below the damage threshhold, the pale message is added. if (GetBloodLevelPercentage(ent, ent) < ent.Comp.BloodlossThreshold) { args.Message.PushNewline(); - args.Message.AddMarkup(Loc.GetString("bloodstream-component-looks-pale", ("target", ent.Owner))); + args.Message.AddMarkupOrThrow(Loc.GetString("bloodstream-component-looks-pale", ("target", ent.Owner))); } } diff --git a/Content.Shared/Armor/SharedArmorSystem.cs b/Content.Shared/Armor/SharedArmorSystem.cs index 73cb6da2c2..010ee5e65b 100644 --- a/Content.Shared/Armor/SharedArmorSystem.cs +++ b/Content.Shared/Armor/SharedArmorSystem.cs @@ -53,15 +53,14 @@ public abstract class SharedArmorSystem : EntitySystem private FormattedMessage GetArmorExamine(DamageModifierSet armorModifiers) { var msg = new FormattedMessage(); - - msg.AddMarkup(Loc.GetString("armor-examine")); + msg.AddMarkupOrThrow(Loc.GetString("armor-examine")); foreach (var coefficientArmor in armorModifiers.Coefficients) { msg.PushNewline(); var armorType = Loc.GetString("armor-damage-type-" + coefficientArmor.Key.ToLower()); - msg.AddMarkup(Loc.GetString("armor-coefficient-value", + msg.AddMarkupOrThrow(Loc.GetString("armor-coefficient-value", ("type", armorType), ("value", MathF.Round((1f - coefficientArmor.Value) * 100, 1)) )); @@ -72,7 +71,7 @@ public abstract class SharedArmorSystem : EntitySystem msg.PushNewline(); var armorType = Loc.GetString("armor-damage-type-" + flatArmor.Key.ToLower()); - msg.AddMarkup(Loc.GetString("armor-reduction-value", + msg.AddMarkupOrThrow(Loc.GetString("armor-reduction-value", ("type", armorType), ("value", flatArmor.Value) )); diff --git a/Content.Shared/Blocking/BlockingSystem.cs b/Content.Shared/Blocking/BlockingSystem.cs index 3e1ff4284c..594d1baf6c 100644 --- a/Content.Shared/Blocking/BlockingSystem.cs +++ b/Content.Shared/Blocking/BlockingSystem.cs @@ -320,8 +320,7 @@ public sealed partial class BlockingSystem : EntitySystem var modifier = component.IsBlocking ? component.ActiveBlockDamageModifier : component.PassiveBlockDamageModifer; var msg = new FormattedMessage(); - - msg.AddMarkup(Loc.GetString("blocking-fraction", ("value", MathF.Round(fraction * 100, 1)))); + msg.AddMarkupOrThrow(Loc.GetString("blocking-fraction", ("value", MathF.Round(fraction * 100, 1)))); AppendCoefficients(modifier, msg); @@ -337,7 +336,7 @@ public sealed partial class BlockingSystem : EntitySystem foreach (var coefficient in modifiers.Coefficients) { msg.PushNewline(); - msg.AddMarkup(Robust.Shared.Localization.Loc.GetString("blocking-coefficient-value", + msg.AddMarkupOrThrow(Robust.Shared.Localization.Loc.GetString("blocking-coefficient-value", ("type", coefficient.Key), ("value", MathF.Round(coefficient.Value * 100, 1)) )); @@ -346,7 +345,7 @@ public sealed partial class BlockingSystem : EntitySystem foreach (var flat in modifiers.FlatReduction) { msg.PushNewline(); - msg.AddMarkup(Robust.Shared.Localization.Loc.GetString("blocking-reduction-value", + msg.AddMarkupOrThrow(Robust.Shared.Localization.Loc.GetString("blocking-reduction-value", ("type", flat.Key), ("value", flat.Value) )); diff --git a/Content.Shared/Chemistry/EntitySystems/SharedSolutionContainerSystem.cs b/Content.Shared/Chemistry/EntitySystems/SharedSolutionContainerSystem.cs index ad9cd01fbf..9e5e24b3e4 100644 --- a/Content.Shared/Chemistry/EntitySystems/SharedSolutionContainerSystem.cs +++ b/Content.Shared/Chemistry/EntitySystems/SharedSolutionContainerSystem.cs @@ -903,11 +903,11 @@ public abstract partial class SharedSolutionContainerSystem : EntitySystem if (solution.Volume == 0) { - msg.AddMarkup(Loc.GetString("scannable-solution-empty-container")); + msg.AddMarkupOrThrow(Loc.GetString("scannable-solution-empty-container")); return msg; } - msg.AddMarkup(Loc.GetString("scannable-solution-main-text")); + msg.AddMarkupOrThrow(Loc.GetString("scannable-solution-main-text")); var reagentPrototypes = solution.GetReagentPrototypes(PrototypeManager); @@ -919,14 +919,14 @@ public abstract partial class SharedSolutionContainerSystem : EntitySystem foreach (var (proto, quantity) in sortedReagentPrototypes) { msg.PushNewline(); - msg.AddMarkup(Loc.GetString("scannable-solution-chemical" + msg.AddMarkupOrThrow(Loc.GetString("scannable-solution-chemical" , ("type", proto.LocalizedName) , ("color", proto.SubstanceColor.ToHexNoAlpha()) , ("amount", quantity))); } msg.PushNewline(); - msg.AddMarkup(Loc.GetString("scannable-solution-temperature", ("temperature", Math.Round(solution.Temperature)))); + msg.AddMarkupOrThrow(Loc.GetString("scannable-solution-temperature", ("temperature", Math.Round(solution.Temperature)))); return msg; } diff --git a/Content.Shared/Damage/Systems/DamageExamineSystem.cs b/Content.Shared/Damage/Systems/DamageExamineSystem.cs index fd1f191334..53436a920a 100644 --- a/Content.Shared/Damage/Systems/DamageExamineSystem.cs +++ b/Content.Shared/Damage/Systems/DamageExamineSystem.cs @@ -57,11 +57,11 @@ public sealed class DamageExamineSystem : EntitySystem if (string.IsNullOrEmpty(type)) { - msg.AddMarkup(Loc.GetString("damage-examine")); + msg.AddMarkupOrThrow(Loc.GetString("damage-examine")); } else { - msg.AddMarkup(Loc.GetString("damage-examine-type", ("type", type))); + msg.AddMarkupOrThrow(Loc.GetString("damage-examine-type", ("type", type))); } foreach (var damage in damageSpecifier.DamageDict) @@ -69,7 +69,7 @@ public sealed class DamageExamineSystem : EntitySystem if (damage.Value != FixedPoint2.Zero) { msg.PushNewline(); - msg.AddMarkup(Loc.GetString("damage-value", ("type", _prototype.Index(damage.Key).LocalizedName), ("amount", damage.Value))); + msg.AddMarkupOrThrow(Loc.GetString("damage-value", ("type", _prototype.Index(damage.Key).LocalizedName), ("amount", damage.Value))); } }