diff --git a/Content.Client/Access/UI/IdCardConsoleWindow.xaml.cs b/Content.Client/Access/UI/IdCardConsoleWindow.xaml.cs index e4594856f9..66e8437841 100644 --- a/Content.Client/Access/UI/IdCardConsoleWindow.xaml.cs +++ b/Content.Client/Access/UI/IdCardConsoleWindow.xaml.cs @@ -75,7 +75,7 @@ namespace Content.Client.Access.UI var newButton = new Button { - Text = accessLevel.Name, + Text = GetAccessLevelName(accessLevel), ToggleMode = true, }; AccessLevelGrid.AddChild(newButton); @@ -84,6 +84,14 @@ namespace Content.Client.Access.UI } } + private static string GetAccessLevelName(AccessLevelPrototype prototype) + { + if (prototype.Name is { } name) + return Loc.GetString(name); + + return prototype.ID; + } + private void ClearAllAccess() { foreach (var button in _accessButtons.Values) diff --git a/Content.Client/Administration/UI/Tabs/AtmosTab/AddGasWindow.xaml.cs b/Content.Client/Administration/UI/Tabs/AtmosTab/AddGasWindow.xaml.cs index 92c34dfef8..55db123ea6 100644 --- a/Content.Client/Administration/UI/Tabs/AtmosTab/AddGasWindow.xaml.cs +++ b/Content.Client/Administration/UI/Tabs/AtmosTab/AddGasWindow.xaml.cs @@ -39,7 +39,8 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab _gasData = EntitySystem.Get().Gases; foreach (var gas in _gasData) { - GasOptions.AddItem($"{gas.Name} ({gas.ID})"); + var gasName = Loc.GetString(gas.Name); + GasOptions.AddItem($"{gasName} ({gas.ID})"); } GasOptions.OnItemSelected += eventArgs => GasOptions.SelectId(eventArgs.Id); diff --git a/Content.Client/Administration/UI/Tabs/AtmosTab/FillGasWindow.xaml.cs b/Content.Client/Administration/UI/Tabs/AtmosTab/FillGasWindow.xaml.cs index e9f5adac88..34212ac6d3 100644 --- a/Content.Client/Administration/UI/Tabs/AtmosTab/FillGasWindow.xaml.cs +++ b/Content.Client/Administration/UI/Tabs/AtmosTab/FillGasWindow.xaml.cs @@ -39,7 +39,8 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab _gasData = EntitySystem.Get().Gases; foreach (var gas in _gasData) { - GasOptions.AddItem($"{gas.Name} ({gas.ID})"); + var gasName = Loc.GetString(gas.Name); + GasOptions.AddItem($"{gasName} ({gas.ID})"); } GasOptions.OnItemSelected += eventArgs => GasOptions.SelectId(eventArgs.Id); diff --git a/Content.Client/Atmos/UI/GasFilterBoundUserInterface.cs b/Content.Client/Atmos/UI/GasFilterBoundUserInterface.cs index bde3111516..a0daf9c654 100644 --- a/Content.Client/Atmos/UI/GasFilterBoundUserInterface.cs +++ b/Content.Client/Atmos/UI/GasFilterBoundUserInterface.cs @@ -85,7 +85,8 @@ namespace Content.Client.Atmos.UI { var atmos = IoCManager.Resolve().GetEntitySystem(); var gas = atmos.GetGas((Gas) cast.FilteredGas); - _window.SetGasFiltered(gas.ID, gas.Name); + var gasName = Loc.GetString(gas.Name); + _window.SetGasFiltered(gas.ID, gasName); } else { diff --git a/Content.Client/Atmos/UI/GasFilterWindow.xaml.cs b/Content.Client/Atmos/UI/GasFilterWindow.xaml.cs index cd5212b996..cd2f8075b9 100644 --- a/Content.Client/Atmos/UI/GasFilterWindow.xaml.cs +++ b/Content.Client/Atmos/UI/GasFilterWindow.xaml.cs @@ -83,7 +83,8 @@ namespace Content.Client.Atmos.UI foreach (GasPrototype gas in gases) { - GasList.Add(GetGasItem(gas.ID, gas.Name, GasList)); + var gasName = Loc.GetString(gas.Name); + GasList.Add(GetGasItem(gas.ID, gasName, GasList)); } } diff --git a/Content.Client/Construction/UI/ConstructionMenuPresenter.cs b/Content.Client/Construction/UI/ConstructionMenuPresenter.cs index d5c2147ea9..946306b329 100644 --- a/Content.Client/Construction/UI/ConstructionMenuPresenter.cs +++ b/Content.Client/Construction/UI/ConstructionMenuPresenter.cs @@ -154,7 +154,7 @@ namespace Content.Client.Construction.UI continue; } - if (!string.IsNullOrEmpty(category) && category != Loc.GetString("construction-category-all")) + if (!string.IsNullOrEmpty(category) && category != "construction-category-all") { if (recipe.Category != category) continue; @@ -178,7 +178,7 @@ namespace Content.Client.Construction.UI var uniqueCategories = new HashSet(); // hard-coded to show all recipes - uniqueCategories.Add(Loc.GetString("construction-category-all")); + uniqueCategories.Add("construction-category-all"); foreach (var prototype in _prototypeManager.EnumeratePrototypes()) { @@ -190,13 +190,13 @@ namespace Content.Client.Construction.UI _constructionView.Category.Clear(); - var array = uniqueCategories.ToArray(); + var array = uniqueCategories.OrderBy(Loc.GetString).ToArray(); Array.Sort(array); for (var i = 0; i < array.Length; i++) { var category = array[i]; - _constructionView.Category.AddItem(category, i); + _constructionView.Category.AddItem(Loc.GetString(category), i); } _constructionView.Categories = array; diff --git a/Content.Client/Lathe/UI/LatheMenu.xaml.cs b/Content.Client/Lathe/UI/LatheMenu.xaml.cs index 40bef0321b..ec8a203689 100644 --- a/Content.Client/Lathe/UI/LatheMenu.xaml.cs +++ b/Content.Client/Lathe/UI/LatheMenu.xaml.cs @@ -72,13 +72,10 @@ public sealed partial class LatheMenu : DefaultWindow { if (!_prototypeManager.TryIndex(id, out MaterialPrototype? material)) continue; - - if (amount > 0) - { - var mat = Loc.GetString("lathe-menu-material-display", - ("material", material.Name), ("amount", amount)); - Materials.AddItem(mat, _spriteSystem.Frame0(material.Icon), false); - } + var name = Loc.GetString(material.Name); + var mat = Loc.GetString("lathe-menu-material-display", + ("material", name), ("amount", amount)); + Materials.AddItem(mat, _spriteSystem.Frame0(material.Icon), false); } if (Materials.Count == 0) @@ -140,7 +137,7 @@ public sealed partial class LatheMenu : DefaultWindow sb.Append(adjustedAmount); sb.Append(' '); - sb.Append(proto.Name); + sb.Append(Loc.GetString(proto.Name)); } var icon = _spriteSystem.Frame0(prototype.Icon); diff --git a/Content.Client/Mapping/MappingSystem.cs b/Content.Client/Mapping/MappingSystem.cs index 0e08fcd70f..bf34ba3c6a 100644 --- a/Content.Client/Mapping/MappingSystem.cs +++ b/Content.Client/Mapping/MappingSystem.cs @@ -86,7 +86,7 @@ public sealed partial class MappingSystem : EntitySystem { CheckCanInteract = false, Event = actionEvent, - DisplayName = tileDef.Name, + DisplayName = Loc.GetString(tileDef.Name), Icon = tileIcon }; diff --git a/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs b/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs index 21908475a1..64af950e28 100644 --- a/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs +++ b/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs @@ -470,7 +470,7 @@ namespace Content.Client.Preferences.UI _antagPreferences = new List(); - foreach (var antag in prototypeManager.EnumeratePrototypes().OrderBy(a => a.Name)) + foreach (var antag in prototypeManager.EnumeratePrototypes().OrderBy(a => Loc.GetString(a.Name))) { if (!antag.SetPreference) { @@ -492,7 +492,7 @@ namespace Content.Client.Preferences.UI #region Traits - var traits = prototypeManager.EnumeratePrototypes().OrderBy(t => t.Name).ToList(); + var traits = prototypeManager.EnumeratePrototypes().OrderBy(t => Loc.GetString(t.Name)).ToList(); _traitPreferences = new List(); _tabContainer.SetTabTitle(3, Loc.GetString("humanoid-profile-editor-traits-tab")); @@ -1238,12 +1238,12 @@ namespace Content.Client.Preferences.UI { Antag = antag; - _checkBox = new CheckBox {Text = $"{antag.Name}"}; + _checkBox = new CheckBox {Text = Loc.GetString(antag.Name)}; _checkBox.OnToggled += OnCheckBoxToggled; if (antag.Description != null) { - _checkBox.ToolTip = antag.Description; + _checkBox.ToolTip = Loc.GetString(antag.Description); _checkBox.TooltipDelay = 0.2f; } @@ -1280,12 +1280,12 @@ namespace Content.Client.Preferences.UI { Trait = trait; - _checkBox = new CheckBox {Text = $"{trait.Name}"}; + _checkBox = new CheckBox {Text = Loc.GetString(trait.Name)}; _checkBox.OnToggled += OnCheckBoxToggled; - if (trait.Description != null) + if (trait.Description is { } desc) { - _checkBox.ToolTip = trait.Description; + _checkBox.ToolTip = Loc.GetString(desc); _checkBox.TooltipDelay = 0.2f; } diff --git a/Content.Client/Research/UI/ResearchConsoleMenu.xaml.cs b/Content.Client/Research/UI/ResearchConsoleMenu.xaml.cs index 7a2783dc80..bc7470e198 100644 --- a/Content.Client/Research/UI/ResearchConsoleMenu.xaml.cs +++ b/Content.Client/Research/UI/ResearchConsoleMenu.xaml.cs @@ -113,24 +113,33 @@ namespace Content.Client.Research.UI // For now, we retrieve all technologies. In the future, this should be changed. foreach (var tech in prototypeMan.EnumeratePrototypes()) { + var techName = GetTechName(tech); if (Owner.IsTechnologyUnlocked(tech)) { - UnlockedTechnologies.AddItem(tech.Name, tech.Icon.Frame0()); + UnlockedTechnologies.AddItem(techName, tech.Icon.Frame0()); _unlockedTechnologyPrototypes.Add(tech); } else if (Owner.CanUnlockTechnology(tech)) { - UnlockableTechnologies.AddItem(tech.Name, tech.Icon.Frame0()); + UnlockableTechnologies.AddItem(techName, tech.Icon.Frame0()); _unlockableTechnologyPrototypes.Add(tech); } else { - FutureTechnologies.AddItem(tech.Name, tech.Icon.Frame0()); + FutureTechnologies.AddItem(techName, tech.Icon.Frame0()); _futureTechnologyPrototypes.Add(tech); } } } + private string GetTechName(TechnologyPrototype prototype) + { + if (prototype.Name is { } name) + return Loc.GetString(name); + + return prototype.ID; + } + /// /// Fills the selected technology controls with details. /// @@ -145,8 +154,9 @@ namespace Content.Client.Research.UI } TechnologyIcon.Texture = TechnologySelected.Icon.Frame0(); - TechnologyName.Text = TechnologySelected.Name; - TechnologyDescription.Text = TechnologySelected.Description + $"\n{TechnologySelected.RequiredPoints} " + Loc.GetString("research-console-menu-research-points-text" ,("points", Owner.Points)).ToLowerInvariant(); + TechnologyName.Text = GetTechName(TechnologySelected); + var desc = Loc.GetString(TechnologySelected.Description); + TechnologyDescription.Text = desc + $"\n{TechnologySelected.RequiredPoints} " + Loc.GetString("research-console-menu-research-points-text" ,("points", Owner.Points)).ToLowerInvariant(); TechnologyRequirements.Text = Loc.GetString("research-console-tech-requirements-none"); var prototypeMan = IoCManager.Resolve(); @@ -155,10 +165,11 @@ namespace Content.Client.Research.UI { var requiredId = TechnologySelected.RequiredTechnologies[i]; if (!prototypeMan.TryIndex(requiredId, out TechnologyPrototype? prototype)) continue; + var protoName = GetTechName(prototype); if (i == 0) - TechnologyRequirements.Text = Loc.GetString("research-console-tech-requirements-prototype-name", ("prototypeName", prototype.Name)); + TechnologyRequirements.Text = Loc.GetString("research-console-tech-requirements-prototype-name", ("prototypeName", protoName)); else - TechnologyRequirements.Text += $", {prototype.Name}"; + TechnologyRequirements.Text += $", {protoName}"; } } diff --git a/Content.Client/UserInterface/Systems/Alerts/Controls/AlertControl.cs b/Content.Client/UserInterface/Systems/Alerts/Controls/AlertControl.cs index 51dd4c69b2..5c5466537b 100644 --- a/Content.Client/UserInterface/Systems/Alerts/Controls/AlertControl.cs +++ b/Content.Client/UserInterface/Systems/Alerts/Controls/AlertControl.cs @@ -4,6 +4,7 @@ using Content.Shared.Alert; using Robust.Client.UserInterface; using Robust.Client.UserInterface.Controls; using Robust.Shared.Timing; +using Robust.Shared.Utility; namespace Content.Client.UserInterface.Systems.Alerts.Controls { @@ -65,7 +66,9 @@ namespace Content.Client.UserInterface.Systems.Alerts.Controls private Control SupplyTooltip(Control? sender) { - return new ActionAlertTooltip(Alert.Name, Alert.Description) {Cooldown = Cooldown}; + var msg = FormattedMessage.FromMarkup(Loc.GetString(Alert.Name)); + var desc = FormattedMessage.FromMarkup(Loc.GetString(Alert.Description)); + return new ActionAlertTooltip(msg, desc) {Cooldown = Cooldown}; } /// diff --git a/Content.IntegrationTests/Tests/PrototypeSaveTest.cs b/Content.IntegrationTests/Tests/PrototypeSaveTest.cs index d310ca3c47..9388a8a1ef 100644 --- a/Content.IntegrationTests/Tests/PrototypeSaveTest.cs +++ b/Content.IntegrationTests/Tests/PrototypeSaveTest.cs @@ -11,6 +11,7 @@ using Robust.Shared.Map; using Robust.Shared.Map.Components; using Robust.Shared.Physics; using Robust.Shared.Prototypes; +using Robust.Shared.Serialization; using Robust.Shared.Serialization.Manager; using Robust.Shared.Serialization.Markdown; using Robust.Shared.Serialization.Markdown.Mapping; @@ -240,7 +241,7 @@ public sealed class PrototypeSaveTest EntityUid ITypeReader.Read(ISerializationManager serializationManager, ValueDataNode node, IDependencyCollection dependencies, - bool skipHook, + SerializationHookContext hookCtx, ISerializationContext? context, ISerializationManager.InstantiationDelegate? instanceProvider = null) { return EntityUid.Invalid; diff --git a/Content.Server/Atmos/Commands/ListGasesCommand.cs b/Content.Server/Atmos/Commands/ListGasesCommand.cs index cc27c22197..ab792fcf81 100644 --- a/Content.Server/Atmos/Commands/ListGasesCommand.cs +++ b/Content.Server/Atmos/Commands/ListGasesCommand.cs @@ -18,7 +18,8 @@ namespace Content.Server.Atmos.Commands foreach (var gasPrototype in atmosSystem.Gases) { - shell.WriteLine($"{gasPrototype.Name} ID: {gasPrototype.ID}"); + var gasName = Loc.GetString(gasPrototype.Name); + shell.WriteLine($"{gasName} ID: {gasPrototype.ID}"); } } } diff --git a/Content.Server/Atmos/EntitySystems/GasAnalyzerSystem.cs b/Content.Server/Atmos/EntitySystems/GasAnalyzerSystem.cs index 3f3ca8d447..10cb79fadd 100644 --- a/Content.Server/Atmos/EntitySystems/GasAnalyzerSystem.cs +++ b/Content.Server/Atmos/EntitySystems/GasAnalyzerSystem.cs @@ -254,7 +254,10 @@ namespace Content.Server.Atmos.EntitySystems continue; if (mixture != null) - gases.Add(new GasEntry(gas.Name, mixture.Moles[i], gas.Color)); + { + var gasName = Loc.GetString(gas.Name); + gases.Add(new GasEntry(gasName, mixture.Moles[i], gas.Color)); + } } return gases.ToArray(); diff --git a/Content.Server/Atmos/Serialization/TileAtmosCollectionSerializer.cs b/Content.Server/Atmos/Serialization/TileAtmosCollectionSerializer.cs index b35c86d215..c2f9cd0e0a 100644 --- a/Content.Server/Atmos/Serialization/TileAtmosCollectionSerializer.cs +++ b/Content.Server/Atmos/Serialization/TileAtmosCollectionSerializer.cs @@ -1,4 +1,5 @@ -using Robust.Shared.Serialization.Manager; +using Robust.Shared.Serialization; +using Robust.Shared.Serialization.Manager; using Robust.Shared.Serialization.Markdown; using Robust.Shared.Serialization.Markdown.Mapping; using Robust.Shared.Serialization.Markdown.Validation; @@ -16,10 +17,10 @@ public sealed class TileAtmosCollectionSerializer : ITypeSerializer Read(ISerializationManager serializationManager, MappingDataNode node, IDependencyCollection dependencies, - bool skipHook, ISerializationContext? context = null, + SerializationHookContext hookCtx, ISerializationContext? context = null, ISerializationManager.InstantiationDelegate>? instanceProvider = null) { - var data = serializationManager.Read(node, context, skipHook); + var data = serializationManager.Read(node, hookCtx, context); var tiles = new Dictionary(); if (data.TilesUniqueMixes != null) { @@ -82,7 +83,7 @@ public sealed class TileAtmosCollectionSerializer : ITypeSerializer? TilesUniqueMixes; } - public void CopyTo(ISerializationManager serializationManager, Dictionary source, ref Dictionary target, bool skipHook, + public void CopyTo(ISerializationManager serializationManager, Dictionary source, ref Dictionary target, SerializationHookContext hookCtx, ISerializationContext? context = null) { target.Clear(); diff --git a/Content.Server/Botany/SeedPrototype.cs b/Content.Server/Botany/SeedPrototype.cs index c01df9aacd..b5c748b000 100644 --- a/Content.Server/Botany/SeedPrototype.cs +++ b/Content.Server/Botany/SeedPrototype.cs @@ -69,40 +69,25 @@ public struct SeedChemQuantity public class SeedData { #region Tracking - private string _name = String.Empty; - private string _noun = String.Empty; - private string _displayName = String.Empty; - + /// /// The name of this seed. Determines the name of seed packets. /// [DataField("name")] - public string Name - { - get => _name; - private set => _name = Loc.GetString(value); - } + public string Name { get; private set; } = ""; /// /// The noun for this type of seeds. E.g. for fungi this should probably be "spores" instead of "seeds". Also /// used to determine the name of seed packets. /// [DataField("noun")] - public string Noun - { - get => _noun; - private set => _noun = Loc.GetString(value); - } + public string Noun { get; private set; } = ""; /// /// Name displayed when examining the hydroponics tray. Describes the actual plant, not the seed itself. /// [DataField("displayName")] - public string DisplayName - { - get => _displayName; - private set => _displayName = Loc.GetString(value); - } + public string DisplayName { get; private set; } = ""; [DataField("mysterious")] public bool Mysterious; diff --git a/Content.Server/Botany/Systems/BotanySystem.Seed.cs b/Content.Server/Botany/Systems/BotanySystem.Seed.cs index 4818d00485..dc3deae208 100644 --- a/Content.Server/Botany/Systems/BotanySystem.Seed.cs +++ b/Content.Server/Botany/Systems/BotanySystem.Seed.cs @@ -80,7 +80,8 @@ public sealed partial class BotanySystem : EntitySystem if (!TryGetSeed(component, out var seed)) return; - args.PushMarkup(Loc.GetString($"seed-component-description", ("seedName", seed.DisplayName))); + var name = Loc.GetString(seed.DisplayName); + args.PushMarkup(Loc.GetString($"seed-component-description", ("seedName", name))); args.PushMarkup(Loc.GetString($"seed-component-plant-yield-text", ("seedYield", seed.Yield))); args.PushMarkup(Loc.GetString($"seed-component-plant-potency-text", ("seedPotency", seed.Potency))); } @@ -100,7 +101,9 @@ public sealed partial class BotanySystem : EntitySystem sprite.LayerSetSprite(0, new SpriteSpecifier.Rsi(proto.PlantRsi, "seed")); } - var val = Loc.GetString("botany-seed-packet-name", ("seedName", proto.Name), ("seedNoun", proto.Noun)); + var name = Loc.GetString(proto.Name); + var noun = Loc.GetString(proto.Noun); + var val = Loc.GetString("botany-seed-packet-name", ("seedName", name), ("seedNoun", noun)); MetaData(seed).EntityName = val; return seed; @@ -123,7 +126,8 @@ public sealed partial class BotanySystem : EntitySystem return Enumerable.Empty(); } - _popupSystem.PopupCursor(Loc.GetString("botany-harvest-success-message", ("name", proto.DisplayName)), user, PopupType.Medium); + var name = Loc.GetString(proto.DisplayName); + _popupSystem.PopupCursor(Loc.GetString("botany-harvest-success-message", ("name", name)), user, PopupType.Medium); return GenerateProduct(proto, Transform(user).Coordinates, yieldMod); } diff --git a/Content.Server/Botany/Systems/PlantHolderSystem.cs b/Content.Server/Botany/Systems/PlantHolderSystem.cs index db02ea77d2..c8f3e144e4 100644 --- a/Content.Server/Botany/Systems/PlantHolderSystem.cs +++ b/Content.Server/Botany/Systems/PlantHolderSystem.cs @@ -76,9 +76,10 @@ namespace Content.Server.Botany.Systems } else if (!component.Dead) { + var displayName = Loc.GetString(component.Seed.DisplayName); args.PushMarkup(Loc.GetString("plant-holder-component-something-already-growing-message", - ("seedName", component.Seed.DisplayName), - ("toBeForm", component.Seed.DisplayName.EndsWith('s') ? "are" : "is"))); + ("seedName", displayName), + ("toBeForm", displayName.EndsWith('s') ? "are" : "is"))); if (component.Health <= component.Seed.Endurance / 2) { @@ -134,9 +135,11 @@ namespace Content.Server.Botany.Systems if (!_botanySystem.TryGetSeed(seeds, out var seed)) return ; + var name = Loc.GetString(seed.Name); + var noun = Loc.GetString(seed.Noun); _popupSystem.PopupCursor(Loc.GetString("plant-holder-component-plant-success-message", - ("seedName", seed.Name), - ("seedNoun", seed.Noun)), args.User, PopupType.Medium); + ("seedName", name), + ("seedNoun", noun)), args.User, PopupType.Medium); component.Seed = seed; component.Dead = false; @@ -249,8 +252,9 @@ namespace Content.Server.Botany.Systems component.Seed.Unique = false; var seed = _botanySystem.SpawnSeedPacket(component.Seed, Transform(args.User).Coordinates); seed.RandomOffset(0.25f); + var displayName = Loc.GetString(component.Seed.DisplayName); _popupSystem.PopupCursor(Loc.GetString("plant-holder-component-take-sample-message", - ("seedName", component.Seed.DisplayName)), args.User); + ("seedName", displayName)), args.User); component.Health -= (_random.Next(3, 5) * 10); if (_random.Prob(0.3f)) diff --git a/Content.Server/Chemistry/Components/InjectorComponent.cs b/Content.Server/Chemistry/Components/InjectorComponent.cs index e263968985..d86fe329e6 100644 --- a/Content.Server/Chemistry/Components/InjectorComponent.cs +++ b/Content.Server/Chemistry/Components/InjectorComponent.cs @@ -69,7 +69,7 @@ namespace Content.Server.Chemistry.Components /// public CancellationTokenSource? CancelToken; - private InjectorToggleMode _toggleState; + [DataField("toggleState")] private InjectorToggleMode _toggleState; /// /// The state of the injector. Determines it's attack behavior. Containers must have the @@ -77,7 +77,6 @@ namespace Content.Server.Chemistry.Components /// only ever be set to Inject /// [ViewVariables(VVAccess.ReadWrite)] - [DataField("toggleState")] public InjectorToggleMode ToggleState { get => _toggleState; diff --git a/Content.Server/Containers/ContainerFillComponent.cs b/Content.Server/Containers/ContainerFillComponent.cs index 40eab5e026..26aee86e46 100644 --- a/Content.Server/Containers/ContainerFillComponent.cs +++ b/Content.Server/Containers/ContainerFillComponent.cs @@ -1,6 +1,7 @@ using Content.Server.Storage.Components; using Content.Shared.Storage; using Robust.Shared.Prototypes; +using Robust.Shared.Serialization; using Robust.Shared.Serialization.Manager; using Robust.Shared.Serialization.Markdown.Mapping; using Robust.Shared.Serialization.Markdown.Sequence; diff --git a/Content.Server/Cuffs/Components/CuffableComponent.cs b/Content.Server/Cuffs/Components/CuffableComponent.cs index 340d532f8a..e5a526a944 100644 --- a/Content.Server/Cuffs/Components/CuffableComponent.cs +++ b/Content.Server/Cuffs/Components/CuffableComponent.cs @@ -277,9 +277,9 @@ namespace Content.Server.Cuffs.Components { cuff.Broken = true; - var meta = _entMan.GetComponent(cuffsToRemove); - meta.EntityName = cuff.BrokenName; - meta.EntityDescription = cuff.BrokenDesc; + var meta = _entMan.GetComponent(cuffsToRemove); + meta.EntityName = Loc.GetString(cuff.BrokenName); + meta.EntityDescription = Loc.GetString(cuff.BrokenDesc); if (_entMan.TryGetComponent(cuffsToRemove, out var sprite) && cuff.BrokenState != null) { diff --git a/Content.Server/Cuffs/Components/HandcuffComponent.cs b/Content.Server/Cuffs/Components/HandcuffComponent.cs index 5bf4798f87..03066aece0 100644 --- a/Content.Server/Cuffs/Components/HandcuffComponent.cs +++ b/Content.Server/Cuffs/Components/HandcuffComponent.cs @@ -17,9 +17,6 @@ namespace Content.Server.Cuffs.Components [Dependency] private readonly IEntityManager _entities = default!; [Dependency] private readonly IAdminLogManager _adminLogger = default!; - private string _brokenName = string.Empty; - private string _brokenDesc = string.Empty; - /// /// The time it takes to apply a to an entity. /// @@ -72,21 +69,13 @@ namespace Content.Server.Cuffs.Components /// The iconstate used for broken handcuffs /// [DataField("brokenName", readOnly: true)] - public string BrokenName - { - get => _brokenName; - private set => _brokenName = Loc.GetString(value); - } + public string BrokenName { get; private set; } = ""; /// /// The iconstate used for broken handcuffs /// [DataField("brokenDesc", readOnly: true)] - public string BrokenDesc - { - get => _brokenDesc; - private set => _brokenDesc = Loc.GetString(value); - } + public string BrokenDesc { get; private set; } = ""; [ViewVariables] public bool Broken diff --git a/Content.Server/Disease/DiseaseDiagnosisSystem.cs b/Content.Server/Disease/DiseaseDiagnosisSystem.cs index 91e86aafb7..90f6e8d8cc 100644 --- a/Content.Server/Disease/DiseaseDiagnosisSystem.cs +++ b/Content.Server/Disease/DiseaseDiagnosisSystem.cs @@ -230,7 +230,8 @@ namespace Content.Server.Disease private FormattedMessage AssembleDiseaseReport(DiseasePrototype disease) { FormattedMessage report = new(); - report.AddMarkup(Loc.GetString("diagnoser-disease-report-name", ("disease", disease.Name))); + var diseaseName = Loc.GetString(disease.Name); + report.AddMarkup(Loc.GetString("diagnoser-disease-report-name", ("disease", diseaseName))); report.PushNewline(); if (disease.Infectious) @@ -355,7 +356,8 @@ namespace Content.Server.Disease FormattedMessage contents = new(); if (args.Machine.Disease != null) { - reportTitle = Loc.GetString("diagnoser-disease-report", ("disease", args.Machine.Disease.Name)); + var diseaseName = Loc.GetString(args.Machine.Disease.Name); + reportTitle = Loc.GetString("diagnoser-disease-report", ("disease", diseaseName)); contents = AssembleDiseaseReport(args.Machine.Disease); var known = false; diff --git a/Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs b/Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs index b68252651f..6b50d287d7 100644 --- a/Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs +++ b/Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs @@ -761,8 +761,8 @@ public sealed class NukeopsRuleSystem : GameRuleSystem { var spawnPoint = EntityManager.SpawnEntity(_nukeopsRuleConfig.GhostSpawnPointProto, _random.Pick(spawns)); var spawner = EnsureComp(spawnPoint); - spawner.RoleName = nukeOpsAntag.Name; - spawner.RoleDescription = nukeOpsAntag.Objective; + spawner.RoleName = Loc.GetString(nukeOpsAntag.Name); + spawner.RoleDescription = Loc.GetString(nukeOpsAntag.Objective); var nukeOpSpawner = EnsureComp(spawnPoint); nukeOpSpawner.OperativeName = spawnDetails.Name; diff --git a/Content.Server/NPC/HTN/HTNTaskListSerializer.cs b/Content.Server/NPC/HTN/HTNTaskListSerializer.cs index 85098761a9..98d6295fac 100644 --- a/Content.Server/NPC/HTN/HTNTaskListSerializer.cs +++ b/Content.Server/NPC/HTN/HTNTaskListSerializer.cs @@ -1,5 +1,6 @@ using Content.Server.NPC.HTN.PrimitiveTasks; using Robust.Shared.Prototypes; +using Robust.Shared.Serialization; using Robust.Shared.Serialization.Manager; using Robust.Shared.Serialization.Markdown; using Robust.Shared.Serialization.Markdown.Mapping; @@ -41,7 +42,7 @@ public sealed class HTNTaskListSerializer : ITypeSerializer, Sequen public List Read(ISerializationManager serializationManager, SequenceDataNode node, IDependencyCollection dependencies, - bool skipHook, ISerializationContext? context = null, + SerializationHookContext hookCtx, ISerializationContext? context = null, ISerializationManager.InstantiationDelegate>? instanceProvider = null) { var value = instanceProvider != null ? instanceProvider() : new List(); diff --git a/Content.Server/NPC/NPCBlackboardSerializer.cs b/Content.Server/NPC/NPCBlackboardSerializer.cs index ec7a0756c2..8a02508b91 100644 --- a/Content.Server/NPC/NPCBlackboardSerializer.cs +++ b/Content.Server/NPC/NPCBlackboardSerializer.cs @@ -1,4 +1,5 @@ using Robust.Shared.Reflection; +using Robust.Shared.Serialization; using Robust.Shared.Serialization.Manager; using Robust.Shared.Serialization.Markdown; using Robust.Shared.Serialization.Markdown.Mapping; @@ -47,7 +48,7 @@ public sealed class NPCBlackboardSerializer : ITypeReader? instanceProvider = null) { var value = instanceProvider != null ? instanceProvider() : new NPCBlackboard(); @@ -68,7 +69,7 @@ public sealed class NPCBlackboardSerializer : ITypeReader /// Max item size that can be fitted into secret stash. /// @@ -27,11 +25,7 @@ namespace Content.Server.Storage.Components /// If empty string, will replace it with entity name in init. /// [DataField("secretPartName", readOnly: true)] - public string SecretPartName - { - get => _secretPartName; - set => _secretPartName = Loc.GetString(value); - } + public string SecretPartName { get; set; } = ""; /// /// Container used to keep secret stash item. diff --git a/Content.Server/Storage/EntitySystems/SecretStashSystem.cs b/Content.Server/Storage/EntitySystems/SecretStashSystem.cs index bf78fafb6b..10a3974258 100644 --- a/Content.Server/Storage/EntitySystems/SecretStashSystem.cs +++ b/Content.Server/Storage/EntitySystems/SecretStashSystem.cs @@ -24,14 +24,6 @@ namespace Content.Server.Storage.EntitySystems private void OnInit(EntityUid uid, SecretStashComponent component, ComponentInit args) { - // set default secret part name - if (component.SecretPartName == string.Empty) - { - var meta = EntityManager.GetComponent(uid); - var entityName = Loc.GetString("comp-secret-stash-secret-part-name", ("name", meta.EntityName)); - component.SecretPartName = entityName; - } - component.ItemContainer = _containerSystem.EnsureContainer(uid, "stash", out _); } @@ -79,7 +71,7 @@ namespace Content.Server.Storage.EntitySystems if (item.Size > component.MaxItemSize) { var msg = Loc.GetString("comp-secret-stash-action-hide-item-too-big", - ("item", itemName), ("stash", component.SecretPartName)); + ("item", itemName), ("stash", GetSecretPartName(uid, component))); _popupSystem.PopupEntity(msg, uid, userUid); return false; } @@ -92,7 +84,7 @@ namespace Content.Server.Storage.EntitySystems // all done, show success message var successMsg = Loc.GetString("comp-secret-stash-action-hide-success", - ("item", itemName), ("this", component.SecretPartName)); + ("item", itemName), ("this", GetSecretPartName(uid, component))); _popupSystem.PopupEntity(successMsg, uid, userUid); return true; } @@ -121,10 +113,21 @@ namespace Content.Server.Storage.EntitySystems // show success message var successMsg = Loc.GetString("comp-secret-stash-action-get-item-found-something", - ("stash", component.SecretPartName)); + ("stash", GetSecretPartName(uid, component))); _popupSystem.PopupEntity(successMsg, uid, userUid); return true; } + + private string GetSecretPartName(EntityUid uid, SecretStashComponent stash) + { + if (stash.SecretPartName != "") + return Loc.GetString(stash.SecretPartName); + + var meta = EntityManager.GetComponent(uid); + var entityName = Loc.GetString("comp-secret-stash-secret-part-name", ("name", meta.EntityName)); + + return entityName; + } } } diff --git a/Content.Server/Suspicion/Roles/SuspicionInnocentRole.cs b/Content.Server/Suspicion/Roles/SuspicionInnocentRole.cs index 65eb958471..7c07cbd8df 100644 --- a/Content.Server/Suspicion/Roles/SuspicionInnocentRole.cs +++ b/Content.Server/Suspicion/Roles/SuspicionInnocentRole.cs @@ -10,12 +10,12 @@ namespace Content.Server.Suspicion.Roles public SuspicionInnocentRole(Mind.Mind mind, AntagPrototype antagPrototype) : base(mind) { Prototype = antagPrototype; - Name = antagPrototype.Name; + Name = Loc.GetString(antagPrototype.Name); Antagonist = antagPrototype.Antagonist; } public override string Name { get; } - public string Objective => Prototype.Objective; + public string Objective => Loc.GetString(Prototype.Objective); public override bool Antagonist { get; } public override void Greet() diff --git a/Content.Server/Suspicion/Roles/SuspicionTraitorRole.cs b/Content.Server/Suspicion/Roles/SuspicionTraitorRole.cs index 7f3e865b3b..b42b22da42 100644 --- a/Content.Server/Suspicion/Roles/SuspicionTraitorRole.cs +++ b/Content.Server/Suspicion/Roles/SuspicionTraitorRole.cs @@ -11,12 +11,12 @@ namespace Content.Server.Suspicion.Roles public SuspicionTraitorRole(Mind.Mind mind, AntagPrototype antagPrototype) : base(mind) { Prototype = antagPrototype; - Name = antagPrototype.Name; + Name = Loc.GetString(antagPrototype.Name); Antagonist = antagPrototype.Antagonist; } public override string Name { get; } - public string Objective => Prototype.Objective; + public string Objective => Loc.GetString(Prototype.Objective); public override bool Antagonist { get; } public void GreetSuspicion(List traitors, IChatManager chatMgr) diff --git a/Content.Server/Traitor/TraitorRole.cs b/Content.Server/Traitor/TraitorRole.cs index 58b0a467ea..4e23122e7d 100644 --- a/Content.Server/Traitor/TraitorRole.cs +++ b/Content.Server/Traitor/TraitorRole.cs @@ -11,7 +11,7 @@ namespace Content.Server.Traitor public TraitorRole(Mind.Mind mind, AntagPrototype antagPrototype) : base(mind) { Prototype = antagPrototype; - Name = antagPrototype.Name; + Name = Loc.GetString(antagPrototype.Name); Antagonist = antagPrototype.Antagonist; } diff --git a/Content.Shared/Access/AccessLevelPrototype.cs b/Content.Shared/Access/AccessLevelPrototype.cs index be5d00098c..f8d098735a 100644 --- a/Content.Shared/Access/AccessLevelPrototype.cs +++ b/Content.Shared/Access/AccessLevelPrototype.cs @@ -16,12 +16,6 @@ namespace Content.Shared.Access /// The player-visible name of the access level, in the ID card console and such. /// [DataField("name")] - public string Name - { - get => (_name is not null) ? _name : ID; - private set => _name = Loc.GetString(value); - } - - private string? _name; + public string? Name { get; set; } } } diff --git a/Content.Shared/Alert/AlertOrderPrototype.cs b/Content.Shared/Alert/AlertOrderPrototype.cs index dfef1c2cbf..5560d257d4 100644 --- a/Content.Shared/Alert/AlertOrderPrototype.cs +++ b/Content.Shared/Alert/AlertOrderPrototype.cs @@ -81,7 +81,8 @@ namespace Content.Shared.Alert if (idx == -1 && idy == -1) { // break ties by type value - return x.AlertType - y.AlertType; + // Must cast to int to avoid integer overflow when subtracting (enum's unsigned) + return (int)x.AlertType - (int)y.AlertType; } if (idx == -1) return 1; @@ -92,7 +93,8 @@ namespace Content.Shared.Alert if (result == 0) { // break ties by type value - return x.AlertType - y.AlertType; + // Must cast to int to avoid integer overflow when subtracting (enum's unsigned) + return (int)x.AlertType - (int)y.AlertType; } return result; diff --git a/Content.Shared/Alert/AlertPrototype.cs b/Content.Shared/Alert/AlertPrototype.cs index 373e927fd3..c291332a74 100644 --- a/Content.Shared/Alert/AlertPrototype.cs +++ b/Content.Shared/Alert/AlertPrototype.cs @@ -1,4 +1,3 @@ -using System.Globalization; using Robust.Shared.Prototypes; using Robust.Shared.Serialization; using Robust.Shared.Utility; @@ -11,9 +10,6 @@ namespace Content.Shared.Alert [Prototype("alert")] public sealed class AlertPrototype : IPrototype, ISerializationHooks { - private FormattedMessage _name = new (); - private FormattedMessage _description = new (); - [ViewVariables] string IPrototype.ID => AlertType.ToString(); @@ -34,21 +30,13 @@ namespace Content.Shared.Alert /// Name to show in tooltip window. Accepts formatting. /// [DataField("name")] - public FormattedMessage Name - { - get => _name; - private set => _name = FormattedMessage.FromMarkup(Loc.GetString(value.ToString())); - } + public string Name { get; private set; } = ""; /// /// Description to show in tooltip window. Accepts formatting. /// [DataField("description")] - public FormattedMessage Description - { - get => _description; - private set => _description = FormattedMessage.FromMarkup(Loc.GetString(value.ToString())); - } + public string Description { get; private set; } = ""; /// /// Category the alert belongs to. Only one alert of a given category diff --git a/Content.Shared/Atmos/Prototypes/GasPrototype.cs b/Content.Shared/Atmos/Prototypes/GasPrototype.cs index bdc64eaadf..6fae1fb86c 100644 --- a/Content.Shared/Atmos/Prototypes/GasPrototype.cs +++ b/Content.Shared/Atmos/Prototypes/GasPrototype.cs @@ -7,14 +7,7 @@ namespace Content.Shared.Atmos.Prototypes [Prototype("gas")] public sealed class GasPrototype : IPrototype { - private string _name = string.Empty; - - [DataField("name")] - public string Name - { - get => _name; - private set => _name = Loc.GetString(value); - } + [DataField("name")] public string Name { get; set; } = ""; // TODO: Control gas amount necessary for overlay to appear // TODO: Add interfaces for gas behaviours e.g. breathing, burning diff --git a/Content.Shared/BarSign/BarSignPrototype.cs b/Content.Shared/BarSign/BarSignPrototype.cs index b60e1a62f0..a167a5f866 100644 --- a/Content.Shared/BarSign/BarSignPrototype.cs +++ b/Content.Shared/BarSign/BarSignPrototype.cs @@ -5,9 +5,6 @@ namespace Content.Shared.BarSign [Prototype("barSign")] public sealed class BarSignPrototype : IPrototype { - private string _description = string.Empty; - private string _name = string.Empty; - [ViewVariables] [IdDataFieldAttribute] public string ID { get; } = default!; @@ -15,19 +12,8 @@ namespace Content.Shared.BarSign [DataField("icon")] public string Icon { get; private set; } = string.Empty; - [DataField("name")] - public string Name - { - get => _name; - private set => _name = Loc.GetString(value); - } - - [DataField("description")] - public string Description - { - get => _description; - private set => _description = Loc.GetString(value); - } + [DataField("name")] public string Name { get; set; } = ""; + [DataField("description")] public string Description { get; set; } = ""; [DataField("renameArea")] public bool RenameArea { get; private set; } = true; diff --git a/Content.Shared/Body/Prototypes/BodyPrototype.cs b/Content.Shared/Body/Prototypes/BodyPrototype.cs index f3335f8fac..867b24b284 100644 --- a/Content.Shared/Body/Prototypes/BodyPrototype.cs +++ b/Content.Shared/Body/Prototypes/BodyPrototype.cs @@ -8,14 +8,8 @@ public sealed class BodyPrototype : IPrototype { [IdDataField] public string ID { get; } = default!; - private string _name = string.Empty; - [DataField("name")] - public string Name - { - get => _name; - private set => _name = Loc.GetString(value); - } + public string Name { get; private set; } = ""; [DataField("root")] public string Root { get; } = string.Empty; diff --git a/Content.Shared/Body/Prototypes/BodyPrototypeSerializer.cs b/Content.Shared/Body/Prototypes/BodyPrototypeSerializer.cs index e850b08db3..69503396ae 100644 --- a/Content.Shared/Body/Prototypes/BodyPrototypeSerializer.cs +++ b/Content.Shared/Body/Prototypes/BodyPrototypeSerializer.cs @@ -2,6 +2,7 @@ using Content.Shared.Body.Organ; using Content.Shared.Prototypes; using Robust.Shared.Prototypes; +using Robust.Shared.Serialization; using Robust.Shared.Serialization.Manager; using Robust.Shared.Serialization.Markdown.Mapping; using Robust.Shared.Serialization.Markdown.Sequence; @@ -117,7 +118,7 @@ public sealed class BodyPrototypeSerializer : ITypeReader? instanceProvider = null) { var id = node.Get("id").Value; diff --git a/Content.Shared/Construction/Prototypes/ConstructionPrototype.cs b/Content.Shared/Construction/Prototypes/ConstructionPrototype.cs index bea7dc3074..f5adb5cf89 100644 --- a/Content.Shared/Construction/Prototypes/ConstructionPrototype.cs +++ b/Content.Shared/Construction/Prototypes/ConstructionPrototype.cs @@ -8,8 +8,6 @@ namespace Content.Shared.Construction.Prototypes [Prototype("construction")] public sealed class ConstructionPrototype : IPrototype { - private string _category = string.Empty; - [DataField("conditions")] private List _conditions = new(); /// @@ -54,12 +52,7 @@ namespace Content.Shared.Construction.Prototypes [DataField("canBuildInImpassable")] public bool CanBuildInImpassable { get; private set; } - [DataField("category")] - public string Category - { - get => _category; - private set => _category = Loc.GetString(value); - } + [DataField("category")] public string Category { get; private set; } = ""; [DataField("objectType")] public ConstructionType Type { get; private set; } = ConstructionType.Structure; diff --git a/Content.Shared/Construction/Steps/ConstructionGraphStepTypeSerializer.cs b/Content.Shared/Construction/Steps/ConstructionGraphStepTypeSerializer.cs index b1dfed6b64..5ac0ca19d4 100644 --- a/Content.Shared/Construction/Steps/ConstructionGraphStepTypeSerializer.cs +++ b/Content.Shared/Construction/Steps/ConstructionGraphStepTypeSerializer.cs @@ -1,4 +1,5 @@ -using Robust.Shared.Serialization.Manager; +using Robust.Shared.Serialization; +using Robust.Shared.Serialization.Manager; using Robust.Shared.Serialization.Markdown.Mapping; using Robust.Shared.Serialization.Markdown.Validation; using Robust.Shared.Serialization.TypeSerializers.Interfaces; @@ -41,7 +42,7 @@ namespace Content.Shared.Construction.Steps public ConstructionGraphStep Read(ISerializationManager serializationManager, MappingDataNode node, IDependencyCollection dependencies, - bool skipHook, + SerializationHookContext hookCtx, ISerializationContext? context = null, ISerializationManager.InstantiationDelegate? instanceProvider = null) { @@ -49,7 +50,7 @@ namespace Content.Shared.Construction.Steps throw new ArgumentException( "Tried to convert invalid YAML node mapping to ConstructionGraphStep!"); - return (ConstructionGraphStep)serializationManager.Read(type, node, context, skipHook)!; + return (ConstructionGraphStep)serializationManager.Read(type, node, hookCtx, context)!; } public ValidationNode Validate(ISerializationManager serializationManager, MappingDataNode node, diff --git a/Content.Shared/Damage/DamageSpecifierDictionarySerializer.cs b/Content.Shared/Damage/DamageSpecifierDictionarySerializer.cs index b7dc0ff79a..e6ef48bdb0 100644 --- a/Content.Shared/Damage/DamageSpecifierDictionarySerializer.cs +++ b/Content.Shared/Damage/DamageSpecifierDictionarySerializer.cs @@ -1,6 +1,7 @@ using Content.Shared.Damage.Prototypes; using Content.Shared.FixedPoint; using Robust.Shared.Prototypes; +using Robust.Shared.Serialization; using Robust.Shared.Serialization.Manager; using Robust.Shared.Serialization.Markdown.Mapping; using Robust.Shared.Serialization.Markdown.Validation; @@ -34,7 +35,7 @@ public sealed class DamageSpecifierDictionarySerializer : ITypeReader Read(ISerializationManager serializationManager, MappingDataNode node, IDependencyCollection dependencies, - bool skipHook, ISerializationContext? context = null, ISerializationManager.InstantiationDelegate>? instanceProvider = null) + SerializationHookContext hookCtx, ISerializationContext? context = null, ISerializationManager.InstantiationDelegate>? instanceProvider = null) { var dict = instanceProvider != null ? instanceProvider() : new(); // Add all the damage types by just copying the type dictionary (if it is not null). diff --git a/Content.Shared/Decals/DecalGridChunkCollectionTypeSerializer.cs b/Content.Shared/Decals/DecalGridChunkCollectionTypeSerializer.cs index 861477b00d..3c72be4298 100644 --- a/Content.Shared/Decals/DecalGridChunkCollectionTypeSerializer.cs +++ b/Content.Shared/Decals/DecalGridChunkCollectionTypeSerializer.cs @@ -1,3 +1,4 @@ +using Robust.Shared.Serialization; using Robust.Shared.Serialization.Manager; using Robust.Shared.Serialization.Markdown; using Robust.Shared.Serialization.Markdown.Mapping; @@ -18,10 +19,10 @@ namespace Content.Shared.Decals public DecalGridComponent.DecalGridChunkCollection Read(ISerializationManager serializationManager, MappingDataNode node, - IDependencyCollection dependencies, bool skipHook, ISerializationContext? context = null, + IDependencyCollection dependencies, SerializationHookContext hookCtx, ISerializationContext? context = null, ISerializationManager.InstantiationDelegate? _ = default) { - var dictionary = serializationManager.Read>(node, context, skipHook: skipHook, notNullableOverride: true); + var dictionary = serializationManager.Read>(node, hookCtx, context, notNullableOverride: true); var uids = new SortedSet(); var uidChunkMap = new Dictionary(); diff --git a/Content.Shared/Disease/DiseasePrototype.cs b/Content.Shared/Disease/DiseasePrototype.cs index 045db8a813..c59eb4e907 100644 --- a/Content.Shared/Disease/DiseasePrototype.cs +++ b/Content.Shared/Disease/DiseasePrototype.cs @@ -11,18 +11,12 @@ namespace Content.Shared.Disease [DataDefinition] public sealed class DiseasePrototype : IPrototype, IInheritingPrototype { - private string _name = string.Empty; - [ViewVariables] [IdDataFieldAttribute] public string ID { get; } = default!; [DataField("name")] - public string Name - { - get => _name; - private set => _name = Loc.GetString(value); - } + public string Name { get; private set; } = string.Empty; [ParentDataFieldAttribute(typeof(AbstractPrototypeIdArraySerializer))] public string[]? Parents { get; private set; } diff --git a/Content.Shared/Maps/ContentTileDefinition.cs b/Content.Shared/Maps/ContentTileDefinition.cs index b7e0426ba1..bdf58bbda0 100644 --- a/Content.Shared/Maps/ContentTileDefinition.cs +++ b/Content.Shared/Maps/ContentTileDefinition.cs @@ -28,12 +28,7 @@ namespace Content.Shared.Maps public ushort TileId { get; private set; } [DataField("name")] - public string Name - { - get => _name; - private set => _name = Loc.GetString(value); - } - + public string Name { get; private set; } = ""; [DataField("sprite")] public ResourcePath? Sprite { get; } [DataField("isSubfloor")] public bool IsSubFloor { get; private set; } diff --git a/Content.Shared/Materials/MaterialPrototype.cs b/Content.Shared/Materials/MaterialPrototype.cs index fd72a3e880..ff94f409f1 100644 --- a/Content.Shared/Materials/MaterialPrototype.cs +++ b/Content.Shared/Materials/MaterialPrototype.cs @@ -31,11 +31,7 @@ namespace Content.Shared.Materials public string? StackId { get; } = null; [DataField("name")] - public string Name - { - get => _name; - private set => _name = Loc.GetString(value); - } + public string Name { get; private set; } = ""; [DataField("color")] public Color Color { get; } = Color.Gray; diff --git a/Content.Shared/Research/Prototypes/TechnologyPrototype.cs b/Content.Shared/Research/Prototypes/TechnologyPrototype.cs index 55be7b70bc..243b330b4f 100644 --- a/Content.Shared/Research/Prototypes/TechnologyPrototype.cs +++ b/Content.Shared/Research/Prototypes/TechnologyPrototype.cs @@ -19,13 +19,7 @@ namespace Content.Shared.Research.Prototypes /// The name this technology will have on user interfaces. /// [DataField("name")] - public string Name - { - get => (_name is not null) ? _name : ID; - private set => _name = Loc.GetString(value); - } - - private string? _name; + public string? Name { get; private set; } /// /// An icon that represent this technology. @@ -37,13 +31,7 @@ namespace Content.Shared.Research.Prototypes /// A short description of the technology. /// [DataField("description")] - public string Description - { - get => (_description is not null) ? _description : ""; - private set => _description = Loc.GetString(value); - } - - private string? _description; + public string Description { get; private set; } = ""; /// /// The required research points to unlock this technology. diff --git a/Content.Shared/Roles/AntagPrototype.cs b/Content.Shared/Roles/AntagPrototype.cs index c64830a7b9..d51ef61169 100644 --- a/Content.Shared/Roles/AntagPrototype.cs +++ b/Content.Shared/Roles/AntagPrototype.cs @@ -20,31 +20,19 @@ namespace Content.Shared.Roles /// The name of this antag as displayed to players. /// [DataField("name")] - public string Name - { - get => _name; - private set => _name = Loc.GetString(value); - } + public string Name { get; private set; } = ""; /// /// The description of this antag shown in a tooltip. /// [DataField("description")] - public string? Description - { - get => _description; - private set => _description = value is null ? null : Loc.GetString(value); - } + public string? Description { get; private set; } /// /// The antag's objective, displayed at round-start to the player. /// [DataField("objective")] - public string Objective - { - get => _objective; - private set => _objective = Loc.GetString(value); - } + public string Objective { get; private set; } = ""; /// /// Whether or not the antag role is one of the bad guys. diff --git a/Content.Shared/Store/StoreCategoryPrototype.cs b/Content.Shared/Store/StoreCategoryPrototype.cs index 7eeb94a77a..10c020ebc6 100644 --- a/Content.Shared/Store/StoreCategoryPrototype.cs +++ b/Content.Shared/Store/StoreCategoryPrototype.cs @@ -17,11 +17,7 @@ public sealed class StoreCategoryPrototype : IPrototype public string ID { get; } = default!; [DataField("name")] - public string Name - { - get => _name; - private set => _name = Loc.GetString(value); - } + public string Name { get; private set; } = ""; [DataField("priority")] public int Priority { get; } = 0; diff --git a/Content.Shared/Traits/TraitPrototype.cs b/Content.Shared/Traits/TraitPrototype.cs index 2b872fc94a..1d581c36f0 100644 --- a/Content.Shared/Traits/TraitPrototype.cs +++ b/Content.Shared/Traits/TraitPrototype.cs @@ -21,21 +21,13 @@ namespace Content.Shared.Traits /// The name of this trait. /// [DataField("name")] - public string Name - { - get => _name; - private set => _name = Loc.GetString(value); - } + public string Name { get; private set; } = ""; /// /// The description of this trait. /// [DataField("description")] - public string? Description - { - get => _description; - private set => _description = value is null ? null : Loc.GetString(value); - } + public string? Description { get; private set; } /// /// Don't apply this trait to entities this whitelist IS NOT valid for.