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:
@@ -6,12 +6,12 @@ using System.Threading.Tasks;
|
||||
using Content.Server.GameObjects.Components.Interactable;
|
||||
using Content.Server.GameObjects.Components.VendingMachines;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Server.Interfaces;
|
||||
using Content.Server.Interfaces.GameObjects.Components.Items;
|
||||
using Content.Server.Utility;
|
||||
using Content.Shared.GameObjects.Components;
|
||||
using Content.Shared.GameObjects.Components.Interactable;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
using Content.Shared.Interfaces;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Content.Shared.Utility;
|
||||
using JetBrains.Annotations;
|
||||
@@ -36,7 +36,6 @@ namespace Content.Server.GameObjects.Components
|
||||
public class WiresComponent : SharedWiresComponent, IInteractUsing, IExamine, IMapInit
|
||||
{
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly IServerNotifyManager _notifyManager = default!;
|
||||
|
||||
private AudioSystem _audioSystem = default!;
|
||||
|
||||
@@ -384,15 +383,13 @@ namespace Content.Server.GameObjects.Components
|
||||
|
||||
if (!player.TryGetComponent(out IHandsComponent? handsComponent))
|
||||
{
|
||||
_notifyManager.PopupMessage(Owner.Transform.GridPosition, player,
|
||||
Loc.GetString("You have no hands."));
|
||||
Owner.PopupMessage(player, Loc.GetString("You have no hands."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!player.InRangeUnobstructed(Owner))
|
||||
{
|
||||
_notifyManager.PopupMessage(Owner.Transform.GridPosition, player,
|
||||
Loc.GetString("You can't reach there!"));
|
||||
Owner.PopupMessage(player, Loc.GetString("You can't reach there!"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -405,8 +402,7 @@ namespace Content.Server.GameObjects.Components
|
||||
case WiresAction.Cut:
|
||||
if (tool == null || !tool.HasQuality(ToolQuality.Cutting))
|
||||
{
|
||||
_notifyManager.PopupMessageCursor(player,
|
||||
Loc.GetString("You need to hold a wirecutter in your hand!"));
|
||||
player.PopupMessageCursor(Loc.GetString("You need to hold a wirecutter in your hand!"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -417,8 +413,7 @@ namespace Content.Server.GameObjects.Components
|
||||
case WiresAction.Mend:
|
||||
if (tool == null || !tool.HasQuality(ToolQuality.Cutting))
|
||||
{
|
||||
_notifyManager.PopupMessageCursor(player,
|
||||
Loc.GetString("You need to hold a wirecutter in your hand!"));
|
||||
player.PopupMessageCursor(Loc.GetString("You need to hold a wirecutter in your hand!"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -429,15 +424,13 @@ namespace Content.Server.GameObjects.Components
|
||||
case WiresAction.Pulse:
|
||||
if (tool == null || !tool.HasQuality(ToolQuality.Multitool))
|
||||
{
|
||||
_notifyManager.PopupMessageCursor(player,
|
||||
Loc.GetString("You need to hold a multitool in your hand!"));
|
||||
player.PopupMessageCursor(Loc.GetString("You need to hold a multitool in your hand!"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (wire.IsCut)
|
||||
{
|
||||
_notifyManager.PopupMessageCursor(player,
|
||||
Loc.GetString("You can't pulse a wire that's been cut!"));
|
||||
player.PopupMessageCursor(Loc.GetString("You can't pulse a wire that's been cut!"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user