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

@@ -5,7 +5,6 @@ using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.Interfaces;
using Content.Shared.Interfaces.GameObjects.Components;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Map;
using Robust.Shared.Timers;
@@ -19,8 +18,6 @@ namespace Content.Server.GameObjects.Components.Stack
[RegisterComponent]
public class StackComponent : SharedStackComponent, IInteractUsing, IExamine
{
[Dependency] private readonly ISharedNotifyManager _sharedNotifyManager = default!;
private bool _throwIndividually = false;
public override int Count
@@ -82,20 +79,19 @@ namespace Content.Server.GameObjects.Components.Stack
if (toTransfer > 0)
{
_sharedNotifyManager.PopupMessage(popupPos, eventArgs.User, $"+{toTransfer}");
popupPos.PopupMessage(eventArgs.User, $"+{toTransfer}");
if (stack.AvailableSpace == 0)
{
Timer.Spawn(300, () => _sharedNotifyManager.PopupMessage(popupPos, eventArgs.User, "Stack is now full."));
Timer.Spawn(300, () => popupPos.PopupMessage(eventArgs.User, "Stack is now full."));
}
return true;
}
else if (toTransfer == 0 && stack.AvailableSpace == 0)
{
_sharedNotifyManager.PopupMessage(popupPos, eventArgs.User, "Stack is already full.");
popupPos.PopupMessage(eventArgs.User, "Stack is already full.");
}
}
return false;