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

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