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

@@ -1,11 +1,10 @@
#nullable enable
using Content.Server.Interfaces;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.GameObjects.Verbs;
using Content.Shared.Interfaces;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Components;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Serialization;
@@ -14,8 +13,6 @@ namespace Content.Server.GameObjects.Components.Rotatable
[RegisterComponent]
public class FlippableComponent : Component
{
[Dependency] private readonly IServerNotifyManager _notifyManager = default!;
public override string Name => "Flippable";
private string? _entity;
@@ -25,7 +22,7 @@ namespace Content.Server.GameObjects.Components.Rotatable
if (Owner.TryGetComponent(out ICollidableComponent? collidable) &&
collidable.Anchored)
{
_notifyManager.PopupMessage(Owner.Transform.GridPosition, user, Loc.GetString("It's stuck."));
Owner.PopupMessage(user, Loc.GetString("It's stuck."));
return;
}

View File

@@ -1,10 +1,9 @@
using Content.Server.Interfaces;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.GameObjects.Verbs;
using Content.Shared.Interfaces;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Components;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Maths;
@@ -13,8 +12,6 @@ namespace Content.Server.GameObjects.Components.Rotatable
[RegisterComponent]
public class RotatableComponent : Component
{
[Dependency] private readonly IServerNotifyManager _notifyManager = default!;
public override string Name => "Rotatable";
private void TryRotate(IEntity user, Angle angle)
@@ -23,7 +20,7 @@ namespace Content.Server.GameObjects.Components.Rotatable
{
if (collidable.Anchored)
{
_notifyManager.PopupMessage(Owner.Transform.GridPosition, user, Loc.GetString("It's stuck."));
Owner.PopupMessage(user, Loc.GetString("It's stuck."));
return;
}
}