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,10 +1,9 @@
using System;
using Content.Server.Interfaces;
using Content.Server.Interfaces.GameObjects.Components.Items;
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.Serialization;
using Robust.Shared.Utility;
@@ -15,8 +14,6 @@ namespace Content.Server.GameObjects.Components.Items.RCD
[RegisterComponent]
public class RCDAmmoComponent : Component, IAfterInteract, IExamine
{
[Dependency] private IServerNotifyManager _serverNotifyManager = default!;
public override string Name => "RCDAmmo";
//How much ammo we refill
@@ -43,17 +40,16 @@ namespace Content.Server.GameObjects.Components.Items.RCD
if (rcdComponent.maxAmmo - rcdComponent._ammo < refillAmmo)
{
_serverNotifyManager.PopupMessage(rcdComponent.Owner, eventArgs.User, "The RCD is full!");
rcdComponent.Owner.PopupMessage(eventArgs.User, Loc.GetString("The RCD is full!"));
return;
}
rcdComponent._ammo = Math.Min(rcdComponent.maxAmmo, rcdComponent._ammo + refillAmmo);
_serverNotifyManager.PopupMessage(rcdComponent.Owner, eventArgs.User, "You refill the RCD.");
rcdComponent.Owner.PopupMessage(eventArgs.User, Loc.GetString("You refill the RCD."));
//Deleting a held item causes a lot of errors
hands.Drop(Owner, false);
Owner.Delete();
}
}
}