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

@@ -23,7 +23,6 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
public class FlashComponent : MeleeWeaponComponent, IUse, IExamine
{
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly ISharedNotifyManager _notifyManager = default!;
public override string Name => "Flash";
@@ -101,7 +100,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
{
sprite.LayerSetState(0, "burnt");
_notifyManager.PopupMessage(Owner, user, Loc.GetString("The flash burns out!"));
Owner.PopupMessage(user, Loc.GetString("The flash burns out!"));
}
else if (!_flashing)
{
@@ -155,7 +154,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
if (entity != user)
{
_notifyManager.PopupMessage(user, entity, Loc.GetString("{0:TheName} blinds you with {1:theName}", user, Owner));
user.PopupMessage(entity, Loc.GetString("{0:TheName} blinds you with {1:theName}", user, Owner));
}
}

View File

@@ -31,7 +31,6 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
public class StunbatonComponent : MeleeWeaponComponent, IUse, IExamine, IMapInit, IInteractUsing
{
[Dependency] private readonly IRobustRandom _robustRandom = default!;
[Dependency] private readonly ISharedNotifyManager _notifyManager = default!;
public override string Name => "Stunbaton";
@@ -165,14 +164,14 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
{
EntitySystem.Get<AudioSystem>().PlayAtCoords("/Audio/Machines/button.ogg", Owner.Transform.GridPosition, AudioHelpers.WithVariation(0.25f));
_notifyManager.PopupMessage(Owner, user, Loc.GetString("Cell missing..."));
Owner.PopupMessage(user, Loc.GetString("Cell missing..."));
return;
}
if (cell.CurrentCharge < EnergyPerUse)
{
EntitySystem.Get<AudioSystem>().PlayAtCoords("/Audio/Machines/button.ogg", Owner.Transform.GridPosition, AudioHelpers.WithVariation(0.25f));
_notifyManager.PopupMessage(Owner, user, Loc.GetString("Dead cell..."));
Owner.PopupMessage(user, Loc.GetString("Dead cell..."));
return;
}