Replace usages of ISharedNotifyManager and IServerNotifyManager with extension methods (#1965)

* Replace usages of ISharedNotifyManager and IServerNotifyManager with extension methods

* Remove redundant code
This commit is contained in:
DrSmugleaf
2020-09-01 12:34:53 +02:00
committed by GitHub
parent 14259ed920
commit 8f9ed2f562
53 changed files with 247 additions and 375 deletions

View File

@@ -12,7 +12,6 @@ using Content.Server.GameObjects.Components.GUI;
using Content.Server.GameObjects.Components.Items.Storage;
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces;
using Content.Server.Interfaces.Chat;
using Content.Server.Interfaces.GameObjects;
using Content.Server.Utility;
@@ -27,7 +26,6 @@ using Robust.Server.GameObjects.Components.Container;
using Robust.Server.GameObjects.Components.UserInterface;
using Robust.Server.GameObjects.EntitySystems;
using Robust.Server.Interfaces.GameObjects;
using Robust.Server.Interfaces.Player;
using Robust.Shared.Audio;
using Robust.Shared.GameObjects.Systems;
using Content.Shared.GameObjects.Components.Body;
@@ -44,8 +42,6 @@ namespace Content.Server.GameObjects.Components.Kitchen
{
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly RecipeManager _recipeManager = default!;
[Dependency] private readonly IServerNotifyManager _notifyManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
#region YAMLSERIALIZE
private int _cookTimeDefault;
@@ -206,8 +202,7 @@ namespace Content.Server.GameObjects.Components.Kitchen
{
if (!Powered)
{
_notifyManager.PopupMessage(Owner.Transform.GridPosition, eventArgs.User,
Loc.GetString("It has no power!"));
Owner.PopupMessage(eventArgs.User, Loc.GetString("It has no power!"));
return false;
}
@@ -215,7 +210,7 @@ namespace Content.Server.GameObjects.Components.Kitchen
if (itemEntity == null)
{
eventArgs.User.PopupMessage(eventArgs.User, Loc.GetString("You have no active hand!"));
eventArgs.User.PopupMessage(Loc.GetString("You have no active hand!"));
return false;
}
@@ -236,8 +231,7 @@ namespace Content.Server.GameObjects.Components.Kitchen
var realTransferAmount = ReagentUnit.Min(attackPourable.TransferAmount, solution.EmptyVolume);
if (realTransferAmount <= 0) //Special message if container is full
{
_notifyManager.PopupMessage(Owner.Transform.GridPosition, eventArgs.User,
Loc.GetString("Container is full"));
Owner.PopupMessage(eventArgs.User, Loc.GetString("Container is full"));
return false;
}
@@ -248,15 +242,14 @@ namespace Content.Server.GameObjects.Components.Kitchen
return false;
}
_notifyManager.PopupMessage(Owner.Transform.GridPosition, eventArgs.User,
Loc.GetString("Transferred {0}u", removedSolution.TotalVolume));
Owner.PopupMessage(eventArgs.User, Loc.GetString("Transferred {0}u", removedSolution.TotalVolume));
return true;
}
if (!itemEntity.TryGetComponent(typeof(ItemComponent), out var food))
{
_notifyManager.PopupMessage(Owner, eventArgs.User, "That won't work!");
Owner.PopupMessage(eventArgs.User, "That won't work!");
return false;
}