From a4a25a9975ce9559fdacd967d36950f39b8ffc0c Mon Sep 17 00:00:00 2001 From: DrSmugleaf Date: Sun, 23 Aug 2020 12:53:09 +0200 Subject: [PATCH] Remove localization manager dependencies from components (#1864) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: VĂ­ctor Aguilera Puerto <6766154+Zumorica@users.noreply.github.com> --- .../Chemistry/ChemMaster/ChemMasterWindow.cs | 41 +++++++++---------- .../ReagentDispenserBoundUserInterface.cs | 6 +-- .../ReagentDispenserWindow.cs | 25 ++++++----- .../ConstructionGhostComponent.cs | 6 +-- .../ResearchClientServerSelectionMenu.cs | 6 +-- .../Access/IdCardConsoleComponent.cs | 5 +-- .../Chemistry/ChemMasterComponent.cs | 11 +++-- .../Components/Chemistry/PourableComponent.cs | 5 +-- .../Chemistry/ReagentDispenserComponent.cs | 11 +++-- .../Components/Chemistry/SolutionComponent.cs | 7 ++-- .../Components/Fluids/BucketComponent.cs | 6 +-- .../Components/Fluids/MopComponent.cs | 7 +--- .../Components/Fluids/PuddleComponent.cs | 3 +- .../Interactable/HandheldLightComponent.cs | 9 ++-- .../Components/Items/DiceComponent.cs | 6 +-- .../PowerReceiverUsers/BaseCharger.cs | 4 +- .../Rotatable/RotatableComponent.cs | 3 +- .../Components/Stack/StackComponent.cs | 3 +- .../Components/Weapon/Melee/FlashComponent.cs | 5 +-- .../Weapon/Melee/StunbatonComponent.cs | 9 ++-- .../GameObjects/Components/WiresComponent.cs | 4 +- .../EntitySystems/SharedConstructionSystem.cs | 8 +--- 22 files changed, 73 insertions(+), 117 deletions(-) diff --git a/Content.Client/GameObjects/Components/Chemistry/ChemMaster/ChemMasterWindow.cs b/Content.Client/GameObjects/Components/Chemistry/ChemMaster/ChemMasterWindow.cs index 08ec838c88..4bf3482a2c 100644 --- a/Content.Client/GameObjects/Components/Chemistry/ChemMaster/ChemMasterWindow.cs +++ b/Content.Client/GameObjects/Components/Chemistry/ChemMaster/ChemMasterWindow.cs @@ -21,6 +21,10 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster /// public class ChemMasterWindow : SS14Window { +#pragma warning disable 649 + [Dependency] private readonly IPrototypeManager _prototypeManager; +#pragma warning restore 649 + /// Contains info about the reagent container such as it's contents, if one is loaded into the dispenser. private readonly VBoxContainer ContainerInfo; @@ -45,11 +49,6 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster public Button CreatePills { get; } public Button CreateBottles { get; } -#pragma warning disable 649 - [Dependency] private readonly IPrototypeManager _prototypeManager; - [Dependency] private readonly ILocalizationManager _localizationManager; -#pragma warning restore 649 - protected override Vector2? CustomSize => (400, 200); /// @@ -69,9 +68,9 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster { Children = { - new Label {Text = _localizationManager.GetString("Container")}, + new Label {Text = Loc.GetString("Container")}, new Control {SizeFlagsHorizontal = SizeFlags.FillExpand}, - (EjectButton = new Button {Text = _localizationManager.GetString("Eject")}) + (EjectButton = new Button {Text = Loc.GetString("Eject")}) } }, //Wrap the container info in a PanelContainer so we can color it's background differently. @@ -94,7 +93,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster { new Label { - Text = _localizationManager.GetString("No container loaded.") + Text = Loc.GetString("No container loaded.") } } }), @@ -109,10 +108,10 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster { Children = { - new Label {Text = _localizationManager.GetString("Buffer")}, + new Label {Text = Loc.GetString("Buffer")}, new Control {SizeFlagsHorizontal = SizeFlags.FillExpand}, - (BufferTransferButton = new Button {Text = _localizationManager.GetString("Transfer"), Pressed = BufferModeTransfer, StyleClasses = { StyleBase.ButtonOpenRight }}), - (BufferDiscardButton = new Button {Text = _localizationManager.GetString("Discard"), Pressed = !BufferModeTransfer, StyleClasses = { StyleBase.ButtonOpenLeft }}) + (BufferTransferButton = new Button {Text = Loc.GetString("Transfer"), Pressed = BufferModeTransfer, StyleClasses = { StyleBase.ButtonOpenRight }}), + (BufferDiscardButton = new Button {Text = Loc.GetString("Discard"), Pressed = !BufferModeTransfer, StyleClasses = { StyleBase.ButtonOpenLeft }}) } }, @@ -136,7 +135,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster { new Label { - Text = _localizationManager.GetString("Buffer empty.") + Text = Loc.GetString("Buffer empty.") } } }), @@ -151,7 +150,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster { Children = { - new Label {Text = _localizationManager.GetString("Packaging ")}, + new Label {Text = Loc.GetString("Packaging ")}, } }, @@ -185,7 +184,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster { new Label { - Text = _localizationManager.GetString("Pills:") + Text = Loc.GetString("Pills:") }, }, @@ -212,7 +211,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster }; PillInfo.AddChild((pillVolume)); - CreatePills = new Button {Text = _localizationManager.GetString("Create")}; + CreatePills = new Button {Text = Loc.GetString("Create")}; PillInfo.AddChild(CreatePills); //Bottles @@ -222,7 +221,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster { new Label { - Text = _localizationManager.GetString("Bottles:") + Text = Loc.GetString("Bottles:") }, }, @@ -249,7 +248,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster }; BottleInfo.AddChild((bottleVolume)); - CreateBottles = new Button {Text = _localizationManager.GetString("Create")}; + CreateBottles = new Button {Text = Loc.GetString("Create")}; BottleInfo.AddChild(CreateBottles); } @@ -314,7 +313,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster if (!state.HasBeaker) { - ContainerInfo.Children.Add(new Label {Text = _localizationManager.GetString("No container loaded.")}); + ContainerInfo.Children.Add(new Label {Text = Loc.GetString("No container loaded.")}); return; } @@ -333,7 +332,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster foreach (var reagent in state.ContainerReagents) { - var name = _localizationManager.GetString("Unknown reagent"); + var name = Loc.GetString("Unknown reagent"); //Try to the prototype for the given reagent. This gives us it's name. if (_prototypeManager.TryIndex(reagent.ReagentId, out ReagentPrototype proto)) { @@ -370,7 +369,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster if (!state.BufferReagents.Any()) { - BufferInfo.Children.Add(new Label {Text = _localizationManager.GetString("Buffer empty.")}); + BufferInfo.Children.Add(new Label {Text = Loc.GetString("Buffer empty.")}); return; } @@ -388,7 +387,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster foreach (var reagent in state.BufferReagents) { - var name = _localizationManager.GetString("Unknown reagent"); + var name = Loc.GetString("Unknown reagent"); //Try to the prototype for the given reagent. This gives us it's name. if (_prototypeManager.TryIndex(reagent.ReagentId, out ReagentPrototype proto)) { diff --git a/Content.Client/GameObjects/Components/Chemistry/ReagentDispenser/ReagentDispenserBoundUserInterface.cs b/Content.Client/GameObjects/Components/Chemistry/ReagentDispenser/ReagentDispenserBoundUserInterface.cs index ccf3a0f3b9..07ecba5030 100644 --- a/Content.Client/GameObjects/Components/Chemistry/ReagentDispenser/ReagentDispenserBoundUserInterface.cs +++ b/Content.Client/GameObjects/Components/Chemistry/ReagentDispenser/ReagentDispenserBoundUserInterface.cs @@ -17,10 +17,6 @@ namespace Content.Client.GameObjects.Components.Chemistry.ReagentDispenser [UsedImplicitly] public class ReagentDispenserBoundUserInterface : BoundUserInterface { -#pragma warning disable 649 - [Dependency] private readonly ILocalizationManager _localizationManager; -#pragma warning restore 649 - private ReagentDispenserWindow _window; private ReagentDispenserBoundUserInterfaceState _lastState; @@ -41,7 +37,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ReagentDispenser //Setup window layout/elements _window = new ReagentDispenserWindow { - Title = _localizationManager.GetString("Reagent dispenser"), + Title = Loc.GetString("Reagent dispenser"), }; _window.OpenCentered(); diff --git a/Content.Client/GameObjects/Components/Chemistry/ReagentDispenser/ReagentDispenserWindow.cs b/Content.Client/GameObjects/Components/Chemistry/ReagentDispenser/ReagentDispenserWindow.cs index 0389b9aa35..76b168eae3 100644 --- a/Content.Client/GameObjects/Components/Chemistry/ReagentDispenser/ReagentDispenserWindow.cs +++ b/Content.Client/GameObjects/Components/Chemistry/ReagentDispenser/ReagentDispenserWindow.cs @@ -20,6 +20,10 @@ namespace Content.Client.GameObjects.Components.Chemistry.ReagentDispenser /// public class ReagentDispenserWindow : SS14Window { +#pragma warning disable 649 + [Dependency] private readonly IPrototypeManager _prototypeManager; +#pragma warning restore 649 + /// Contains info about the reagent container such as it's contents, if one is loaded into the dispenser. private readonly VBoxContainer ContainerInfo; @@ -50,11 +54,6 @@ namespace Content.Client.GameObjects.Components.Chemistry.ReagentDispenser /// A grid of buttons for each reagent which can be dispensed. public GridContainer ChemicalList { get; } -#pragma warning disable 649 - [Dependency] private readonly IPrototypeManager _prototypeManager; - [Dependency] private readonly ILocalizationManager _localizationManager; -#pragma warning restore 649 - protected override Vector2? CustomSize => (500, 600); /// @@ -76,7 +75,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ReagentDispenser { Children = { - new Label {Text = _localizationManager.GetString("Amount")}, + new Label {Text = Loc.GetString("Amount")}, //Padding new Control {CustomMinimumSize = (20, 0)}, (DispenseButton1 = new Button {Text = "1", Group = dispenseAmountGroup, StyleClasses = { StyleBase.ButtonOpenRight }}), @@ -100,9 +99,9 @@ namespace Content.Client.GameObjects.Components.Chemistry.ReagentDispenser { Children = { - new Label {Text = _localizationManager.GetString("Container: ")}, - (ClearButton = new Button {Text = _localizationManager.GetString("Clear"), StyleClasses = {StyleBase.ButtonOpenRight}}), - (EjectButton = new Button {Text = _localizationManager.GetString("Eject"), StyleClasses = {StyleBase.ButtonOpenLeft}}) + new Label {Text = Loc.GetString("Container: ")}, + (ClearButton = new Button {Text = Loc.GetString("Clear"), StyleClasses = {StyleBase.ButtonOpenRight}}), + (EjectButton = new Button {Text = Loc.GetString("Eject"), StyleClasses = {StyleBase.ButtonOpenLeft}}) } }, //Wrap the container info in a PanelContainer so we can color it's background differently. @@ -125,7 +124,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ReagentDispenser { new Label { - Text = _localizationManager.GetString("No container loaded.") + Text = Loc.GetString("No container loaded.") } } }), @@ -155,7 +154,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ReagentDispenser } else { - ChemicalList.AddChild(new Button {Text = _localizationManager.GetString("Reagent name not found")}); + ChemicalList.AddChild(new Button {Text = Loc.GetString("Reagent name not found")}); } } } @@ -243,7 +242,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ReagentDispenser if (!state.HasBeaker) { - ContainerInfo.Children.Add(new Label {Text = _localizationManager.GetString("No container loaded.")}); + ContainerInfo.Children.Add(new Label {Text = Loc.GetString("No container loaded.")}); return; } @@ -267,7 +266,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ReagentDispenser foreach (var reagent in state.ContainerReagents) { - var name = _localizationManager.GetString("Unknown reagent"); + var name = Loc.GetString("Unknown reagent"); //Try to the prototype for the given reagent. This gives us it's name. if (_prototypeManager.TryIndex(reagent.ReagentId, out ReagentPrototype proto)) { diff --git a/Content.Client/GameObjects/Components/Construction/ConstructionGhostComponent.cs b/Content.Client/GameObjects/Components/Construction/ConstructionGhostComponent.cs index 11fd598acf..28adc6a316 100644 --- a/Content.Client/GameObjects/Components/Construction/ConstructionGhostComponent.cs +++ b/Content.Client/GameObjects/Components/Construction/ConstructionGhostComponent.cs @@ -2,7 +2,6 @@ using Content.Shared.GameObjects.EntitySystems; using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Systems; -using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.Utility; using Robust.Shared.ViewVariables; @@ -12,9 +11,6 @@ namespace Content.Client.GameObjects.Components.Construction [RegisterComponent] public class ConstructionGhostComponent : Component, IExamine { -#pragma warning disable 649 - [Dependency] private readonly ILocalizationManager _loc; -#pragma warning restore 649 public override string Name => "ConstructionGhost"; [ViewVariables] public ConstructionPrototype Prototype { get; set; } @@ -22,7 +18,7 @@ namespace Content.Client.GameObjects.Components.Construction void IExamine.Examine(FormattedMessage message, bool inDetailsRange) { - message.AddText(_loc.GetString("Building: {0}\n", Prototype.Name)); + message.AddText(Loc.GetString("Building: {0}\n", Prototype.Name)); EntitySystem.Get().DoExamine(message, Prototype, 0, inDetailsRange); } } diff --git a/Content.Client/GameObjects/Components/Research/ResearchClientServerSelectionMenu.cs b/Content.Client/GameObjects/Components/Research/ResearchClientServerSelectionMenu.cs index f6b39e12da..052f48c452 100644 --- a/Content.Client/GameObjects/Components/Research/ResearchClientServerSelectionMenu.cs +++ b/Content.Client/GameObjects/Components/Research/ResearchClientServerSelectionMenu.cs @@ -14,10 +14,6 @@ namespace Content.Client.GameObjects.Components.Research private int[] _serverIds = new int[]{}; private int _selectedServerId = -1; -#pragma warning disable 649 - [Dependency] private readonly ILocalizationManager _localizationManager; -#pragma warning restore 649 - protected override Vector2? CustomSize => (300, 300); public ResearchClientBoundUserInterface Owner { get; set; } @@ -25,7 +21,7 @@ namespace Content.Client.GameObjects.Components.Research { IoCManager.InjectDependencies(this); - Title = _localizationManager.GetString("Research Server Selection"); + Title = Loc.GetString("Research Server Selection"); _servers = new ItemList() {SelectMode = ItemList.ItemListSelectMode.Single}; diff --git a/Content.Server/GameObjects/Components/Access/IdCardConsoleComponent.cs b/Content.Server/GameObjects/Components/Access/IdCardConsoleComponent.cs index 9fa417bc1a..058a501b03 100644 --- a/Content.Server/GameObjects/Components/Access/IdCardConsoleComponent.cs +++ b/Content.Server/GameObjects/Components/Access/IdCardConsoleComponent.cs @@ -25,7 +25,6 @@ namespace Content.Server.GameObjects.Components.Access public class IdCardConsoleComponent : SharedIdCardConsoleComponent, IActivate { [Dependency] private readonly IServerNotifyManager _notifyManager = default!; - [Dependency] private readonly ILocalizationManager _localizationManager = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!; private ContainerSlot _privilegedIdContainer = default!; @@ -137,7 +136,7 @@ namespace Content.Server.GameObjects.Components.Access { if (!user.TryGetComponent(out IHandsComponent? hands)) { - _notifyManager.PopupMessage(Owner.Transform.GridPosition, user, _localizationManager.GetString("You have no hands.")); + _notifyManager.PopupMessage(Owner.Transform.GridPosition, user, Loc.GetString("You have no hands.")); return; } @@ -166,7 +165,7 @@ namespace Content.Server.GameObjects.Components.Access if (!hands.Drop(hands.ActiveHand, container)) { - _notifyManager.PopupMessage(Owner.Transform.GridPosition, user, _localizationManager.GetString("You can't let go of the ID card!")); + _notifyManager.PopupMessage(Owner.Transform.GridPosition, user, Loc.GetString("You can't let go of the ID card!")); return; } UpdateUserInterface(); diff --git a/Content.Server/GameObjects/Components/Chemistry/ChemMasterComponent.cs b/Content.Server/GameObjects/Components/Chemistry/ChemMasterComponent.cs index 84cc2ca642..14a6413a4c 100644 --- a/Content.Server/GameObjects/Components/Chemistry/ChemMasterComponent.cs +++ b/Content.Server/GameObjects/Components/Chemistry/ChemMasterComponent.cs @@ -43,7 +43,6 @@ namespace Content.Server.GameObjects.Components.Chemistry public class ChemMasterComponent : SharedChemMasterComponent, IActivate, IInteractUsing, ISolutionChange { [Dependency] private readonly IServerNotifyManager _notifyManager = default!; - [Dependency] private readonly ILocalizationManager _localizationManager = default!; [ViewVariables] private ContainerSlot _beakerContainer = default!; [ViewVariables] private string _packPrototypeId = ""; @@ -373,7 +372,7 @@ namespace Content.Server.GameObjects.Components.Chemistry if (!args.User.TryGetComponent(out IHandsComponent? hands)) { _notifyManager.PopupMessage(Owner.Transform.GridPosition, args.User, - _localizationManager.GetString("You have no hands.")); + Loc.GetString("You have no hands.")); return; } @@ -396,7 +395,7 @@ namespace Content.Server.GameObjects.Components.Chemistry if (!args.User.TryGetComponent(out IHandsComponent? hands)) { _notifyManager.PopupMessage(Owner.Transform.GridPosition, args.User, - _localizationManager.GetString("You have no hands.")); + Loc.GetString("You have no hands.")); return true; } @@ -413,13 +412,13 @@ namespace Content.Server.GameObjects.Components.Chemistry if (HasBeaker) { _notifyManager.PopupMessage(Owner.Transform.GridPosition, args.User, - _localizationManager.GetString("This ChemMaster already has a container in it.")); + Loc.GetString("This ChemMaster already has a container in it.")); } else if ((solution.Capabilities & SolutionCaps.FitsInDispenser) == 0) //Close enough to a chem master... { //If it can't fit in the chem master, don't put it in. For example, buckets and mop buckets can't fit. _notifyManager.PopupMessage(Owner.Transform.GridPosition, args.User, - _localizationManager.GetString("That can't fit in the ChemMaster.")); + Loc.GetString("That can't fit in the ChemMaster.")); } else { @@ -430,7 +429,7 @@ namespace Content.Server.GameObjects.Components.Chemistry else { _notifyManager.PopupMessage(Owner.Transform.GridPosition, args.User, - _localizationManager.GetString("You can't put this in the ChemMaster.")); + Loc.GetString("You can't put this in the ChemMaster.")); } return true; diff --git a/Content.Server/GameObjects/Components/Chemistry/PourableComponent.cs b/Content.Server/GameObjects/Components/Chemistry/PourableComponent.cs index e11d7d7438..4f6350f0ab 100644 --- a/Content.Server/GameObjects/Components/Chemistry/PourableComponent.cs +++ b/Content.Server/GameObjects/Components/Chemistry/PourableComponent.cs @@ -21,7 +21,6 @@ namespace Content.Server.GameObjects.Components.Chemistry { #pragma warning disable 649 [Dependency] private readonly IServerNotifyManager _notifyManager; - [Dependency] private readonly ILocalizationManager _localizationManager; #pragma warning restore 649 public override string Name => "Pourable"; @@ -91,7 +90,7 @@ namespace Content.Server.GameObjects.Components.Chemistry if (realTransferAmount <= 0) //Special message if container is full { _notifyManager.PopupMessage(Owner.Transform.GridPosition, eventArgs.User, - _localizationManager.GetString("Container is full")); + Loc.GetString("Container is full")); return false; } @@ -101,7 +100,7 @@ namespace Content.Server.GameObjects.Components.Chemistry return false; _notifyManager.PopupMessage(Owner.Transform.GridPosition, eventArgs.User, - _localizationManager.GetString("Transferred {0}u", removedSolution.TotalVolume)); + Loc.GetString("Transferred {0}u", removedSolution.TotalVolume)); return true; } diff --git a/Content.Server/GameObjects/Components/Chemistry/ReagentDispenserComponent.cs b/Content.Server/GameObjects/Components/Chemistry/ReagentDispenserComponent.cs index ae227b58b5..f161403c82 100644 --- a/Content.Server/GameObjects/Components/Chemistry/ReagentDispenserComponent.cs +++ b/Content.Server/GameObjects/Components/Chemistry/ReagentDispenserComponent.cs @@ -40,7 +40,6 @@ namespace Content.Server.GameObjects.Components.Chemistry public class ReagentDispenserComponent : SharedReagentDispenserComponent, IActivate, IInteractUsing, ISolutionChange { [Dependency] private readonly IServerNotifyManager _notifyManager = default!; - [Dependency] private readonly ILocalizationManager _localizationManager = default!; [ViewVariables] private ContainerSlot _beakerContainer = default!; [ViewVariables] private string _packPrototypeId = ""; @@ -286,7 +285,7 @@ namespace Content.Server.GameObjects.Components.Chemistry if (!args.User.TryGetComponent(out IHandsComponent? hands)) { _notifyManager.PopupMessage(Owner.Transform.GridPosition, args.User, - _localizationManager.GetString("You have no hands.")); + Loc.GetString("You have no hands.")); return; } @@ -309,7 +308,7 @@ namespace Content.Server.GameObjects.Components.Chemistry if (!args.User.TryGetComponent(out IHandsComponent? hands)) { _notifyManager.PopupMessage(Owner.Transform.GridPosition, args.User, - _localizationManager.GetString("You have no hands.")); + Loc.GetString("You have no hands.")); return true; } @@ -326,13 +325,13 @@ namespace Content.Server.GameObjects.Components.Chemistry if (HasBeaker) { _notifyManager.PopupMessage(Owner.Transform.GridPosition, args.User, - _localizationManager.GetString("This dispenser already has a container in it.")); + Loc.GetString("This dispenser already has a container in it.")); } else if ((solution.Capabilities & SolutionCaps.FitsInDispenser) == 0) { //If it can't fit in the dispenser, don't put it in. For example, buckets and mop buckets can't fit. _notifyManager.PopupMessage(Owner.Transform.GridPosition, args.User, - _localizationManager.GetString("That can't fit in the dispenser.")); + Loc.GetString("That can't fit in the dispenser.")); } else { @@ -343,7 +342,7 @@ namespace Content.Server.GameObjects.Components.Chemistry else { _notifyManager.PopupMessage(Owner.Transform.GridPosition, args.User, - _localizationManager.GetString("You can't put this in the dispenser.")); + Loc.GetString("You can't put this in the dispenser.")); } return true; diff --git a/Content.Server/GameObjects/Components/Chemistry/SolutionComponent.cs b/Content.Server/GameObjects/Components/Chemistry/SolutionComponent.cs index 53e3ca2463..248d18143a 100644 --- a/Content.Server/GameObjects/Components/Chemistry/SolutionComponent.cs +++ b/Content.Server/GameObjects/Components/Chemistry/SolutionComponent.cs @@ -31,7 +31,6 @@ namespace Content.Server.GameObjects.Components.Chemistry { #pragma warning disable 649 [Dependency] private readonly IPrototypeManager _prototypeManager; - [Dependency] private readonly ILocalizationManager _loc; [Dependency] private readonly IEntitySystemManager _entitySystemManager; #pragma warning restore 649 @@ -276,7 +275,7 @@ namespace Content.Server.GameObjects.Components.Chemistry return; } - message.AddText(_loc.GetString("Contains:\n")); + message.AddText(Loc.GetString("Contains:\n")); if (ReagentList.Count == 0) { message.AddText("Nothing.\n"); @@ -303,12 +302,12 @@ namespace Content.Server.GameObjects.Components.Chemistry colorIsh = "Blue"; } - message.AddText(_loc.GetString("A {0} liquid\n", colorIsh)); + message.AddText(Loc.GetString("A {0} liquid\n", colorIsh)); } } else { - message.AddText(_loc.GetString("Unknown reagent: {0}u\n", reagent.Quantity)); + message.AddText(Loc.GetString("Unknown reagent: {0}u\n", reagent.Quantity)); } } } diff --git a/Content.Server/GameObjects/Components/Fluids/BucketComponent.cs b/Content.Server/GameObjects/Components/Fluids/BucketComponent.cs index 4f9afed4af..e94cc91f43 100644 --- a/Content.Server/GameObjects/Components/Fluids/BucketComponent.cs +++ b/Content.Server/GameObjects/Components/Fluids/BucketComponent.cs @@ -20,8 +20,6 @@ namespace Content.Server.GameObjects.Components.Fluids [RegisterComponent] public class BucketComponent : Component, IInteractUsing { - [Dependency] private readonly ILocalizationManager _localizationManager = default!; - public override string Name => "Bucket"; public ReagentUnit MaxVolume @@ -101,7 +99,7 @@ namespace Content.Server.GameObjects.Components.Fluids return false; } - Owner.PopupMessage(eventArgs.User, _localizationManager.GetString("Splish")); + Owner.PopupMessage(eventArgs.User, Loc.GetString("Splish")); return true; } @@ -119,7 +117,7 @@ namespace Content.Server.GameObjects.Components.Fluids } // Give some visual feedback shit's happening (for anyone who can't hear sound) - Owner.PopupMessage(eventArgs.User, _localizationManager.GetString("Sploosh")); + Owner.PopupMessage(eventArgs.User, Loc.GetString("Sploosh")); if (_sound == null) { diff --git a/Content.Server/GameObjects/Components/Fluids/MopComponent.cs b/Content.Server/GameObjects/Components/Fluids/MopComponent.cs index b24b529b43..11188bcd5f 100644 --- a/Content.Server/GameObjects/Components/Fluids/MopComponent.cs +++ b/Content.Server/GameObjects/Components/Fluids/MopComponent.cs @@ -6,7 +6,6 @@ using Content.Shared.Interfaces.GameObjects.Components; using Robust.Server.GameObjects.EntitySystems; using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Systems; -using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.Serialization; @@ -18,10 +17,6 @@ namespace Content.Server.GameObjects.Components.Fluids [RegisterComponent] public class MopComponent : Component, IAfterInteract { -#pragma warning disable 649 - [Dependency] private readonly ILocalizationManager _localizationManager; -#pragma warning restore 649 - public override string Name => "Mop"; internal SolutionComponent Contents => _contents; private SolutionComponent _contents; @@ -115,7 +110,7 @@ namespace Content.Server.GameObjects.Components.Fluids } // Give some visual feedback shit's happening (for anyone who can't hear sound) - Owner.PopupMessage(eventArgs.User, _localizationManager.GetString("Swish")); + Owner.PopupMessage(eventArgs.User, Loc.GetString("Swish")); if (_pickupSound == null) { diff --git a/Content.Server/GameObjects/Components/Fluids/PuddleComponent.cs b/Content.Server/GameObjects/Components/Fluids/PuddleComponent.cs index cc598e7455..a3703a5e21 100644 --- a/Content.Server/GameObjects/Components/Fluids/PuddleComponent.cs +++ b/Content.Server/GameObjects/Components/Fluids/PuddleComponent.cs @@ -48,7 +48,6 @@ namespace Content.Server.GameObjects.Components.Fluids #pragma warning disable 649 [Dependency] private readonly IMapManager _mapManager; - [Dependency] private readonly ILocalizationManager _loc; #pragma warning restore 649 public override string Name => "Puddle"; @@ -160,7 +159,7 @@ namespace Content.Server.GameObjects.Components.Fluids { if(_slippery) { - message.AddText(_loc.GetString("It looks slippery.")); + message.AddText(Loc.GetString("It looks slippery.")); } } diff --git a/Content.Server/GameObjects/Components/Interactable/HandheldLightComponent.cs b/Content.Server/GameObjects/Components/Interactable/HandheldLightComponent.cs index f581c1957e..aa9e44ee83 100644 --- a/Content.Server/GameObjects/Components/Interactable/HandheldLightComponent.cs +++ b/Content.Server/GameObjects/Components/Interactable/HandheldLightComponent.cs @@ -31,7 +31,6 @@ namespace Content.Server.GameObjects.Components.Interactable internal sealed class HandheldLightComponent : SharedHandheldLightComponent, IUse, IExamine, IInteractUsing, IMapInit { [Dependency] private readonly ISharedNotifyManager _notifyManager = default!; - [Dependency] private readonly ILocalizationManager _localizationManager = default!; [ViewVariables(VVAccess.ReadWrite)] public float Wattage { get; set; } = 10; [ViewVariables] private ContainerSlot _cellContainer = default!; @@ -77,11 +76,9 @@ namespace Content.Server.GameObjects.Components.Interactable void IExamine.Examine(FormattedMessage message, bool inDetailsRange) { - var loc = IoCManager.Resolve(); - if (Activated) { - message.AddMarkup(loc.GetString("The light is currently [color=darkgreen]on[/color].")); + message.AddMarkup(Loc.GetString("The light is currently [color=darkgreen]on[/color].")); } } @@ -151,7 +148,7 @@ namespace Content.Server.GameObjects.Components.Interactable EntitySystem.Get().PlayFromEntity("/Audio/Machines/button.ogg", Owner); - _notifyManager.PopupMessage(Owner, user, _localizationManager.GetString("Cell missing...")); + _notifyManager.PopupMessage(Owner, user, Loc.GetString("Cell missing...")); return; } @@ -161,7 +158,7 @@ namespace Content.Server.GameObjects.Components.Interactable if (Wattage > cell.CurrentCharge) { EntitySystem.Get().PlayFromEntity("/Audio/Machines/button.ogg", Owner); - _notifyManager.PopupMessage(Owner, user, _localizationManager.GetString("Dead cell...")); + _notifyManager.PopupMessage(Owner, user, Loc.GetString("Dead cell...")); return; } diff --git a/Content.Server/GameObjects/Components/Items/DiceComponent.cs b/Content.Server/GameObjects/Components/Items/DiceComponent.cs index 227c0e3c4e..ca12cfd0fd 100644 --- a/Content.Server/GameObjects/Components/Items/DiceComponent.cs +++ b/Content.Server/GameObjects/Components/Items/DiceComponent.cs @@ -85,9 +85,9 @@ namespace Content.Server.GameObjects.Components.Items void IExamine.Examine(FormattedMessage message, bool inDetailsRange) { //No details check, since the sprite updates to show the side. - var loc = IoCManager.Resolve(); - message.AddMarkup(loc.GetString("A dice with [color=lightgray]{0}[/color] sides.\n" + - "It has landed on a [color=white]{1}[/color].", _sides, _currentSide)); + message.AddMarkup(Loc.GetString( + "A dice with [color=lightgray]{0}[/color] sides.\n" + "It has landed on a [color=white]{1}[/color].", + _sides, _currentSide)); } } } diff --git a/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverUsers/BaseCharger.cs b/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverUsers/BaseCharger.cs index 4b78446d42..e0f0f436ed 100644 --- a/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverUsers/BaseCharger.cs +++ b/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverUsers/BaseCharger.cs @@ -13,7 +13,6 @@ using Robust.Server.GameObjects; using Robust.Server.GameObjects.Components.Container; using Robust.Shared.GameObjects; using Robust.Shared.Interfaces.GameObjects; -using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.Serialization; using Robust.Shared.ViewVariables; @@ -76,8 +75,7 @@ namespace Content.Server.GameObjects.Components.Power.ApcNetComponents.PowerRece var result = TryInsertItem(eventArgs.Using); if (!result) { - var localizationManager = IoCManager.Resolve(); - eventArgs.User.PopupMessage(Owner, localizationManager.GetString("Unable to insert capacitor")); + eventArgs.User.PopupMessage(Owner, Loc.GetString("Unable to insert capacitor")); } return result; diff --git a/Content.Server/GameObjects/Components/Rotatable/RotatableComponent.cs b/Content.Server/GameObjects/Components/Rotatable/RotatableComponent.cs index ffbcfbe4cc..6a754cadac 100644 --- a/Content.Server/GameObjects/Components/Rotatable/RotatableComponent.cs +++ b/Content.Server/GameObjects/Components/Rotatable/RotatableComponent.cs @@ -15,7 +15,6 @@ namespace Content.Server.GameObjects.Components.Rotatable { #pragma warning disable 649 [Dependency] private readonly IServerNotifyManager _notifyManager; - [Dependency] private readonly ILocalizationManager _localizationManager; #pragma warning restore 649 public override string Name => "Rotatable"; @@ -25,7 +24,7 @@ namespace Content.Server.GameObjects.Components.Rotatable { if (collidable.Anchored) { - _notifyManager.PopupMessage(Owner.Transform.GridPosition, user, _localizationManager.GetString("It's stuck.")); + _notifyManager.PopupMessage(Owner.Transform.GridPosition, user, Loc.GetString("It's stuck.")); return; } } diff --git a/Content.Server/GameObjects/Components/Stack/StackComponent.cs b/Content.Server/GameObjects/Components/Stack/StackComponent.cs index e38af7a857..d5105efdeb 100644 --- a/Content.Server/GameObjects/Components/Stack/StackComponent.cs +++ b/Content.Server/GameObjects/Components/Stack/StackComponent.cs @@ -107,8 +107,7 @@ namespace Content.Server.GameObjects.Components.Stack { if (inDetailsRange) { - var loc = IoCManager.Resolve(); - message.AddMarkup(loc.GetPluralString( + message.AddMarkup(Loc.GetPluralString( "There is [color=lightgray]1[/color] thing in the stack", "There are [color=lightgray]{0}[/color] things in the stack.", Count, Count)); } diff --git a/Content.Server/GameObjects/Components/Weapon/Melee/FlashComponent.cs b/Content.Server/GameObjects/Components/Weapon/Melee/FlashComponent.cs index 9d12014cda..96468e6e7f 100644 --- a/Content.Server/GameObjects/Components/Weapon/Melee/FlashComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Melee/FlashComponent.cs @@ -23,7 +23,6 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee public class FlashComponent : MeleeWeaponComponent, IUse, IExamine { #pragma warning disable 649 - [Dependency] private readonly ILocalizationManager _localizationManager; [Dependency] private readonly IEntityManager _entityManager; [Dependency] private readonly ISharedNotifyManager _notifyManager; #pragma warning restore 649 @@ -173,10 +172,10 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee if (inDetailsRange) { message.AddMarkup( - _localizationManager.GetString( + Loc.GetString( "The flash has [color=green]{0}[/color] {1} remaining.", Uses, - _localizationManager.GetPluralString("use", "uses", Uses) + Loc.GetPluralString("use", "uses", Uses) ) ); } diff --git a/Content.Server/GameObjects/Components/Weapon/Melee/StunbatonComponent.cs b/Content.Server/GameObjects/Components/Weapon/Melee/StunbatonComponent.cs index 2a3fc9df37..8da76dd33a 100644 --- a/Content.Server/GameObjects/Components/Weapon/Melee/StunbatonComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Melee/StunbatonComponent.cs @@ -33,7 +33,6 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee #pragma warning disable 649 [Dependency] private IRobustRandom _robustRandom; [Dependency] private readonly ISharedNotifyManager _notifyManager; - [Dependency] private readonly ILocalizationManager _localizationManager; #pragma warning restore 649 public override string Name => "Stunbaton"; @@ -168,14 +167,14 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee { EntitySystem.Get().PlayAtCoords("/Audio/Machines/button.ogg", Owner.Transform.GridPosition, AudioHelpers.WithVariation(0.25f)); - _notifyManager.PopupMessage(Owner, user, _localizationManager.GetString("Cell missing...")); + _notifyManager.PopupMessage(Owner, user, Loc.GetString("Cell missing...")); return; } if (cell.CurrentCharge < EnergyPerUse) { EntitySystem.Get().PlayAtCoords("/Audio/Machines/button.ogg", Owner.Transform.GridPosition, AudioHelpers.WithVariation(0.25f)); - _notifyManager.PopupMessage(Owner, user, _localizationManager.GetString("Dead cell...")); + _notifyManager.PopupMessage(Owner, user, Loc.GetString("Dead cell...")); return; } @@ -242,11 +241,9 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee public void Examine(FormattedMessage message, bool inDetailsRange) { - var loc = IoCManager.Resolve(); - if (Activated) { - message.AddMarkup(loc.GetString("The light is currently [color=darkgreen]on[/color].")); + message.AddMarkup(Loc.GetString("The light is currently [color=darkgreen]on[/color].")); } } diff --git a/Content.Server/GameObjects/Components/WiresComponent.cs b/Content.Server/GameObjects/Components/WiresComponent.cs index aa8120e16e..39dfc9c064 100644 --- a/Content.Server/GameObjects/Components/WiresComponent.cs +++ b/Content.Server/GameObjects/Components/WiresComponent.cs @@ -491,9 +491,7 @@ namespace Content.Server.GameObjects.Components void IExamine.Examine(FormattedMessage message, bool inDetailsRange) { - var loc = IoCManager.Resolve(); - - message.AddMarkup(loc.GetString(IsPanelOpen + message.AddMarkup(Loc.GetString(IsPanelOpen ? "The [color=lightgray]maintenance panel[/color] is [color=darkgreen]open[/color]." : "The [color=lightgray]maintenance panel[/color] is [color=darkred]closed[/color].")); } diff --git a/Content.Shared/GameObjects/EntitySystems/SharedConstructionSystem.cs b/Content.Shared/GameObjects/EntitySystems/SharedConstructionSystem.cs index eb046d4902..b19ed13e6d 100644 --- a/Content.Shared/GameObjects/EntitySystems/SharedConstructionSystem.cs +++ b/Content.Shared/GameObjects/EntitySystems/SharedConstructionSystem.cs @@ -2,7 +2,6 @@ using Content.Shared.Construction; using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Systems; -using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.Map; using Robust.Shared.Maths; @@ -13,9 +12,6 @@ namespace Content.Shared.GameObjects.EntitySystems { public class SharedConstructionSystem : EntitySystem { -#pragma warning disable 649 - [Dependency] private readonly ILocalizationManager _loc; -#pragma warning restore 649 /// /// Sent client -> server to to tell the server that we started building /// a structure-construction. @@ -90,7 +86,7 @@ namespace Content.Shared.GameObjects.EntitySystems if (curStage.Backward != null && curStage.Backward is ConstructionStepTool) { var backward = (ConstructionStepTool) curStage.Backward; - message.AddText(_loc.GetString("To deconstruct: {0}x {1} Tool", backward.Amount, backward.ToolQuality)); + message.AddText(Loc.GetString("To deconstruct: {0}x {1} Tool", backward.Amount, backward.ToolQuality)); } if (curStage.Forward != null && curStage.Forward is ConstructionStepMaterial) { @@ -99,7 +95,7 @@ namespace Content.Shared.GameObjects.EntitySystems message.AddText("\n"); } var forward = (ConstructionStepMaterial) curStage.Forward; - message.AddText(_loc.GetString("To construct: {0}x {1}", forward.Amount, forward.Material)); + message.AddText(Loc.GetString("To construct: {0}x {1}", forward.Amount, forward.Material)); } } }