Remove localization manager dependencies from components (#1864)

Co-authored-by: Víctor Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
This commit is contained in:
DrSmugleaf
2020-08-23 12:53:09 +02:00
committed by GitHub
parent 0b4ca168d4
commit a4a25a9975
22 changed files with 73 additions and 117 deletions

View File

@@ -21,6 +21,10 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
/// </summary>
public class ChemMasterWindow : SS14Window
{
#pragma warning disable 649
[Dependency] private readonly IPrototypeManager _prototypeManager;
#pragma warning restore 649
/// <summary>Contains info about the reagent container such as it's contents, if one is loaded into the dispenser.</summary>
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);
/// <summary>
@@ -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))
{

View File

@@ -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();

View File

@@ -20,6 +20,10 @@ namespace Content.Client.GameObjects.Components.Chemistry.ReagentDispenser
/// </summary>
public class ReagentDispenserWindow : SS14Window
{
#pragma warning disable 649
[Dependency] private readonly IPrototypeManager _prototypeManager;
#pragma warning restore 649
/// <summary>Contains info about the reagent container such as it's contents, if one is loaded into the dispenser.</summary>
private readonly VBoxContainer ContainerInfo;
@@ -50,11 +54,6 @@ namespace Content.Client.GameObjects.Components.Chemistry.ReagentDispenser
/// <summary>A grid of buttons for each reagent which can be dispensed.</summary>
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);
/// <summary>
@@ -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))
{

View File

@@ -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<SharedConstructionSystem>().DoExamine(message, Prototype, 0, inDetailsRange);
}
}

View File

@@ -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};

View File

@@ -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();

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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));
}
}
}

View File

@@ -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)
{

View File

@@ -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)
{

View File

@@ -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."));
}
}

View File

@@ -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<ILocalizationManager>();
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<AudioSystem>().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<AudioSystem>().PlayFromEntity("/Audio/Machines/button.ogg", Owner);
_notifyManager.PopupMessage(Owner, user, _localizationManager.GetString("Dead cell..."));
_notifyManager.PopupMessage(Owner, user, Loc.GetString("Dead cell..."));
return;
}

View File

@@ -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<ILocalizationManager>();
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));
}
}
}

View File

@@ -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<ILocalizationManager>();
eventArgs.User.PopupMessage(Owner, localizationManager.GetString("Unable to insert capacitor"));
eventArgs.User.PopupMessage(Owner, Loc.GetString("Unable to insert capacitor"));
}
return result;

View File

@@ -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;
}
}

View File

@@ -107,8 +107,7 @@ namespace Content.Server.GameObjects.Components.Stack
{
if (inDetailsRange)
{
var loc = IoCManager.Resolve<ILocalizationManager>();
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));
}

View File

@@ -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)
)
);
}

View File

@@ -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<AudioSystem>().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<AudioSystem>().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<ILocalizationManager>();
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]."));
}
}

View File

@@ -491,9 +491,7 @@ namespace Content.Server.GameObjects.Components
void IExamine.Examine(FormattedMessage message, bool inDetailsRange)
{
var loc = IoCManager.Resolve<ILocalizationManager>();
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]."));
}

View File

@@ -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
/// <summary>
/// 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));
}
}
}