From 8f9ed2f562eeb2e1971c991090bf3c923b7ead17 Mon Sep 17 00:00:00 2001 From: DrSmugleaf Date: Tue, 1 Sep 2020 12:34:53 +0200 Subject: [PATCH] Replace usages of ISharedNotifyManager and IServerNotifyManager with extension methods (#1965) * Replace usages of ISharedNotifyManager and IServerNotifyManager with extension methods * Remove redundant code --- .../UserInterface/Suspicion/SuspicionGui.cs | 2 +- Content.Server/Atmos/GasSprayerComponent.cs | 6 +- .../Body/Surgery/BiologicalSurgeryData.cs | 14 ++--- Content.Server/Chat/ChatCommands.cs | 2 - .../Access/IdCardConsoleComponent.cs | 7 +-- .../ActionBlocking/CuffableComponent.cs | 23 +++----- .../ActionBlocking/HandcuffComponent.cs | 25 ++++---- .../Components/Atmos/GasAnalyzerComponent.cs | 12 ++-- .../Body/DroppedBodyPartComponent.cs | 14 ++--- .../Body/DroppedMechanismComponent.cs | 13 ++-- .../Components/Body/SurgeryToolComponent.cs | 11 +--- .../Components/Buckle/BuckleComponent.cs | 59 ++++++++----------- .../Chemistry/ChemMasterComponent.cs | 23 +++----- .../Components/Chemistry/InjectorComponent.cs | 25 +++----- .../Components/Chemistry/PourableComponent.cs | 11 +--- .../Chemistry/ReagentDispenserComponent.cs | 25 +++----- .../Conveyor/ConveyorSwitchComponent.cs | 2 +- .../Disposal/DisposalRouterComponent.cs | 7 +-- .../Disposal/DisposalTaggerComponent.cs | 7 +-- .../Disposal/DisposalUnitComponent.cs | 12 ++-- .../Components/Doors/AirlockComponent.cs | 7 +-- .../Components/Fluids/SprayComponent.cs | 5 +- .../Components/GUI/InventoryComponent.cs | 6 +- .../Components/GUI/StrippableComponent.cs | 36 +++++------ .../Gravity/GravityGeneratorComponent.cs | 6 +- .../Instruments/InstrumentComponent.cs | 10 ++-- .../Interactable/HandheldLightComponent.cs | 7 +-- .../Interactable/WelderComponent.cs | 12 ++-- .../Items/Clothing/ClothingComponent.cs | 7 +-- .../Components/Items/RCD/RCDAmmoComponent.cs | 10 +--- .../Components/Items/RCD/RCDComponent.cs | 24 ++++---- .../Storage/SecureEntityStorageComponent.cs | 3 +- .../Components/Kitchen/MicrowaveComponent.cs | 17 ++---- .../MachineLinking/SignalReceiverComponent.cs | 2 +- .../Mobs/ServerStatusEffectsComponent.cs | 2 +- .../Components/Movement/ClimbableComponent.cs | 2 +- .../Components/Nutrition/DrinkComponent.cs | 8 +-- .../Components/Nutrition/FoodComponent.cs | 4 +- .../Power/AME/AMEControllerComponent.cs | 23 +++----- .../Components/Power/AME/AMEPartComponent.cs | 7 +-- .../PoweredLightComponent.cs | 4 +- .../GameObjects/Components/RadioComponent.cs | 6 +- .../Rotatable/FlippableComponent.cs | 7 +-- .../Rotatable/RotatableComponent.cs | 9 +-- .../Components/Stack/StackComponent.cs | 12 ++-- .../Components/Weapon/Melee/FlashComponent.cs | 5 +- .../Weapon/Melee/StunbatonComponent.cs | 5 +- .../Ranged/ServerRangedWeaponComponent.cs | 2 +- .../GameObjects/Components/WiresComponent.cs | 21 +++---- .../GameObjects/EntitySystems/HandsSystem.cs | 13 ++-- .../EntitySystems/PointingSystem.cs | 2 +- .../EntitySystems/SharedInteractionSystem.cs | 8 +-- .../Interfaces/ISharedNotifyManager.cs | 30 +++++++++- 53 files changed, 247 insertions(+), 375 deletions(-) diff --git a/Content.Client/UserInterface/Suspicion/SuspicionGui.cs b/Content.Client/UserInterface/Suspicion/SuspicionGui.cs index e466eb8074..5d8c5361b8 100644 --- a/Content.Client/UserInterface/Suspicion/SuspicionGui.cs +++ b/Content.Client/UserInterface/Suspicion/SuspicionGui.cs @@ -66,7 +66,7 @@ namespace Content.Client.UserInterface.Suspicion _ => throw new ArgumentException($"Invalid number of allies: {role.Allies.Count}") }; - role.Owner.PopupMessage(role.Owner, message); + role.Owner.PopupMessage(message); } private bool TryGetComponent(out SuspicionRoleComponent suspicion) diff --git a/Content.Server/Atmos/GasSprayerComponent.cs b/Content.Server/Atmos/GasSprayerComponent.cs index b8460f91dd..7bcb9361d9 100644 --- a/Content.Server/Atmos/GasSprayerComponent.cs +++ b/Content.Server/Atmos/GasSprayerComponent.cs @@ -1,7 +1,7 @@ using Content.Server.GameObjects.Components.Chemistry; -using Content.Server.Interfaces; using Content.Shared.Chemistry; using Content.Shared.GameObjects.Components; +using Content.Shared.Interfaces; using Content.Shared.Interfaces.GameObjects.Components; using Robust.Server.GameObjects; using Robust.Server.GameObjects.EntitySystems; @@ -13,13 +13,11 @@ using Robust.Shared.Localization; using Robust.Shared.Maths; using Robust.Shared.Serialization; - namespace Content.Server.Atmos { [RegisterComponent] public class GasSprayerComponent : Component, IAfterInteract { - [Dependency] private readonly IServerNotifyManager _notifyManager = default!; [Dependency] private readonly IServerEntityManager _serverEntityManager = default!; //TODO: create a function that can create a gas based on a solution mix @@ -48,7 +46,7 @@ namespace Content.Server.Atmos if (tank.Solution.GetReagentQuantity(_fuelType) == 0) { - _notifyManager.PopupMessage(Owner, eventArgs.User, + Owner.PopupMessage(eventArgs.User, Loc.GetString("{0:theName} is out of {1}!", Owner, _fuelName)); } else diff --git a/Content.Server/Body/Surgery/BiologicalSurgeryData.cs b/Content.Server/Body/Surgery/BiologicalSurgeryData.cs index f1bff3a145..fb8769f116 100644 --- a/Content.Server/Body/Surgery/BiologicalSurgeryData.cs +++ b/Content.Server/Body/Surgery/BiologicalSurgeryData.cs @@ -131,7 +131,7 @@ namespace Content.Server.Body.Surgery private void OpenSkinSurgery(IBodyPartContainer container, ISurgeon surgeon, IEntity performer) { - performer.PopupMessage(performer, Loc.GetString("Cut open the skin...")); + performer.PopupMessage(Loc.GetString("Cut open the skin...")); // TODO do_after: Delay _skinOpened = true; @@ -139,7 +139,7 @@ namespace Content.Server.Body.Surgery private void ClampVesselsSurgery(IBodyPartContainer container, ISurgeon surgeon, IEntity performer) { - performer.PopupMessage(performer, Loc.GetString("Clamp the vessels...")); + performer.PopupMessage(Loc.GetString("Clamp the vessels...")); // TODO do_after: Delay _vesselsClamped = true; @@ -147,7 +147,7 @@ namespace Content.Server.Body.Surgery private void RetractSkinSurgery(IBodyPartContainer container, ISurgeon surgeon, IEntity performer) { - performer.PopupMessage(performer, Loc.GetString("Retract the skin...")); + performer.PopupMessage(Loc.GetString("Retract the skin...")); // TODO do_after: Delay _skinRetracted = true; @@ -155,7 +155,7 @@ namespace Content.Server.Body.Surgery private void CauterizeIncisionSurgery(IBodyPartContainer container, ISurgeon surgeon, IEntity performer) { - performer.PopupMessage(performer, Loc.GetString("Cauterize the incision...")); + performer.PopupMessage(Loc.GetString("Cauterize the incision...")); // TODO do_after: Delay _skinOpened = false; @@ -193,7 +193,7 @@ namespace Content.Server.Body.Surgery return; } - performer.PopupMessage(performer, Loc.GetString("Loosen the organ...")); + performer.PopupMessage(Loc.GetString("Loosen the organ...")); // TODO do_after: Delay _disconnectedOrgans.Add(target); @@ -224,7 +224,7 @@ namespace Content.Server.Body.Surgery return; } - performer.PopupMessage(performer, Loc.GetString("Remove the organ...")); + performer.PopupMessage(Loc.GetString("Remove the organ...")); // TODO do_after: Delay Parent.TryDropMechanism(performer, target, out _); @@ -240,7 +240,7 @@ namespace Content.Server.Body.Surgery } var bmTarget = (BodyManagerComponent) container; - performer.PopupMessage(performer, Loc.GetString("Saw off the limb!")); + performer.PopupMessage(Loc.GetString("Saw off the limb!")); // TODO do_after: Delay bmTarget.DisconnectBodyPart(Parent, true); diff --git a/Content.Server/Chat/ChatCommands.cs b/Content.Server/Chat/ChatCommands.cs index 302d0add91..5359402df3 100644 --- a/Content.Server/Chat/ChatCommands.cs +++ b/Content.Server/Chat/ChatCommands.cs @@ -5,7 +5,6 @@ using Content.Server.GameObjects.Components.Items.Storage; using Content.Server.GameObjects.Components.Observer; using Content.Server.Interfaces.Chat; using Content.Server.Interfaces.GameObjects; -using Content.Server.Interfaces; using Content.Server.Observer; using Content.Server.Players; using Content.Server.Utility; @@ -120,7 +119,6 @@ namespace Content.Server.Chat internal class SuicideCommand : IClientCommand { [Dependency] private readonly IPlayerManager _playerManager = default!; - [Dependency] private readonly IServerNotifyManager _notifyManager = default!; public string Command => "suicide"; diff --git a/Content.Server/GameObjects/Components/Access/IdCardConsoleComponent.cs b/Content.Server/GameObjects/Components/Access/IdCardConsoleComponent.cs index 1183e461b2..83fd5e207f 100644 --- a/Content.Server/GameObjects/Components/Access/IdCardConsoleComponent.cs +++ b/Content.Server/GameObjects/Components/Access/IdCardConsoleComponent.cs @@ -2,11 +2,11 @@ using System.Collections.Generic; using System.Linq; using Content.Server.GameObjects.Components.Items.Storage; -using Content.Server.Interfaces; using Content.Server.Interfaces.GameObjects.Components.Items; using Content.Server.Utility; using Content.Shared.Access; using Content.Shared.GameObjects.Components.Access; +using Content.Shared.Interfaces; using Content.Shared.Interfaces.GameObjects.Components; using Robust.Server.GameObjects.Components.Container; using Robust.Server.GameObjects.Components.UserInterface; @@ -25,7 +25,6 @@ namespace Content.Server.GameObjects.Components.Access [ComponentReference(typeof(IActivate))] public class IdCardConsoleComponent : SharedIdCardConsoleComponent, IActivate { - [Dependency] private readonly IServerNotifyManager _notifyManager = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!; private ContainerSlot _privilegedIdContainer = default!; @@ -132,7 +131,7 @@ namespace Content.Server.GameObjects.Components.Access { if (!user.TryGetComponent(out IHandsComponent? hands)) { - _notifyManager.PopupMessage(Owner.Transform.GridPosition, user, Loc.GetString("You have no hands.")); + Owner.PopupMessage(user, Loc.GetString("You have no hands.")); return; } @@ -161,7 +160,7 @@ namespace Content.Server.GameObjects.Components.Access if (!hands.Drop(hands.ActiveHand, container)) { - _notifyManager.PopupMessage(Owner.Transform.GridPosition, user, Loc.GetString("You can't let go of the ID card!")); + Owner.PopupMessage(user, Loc.GetString("You can't let go of the ID card!")); return; } UpdateUserInterface(); diff --git a/Content.Server/GameObjects/Components/ActionBlocking/CuffableComponent.cs b/Content.Server/GameObjects/Components/ActionBlocking/CuffableComponent.cs index 890d2d576f..79473ac91c 100644 --- a/Content.Server/GameObjects/Components/ActionBlocking/CuffableComponent.cs +++ b/Content.Server/GameObjects/Components/ActionBlocking/CuffableComponent.cs @@ -4,7 +4,6 @@ using Content.Shared.Interfaces; using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Systems; using Robust.Shared.Interfaces.GameObjects; -using Robust.Shared.IoC; using Robust.Shared.Localization; using Content.Server.GameObjects.EntitySystems.DoAfter; using Robust.Shared.ViewVariables; @@ -22,7 +21,6 @@ using Robust.Shared.Maths; using System; using System.Collections.Generic; using Content.Shared.Utility; -using Serilog; using Content.Server.GameObjects.Components.GUI; namespace Content.Server.GameObjects.Components.ActionBlocking @@ -30,9 +28,6 @@ namespace Content.Server.GameObjects.Components.ActionBlocking [RegisterComponent] public class CuffableComponent : SharedCuffableComponent { - [Dependency] - private readonly ISharedNotifyManager _notifyManager; - /// /// How many of this entity's hands are currently cuffed. /// @@ -231,13 +226,13 @@ namespace Content.Server.GameObjects.Components.ActionBlocking if (!isOwner && !ActionBlockerSystem.CanInteract(user)) { - user.PopupMessage(user, Loc.GetString("You can't do that!")); + user.PopupMessage(Loc.GetString("You can't do that!")); return; } if (!isOwner && user.InRangeUnobstructed(Owner, _interactRange)) { - user.PopupMessage(user, Loc.GetString("You are too far away to remove the cuffs.")); + user.PopupMessage(Loc.GetString("You are too far away to remove the cuffs.")); return; } @@ -247,7 +242,7 @@ namespace Content.Server.GameObjects.Components.ActionBlocking return; } - user.PopupMessage(user, Loc.GetString("You start removing the cuffs.")); + user.PopupMessage(Loc.GetString("You start removing the cuffs.")); var audio = EntitySystem.Get(); audio.PlayFromEntity(isOwner ? cuff.StartBreakoutSound : cuff.StartUncuffSound, Owner); @@ -292,29 +287,29 @@ namespace Content.Server.GameObjects.Components.ActionBlocking if (CuffedHandCount == 0) { - _notifyManager.PopupMessage(user, user, Loc.GetString("You successfully remove the cuffs.")); + user.PopupMessage(Loc.GetString("You successfully remove the cuffs.")); if (!isOwner) { - _notifyManager.PopupMessage(user, Owner, Loc.GetString("{0:theName} uncuffs your hands.", user)); + user.PopupMessage(Owner, Loc.GetString("{0:theName} uncuffs your hands.", user)); } } else { if (!isOwner) { - _notifyManager.PopupMessage(user, user, Loc.GetString("You successfully remove the cuffs. {0} of {1:theName}'s hands remain cuffed.", CuffedHandCount, user)); - _notifyManager.PopupMessage(user, Owner, Loc.GetString("{0:theName} removes your cuffs. {1} of your hands remain cuffed.", user, CuffedHandCount)); + user.PopupMessage(Loc.GetString("You successfully remove the cuffs. {0} of {1:theName}'s hands remain cuffed.", CuffedHandCount, user)); + user.PopupMessage(Owner, Loc.GetString("{0:theName} removes your cuffs. {1} of your hands remain cuffed.", user, CuffedHandCount)); } else { - _notifyManager.PopupMessage(user, user, Loc.GetString("You successfully remove the cuffs. {0} of your hands remain cuffed.", CuffedHandCount)); + user.PopupMessage(Loc.GetString("You successfully remove the cuffs. {0} of your hands remain cuffed.", CuffedHandCount)); } } } else { - _notifyManager.PopupMessage(user, user, Loc.GetString("You fail to remove the cuffs.")); + user.PopupMessage(Loc.GetString("You fail to remove the cuffs.")); } return; diff --git a/Content.Server/GameObjects/Components/ActionBlocking/HandcuffComponent.cs b/Content.Server/GameObjects/Components/ActionBlocking/HandcuffComponent.cs index 2f7d8e6aab..8b6f64d098 100644 --- a/Content.Server/GameObjects/Components/ActionBlocking/HandcuffComponent.cs +++ b/Content.Server/GameObjects/Components/ActionBlocking/HandcuffComponent.cs @@ -23,9 +23,6 @@ namespace Content.Server.GameObjects.Components.ActionBlocking [RegisterComponent] public class HandcuffComponent : SharedHandcuffComponent, IAfterInteract { - [Dependency] - private readonly ISharedNotifyManager _notifyManager; - /// /// The time it takes to apply a to an entity. /// @@ -161,36 +158,36 @@ namespace Content.Server.GameObjects.Components.ActionBlocking if (eventArgs.Target == eventArgs.User) { - _notifyManager.PopupMessage(eventArgs.User, eventArgs.User, Loc.GetString("You can't cuff yourself!")); + eventArgs.User.PopupMessage(Loc.GetString("You can't cuff yourself!")); return; } if (Broken) { - _notifyManager.PopupMessage(eventArgs.User, eventArgs.User, Loc.GetString("The cuffs are broken!")); + eventArgs.User.PopupMessage(Loc.GetString("The cuffs are broken!")); return; } if (!eventArgs.Target.TryGetComponent(out var hands)) { - _notifyManager.PopupMessage(eventArgs.User, eventArgs.User, Loc.GetString("{0:theName} has no hands!", eventArgs.Target)); + eventArgs.User.PopupMessage(Loc.GetString("{0:theName} has no hands!", eventArgs.Target)); return; } if (cuffed.CuffedHandCount == hands.Count) { - _notifyManager.PopupMessage(eventArgs.User, eventArgs.User, Loc.GetString("{0:theName} has no free hands to handcuff!", eventArgs.Target)); + eventArgs.User.PopupMessage(Loc.GetString("{0:theName} has no free hands to handcuff!", eventArgs.Target)); return; } if (!eventArgs.InRangeUnobstructed(_interactRange, ignoreInsideBlocker: true)) { - _notifyManager.PopupMessage(eventArgs.User, eventArgs.User, Loc.GetString("You are too far away to use the cuffs!")); + eventArgs.User.PopupMessage(Loc.GetString("You are too far away to use the cuffs!")); return; } - _notifyManager.PopupMessage(eventArgs.User, eventArgs.User, Loc.GetString("You start cuffing {0:theName}.", eventArgs.Target)); - _notifyManager.PopupMessage(eventArgs.User, eventArgs.Target, Loc.GetString("{0:theName} starts cuffing you!", eventArgs.User)); + eventArgs.User.PopupMessage(Loc.GetString("You start cuffing {0:theName}.", eventArgs.Target)); + eventArgs.User.PopupMessage(eventArgs.Target, Loc.GetString("{0:theName} starts cuffing you!", eventArgs.User)); _audioSystem.PlayFromEntity(StartCuffSound, Owner); TryUpdateCuff(eventArgs.User, eventArgs.Target, cuffed); @@ -222,8 +219,8 @@ namespace Content.Server.GameObjects.Components.ActionBlocking if (result != DoAfterStatus.Cancelled) { _audioSystem.PlayFromEntity(EndCuffSound, Owner); - _notifyManager.PopupMessage(user, user, Loc.GetString("You successfully cuff {0:theName}.", target)); - _notifyManager.PopupMessage(target, target, Loc.GetString("You have been cuffed by {0:theName}!", user)); + user.PopupMessage(Loc.GetString("You successfully cuff {0:theName}.", target)); + target.PopupMessage(Loc.GetString("You have been cuffed by {0:theName}!", user)); if (user.TryGetComponent(out var hands)) { @@ -237,8 +234,8 @@ namespace Content.Server.GameObjects.Components.ActionBlocking } else { - user.PopupMessage(user, Loc.GetString("You were interrupted while cuffing {0:theName}!", target)); - target.PopupMessage(target, Loc.GetString("You interrupt {0:theName} while they are cuffing you!", user)); + user.PopupMessage(Loc.GetString("You were interrupted while cuffing {0:theName}!", target)); + target.PopupMessage(Loc.GetString("You interrupt {0:theName} while they are cuffing you!", user)); } } } diff --git a/Content.Server/GameObjects/Components/Atmos/GasAnalyzerComponent.cs b/Content.Server/GameObjects/Components/Atmos/GasAnalyzerComponent.cs index 9c4c0c44d9..58ba7c67eb 100644 --- a/Content.Server/GameObjects/Components/Atmos/GasAnalyzerComponent.cs +++ b/Content.Server/GameObjects/Components/Atmos/GasAnalyzerComponent.cs @@ -1,12 +1,12 @@ #nullable enable using System.Collections.Generic; using Content.Server.GameObjects.EntitySystems; -using Content.Server.Interfaces; using Content.Server.Interfaces.GameObjects.Components.Items; using Content.Server.Utility; using Content.Shared.Atmos; using Content.Shared.GameObjects.Components; using Content.Shared.GameObjects.EntitySystems; +using Content.Shared.Interfaces; using Content.Shared.Interfaces.GameObjects.Components; using Robust.Server.GameObjects.Components.UserInterface; using Robust.Server.Interfaces.GameObjects; @@ -24,7 +24,6 @@ namespace Content.Server.GameObjects.Components.Atmos [RegisterComponent] public class GasAnalyzerComponent : SharedGasAnalyzerComponent, IAfterInteract, IDropped, IUse { - [Dependency] private readonly IServerNotifyManager _notifyManager = default!; [Dependency] private readonly IMapManager _mapManager = default!; private GasAnalyzerDanger _pressureDanger; @@ -207,17 +206,14 @@ namespace Content.Server.GameObjects.Components.Atmos 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; } var activeHandEntity = handsComponent.GetActiveHand?.Owner; if (activeHandEntity == null || !activeHandEntity.TryGetComponent(out GasAnalyzerComponent? gasAnalyzer)) { - _notifyManager.PopupMessage(serverMsg.Session.AttachedEntity, - serverMsg.Session.AttachedEntity, - Loc.GetString("You need a Gas Analyzer in your hand!")); + serverMsg.Session.AttachedEntity.PopupMessage(Loc.GetString("You need a Gas Analyzer in your hand!")); return; } @@ -231,7 +227,7 @@ namespace Content.Server.GameObjects.Components.Atmos { if (!eventArgs.CanReach) { - _notifyManager.PopupMessage(eventArgs.User, eventArgs.User, Loc.GetString("You can't reach there!")); + eventArgs.User.PopupMessage(Loc.GetString("You can't reach there!")); return; } diff --git a/Content.Server/GameObjects/Components/Body/DroppedBodyPartComponent.cs b/Content.Server/GameObjects/Components/Body/DroppedBodyPartComponent.cs index d917459671..8c16794a4f 100644 --- a/Content.Server/GameObjects/Components/Body/DroppedBodyPartComponent.cs +++ b/Content.Server/GameObjects/Components/Body/DroppedBodyPartComponent.cs @@ -1,18 +1,17 @@ #nullable enable using System.Collections.Generic; using System.Linq; -using Content.Shared.Interfaces; using Content.Shared.Interfaces.GameObjects.Components; using Content.Server.Body; using Content.Server.Utility; using Content.Shared.Body.Surgery; +using Content.Shared.Interfaces; using Robust.Server.GameObjects; using Robust.Server.GameObjects.Components.UserInterface; using Robust.Server.Interfaces.GameObjects; using Robust.Server.Interfaces.Player; using Robust.Shared.GameObjects; using Robust.Shared.Interfaces.GameObjects; -using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.ViewVariables; @@ -24,8 +23,6 @@ namespace Content.Server.GameObjects.Components.Body [RegisterComponent] public class DroppedBodyPartComponent : Component, IAfterInteract, IBodyPartContainer { - [Dependency] private readonly ISharedNotifyManager _sharedNotifyManager = default!; - private readonly Dictionary _optionsCache = new Dictionary(); private BodyManagerComponent? _bodyManagerComponentCache; private int _idHash; @@ -121,7 +118,7 @@ namespace Content.Server.GameObjects.Components.Body } else // If surgery cannot be performed, show message saying so. { - _sharedNotifyManager.PopupMessage(eventArgs.Target, eventArgs.User, + eventArgs.Target.PopupMessage(eventArgs.User, Loc.GetString("You see no way to install {0:theName}.", Owner)); } } @@ -147,7 +144,7 @@ namespace Content.Server.GameObjects.Components.Body // TODO: sanity checks to see whether user is in range, user is still able-bodied, target is still the same, etc etc if (!_optionsCache.TryGetValue(key, out var targetObject)) { - _sharedNotifyManager.PopupMessage(_bodyManagerComponentCache.Owner, _performerCache, + _bodyManagerComponentCache.Owner.PopupMessage(_performerCache, Loc.GetString("You see no useful way to attach {0:theName} anymore.", Owner)); } @@ -163,10 +160,7 @@ namespace Content.Server.GameObjects.Components.Body message = Loc.GetString("You can't attach it!"); } - _sharedNotifyManager.PopupMessage( - _bodyManagerComponentCache.Owner, - _performerCache, - message); + _bodyManagerComponentCache.Owner.PopupMessage(_performerCache, message); } private void OpenSurgeryUI(IPlayerSession session) diff --git a/Content.Server/GameObjects/Components/Body/DroppedMechanismComponent.cs b/Content.Server/GameObjects/Components/Body/DroppedMechanismComponent.cs index 939222ed2e..bc79929d38 100644 --- a/Content.Server/GameObjects/Components/Body/DroppedMechanismComponent.cs +++ b/Content.Server/GameObjects/Components/Body/DroppedMechanismComponent.cs @@ -28,7 +28,6 @@ namespace Content.Server.GameObjects.Components.Body [RegisterComponent] public class DroppedMechanismComponent : Component, IAfterInteract { - [Dependency] private readonly ISharedNotifyManager _sharedNotifyManager = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!; public sealed override string Name => "DroppedMechanism"; @@ -67,8 +66,7 @@ namespace Content.Server.GameObjects.Components.Body if (!droppedBodyPart.ContainedBodyPart.TryInstallDroppedMechanism(this)) { - _sharedNotifyManager.PopupMessage(eventArgs.Target, eventArgs.User, - Loc.GetString("You can't fit it in!")); + eventArgs.Target.PopupMessage(eventArgs.User, Loc.GetString("You can't fit it in!")); } } } @@ -141,7 +139,7 @@ namespace Content.Server.GameObjects.Components.Body } else // If surgery cannot be performed, show message saying so. { - _sharedNotifyManager.PopupMessage(eventArgs.Target, eventArgs.User, + eventArgs.Target.PopupMessage(eventArgs.User, Loc.GetString("You see no way to install the {0}.", Owner.Name)); } } @@ -167,7 +165,7 @@ namespace Content.Server.GameObjects.Components.Body // TODO: sanity checks to see whether user is in range, user is still able-bodied, target is still the same, etc etc if (!_optionsCache.TryGetValue(key, out var targetObject)) { - _sharedNotifyManager.PopupMessage(_bodyManagerComponentCache.Owner, _performerCache, + _bodyManagerComponentCache.Owner.PopupMessage(_performerCache, Loc.GetString("You see no useful way to use the {0} anymore.", Owner.Name)); return; } @@ -177,10 +175,7 @@ namespace Content.Server.GameObjects.Components.Body ? Loc.GetString("You jam the {0} inside {1:them}.", ContainedMechanism.Name, _performerCache) : Loc.GetString("You can't fit it in!"); - _sharedNotifyManager.PopupMessage( - _bodyManagerComponentCache.Owner, - _performerCache, - message); + _bodyManagerComponentCache.Owner.PopupMessage(_performerCache, message); // TODO: {1:theName} } diff --git a/Content.Server/GameObjects/Components/Body/SurgeryToolComponent.cs b/Content.Server/GameObjects/Components/Body/SurgeryToolComponent.cs index 0c937b5a12..35057f7381 100644 --- a/Content.Server/GameObjects/Components/Body/SurgeryToolComponent.cs +++ b/Content.Server/GameObjects/Components/Body/SurgeryToolComponent.cs @@ -16,7 +16,6 @@ using Robust.Server.Interfaces.GameObjects; using Robust.Server.Interfaces.Player; using Robust.Shared.GameObjects; using Robust.Shared.Interfaces.GameObjects; -using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.Log; using Robust.Shared.Serialization; @@ -34,8 +33,6 @@ namespace Content.Server.GameObjects.Components.Body [RegisterComponent] public class SurgeryToolComponent : Component, ISurgeon, IAfterInteract { - [Dependency] private readonly ISharedNotifyManager _sharedNotifyManager = default!; - public override string Name => "SurgeryTool"; public override uint? NetID => ContentNetIDs.SURGERY; @@ -259,9 +256,7 @@ namespace Content.Server.GameObjects.Components.Body return; } - _sharedNotifyManager.PopupMessage( - _bodyManagerComponentCache.Owner, - _performerCache, + _bodyManagerComponentCache.Owner.PopupMessage(_performerCache, Loc.GetString("You see no useful way to use {0:theName}.", Owner)); } @@ -272,9 +267,7 @@ namespace Content.Server.GameObjects.Components.Body return; } - _sharedNotifyManager.PopupMessage( - _bodyManagerComponentCache.Owner, - _performerCache, + _bodyManagerComponentCache.Owner.PopupMessage(_performerCache, Loc.GetString("You see no useful way to use {0:theName} anymore.", Owner)); } diff --git a/Content.Server/GameObjects/Components/Buckle/BuckleComponent.cs b/Content.Server/GameObjects/Components/Buckle/BuckleComponent.cs index e46b2c576b..275cf751bd 100644 --- a/Content.Server/GameObjects/Components/Buckle/BuckleComponent.cs +++ b/Content.Server/GameObjects/Components/Buckle/BuckleComponent.cs @@ -6,12 +6,12 @@ using Content.Server.GameObjects.Components.Mobs; using Content.Server.GameObjects.Components.Mobs.State; using Content.Server.GameObjects.Components.Strap; using Content.Server.GameObjects.EntitySystems; -using Content.Server.Interfaces; using Content.Shared.GameObjects.Components.Buckle; using Content.Shared.GameObjects.Components.Mobs; using Content.Shared.GameObjects.Components.Strap; using Content.Shared.GameObjects.EntitySystems; using Content.Shared.GameObjects.Verbs; +using Content.Shared.Interfaces; using Content.Shared.Interfaces.GameObjects.Components; using Content.Shared.Utility; using Robust.Server.GameObjects; @@ -38,7 +38,6 @@ namespace Content.Server.GameObjects.Components.Buckle [Dependency] private readonly IEntityManager _entityManager = default!; [Dependency] private readonly IEntitySystemManager _entitySystem = default!; [Dependency] private readonly IGameTiming _gameTiming = default!; - [Dependency] private readonly IServerNotifyManager _notifyManager = default!; [Dependency] private readonly IMapManager _mapManager = default!; private int _size; @@ -174,18 +173,16 @@ namespace Content.Server.GameObjects.Components.Buckle if (!ActionBlockerSystem.CanInteract(user)) { - _notifyManager.PopupMessage(user, user, - Loc.GetString("You can't do that!")); - + user.PopupMessage(Loc.GetString("You can't do that!")); return false; } if (!to.TryGetComponent(out strap)) { - _notifyManager.PopupMessage(Owner, user, - Loc.GetString(Owner == user - ? "You can't buckle yourself there!" - : "You can't buckle {0:them} there!", Owner)); + var message = Loc.GetString(Owner == user + ? "You can't buckle yourself there!" + : "You can't buckle {0:them} there!", Owner); + Owner.PopupMessage(user, message); return false; } @@ -195,8 +192,7 @@ namespace Content.Server.GameObjects.Components.Buckle if (!Owner.InRangeUnobstructed(strap, _range, predicate: Ignored, popup: true)) { - _notifyManager.PopupMessage(strap.Owner, user, - Loc.GetString("You can't reach there!")); + strap.Owner.PopupMessage(user, Loc.GetString("You can't reach there!")); return false; } @@ -208,7 +204,7 @@ namespace Content.Server.GameObjects.Components.Buckle if (!ContainerHelpers.TryGetContainer(strap.Owner, out var strapContainer) || ownerContainer != strapContainer) { - _notifyManager.PopupMessage(strap.Owner, user, Loc.GetString("You can't reach there!")); + strap.Owner.PopupMessage(user, Loc.GetString("You can't reach there!")); return false; } @@ -216,18 +212,16 @@ namespace Content.Server.GameObjects.Components.Buckle if (!user.HasComponent()) { - _notifyManager.PopupMessage(user, user, - Loc.GetString("You don't have hands!")); - + user.PopupMessage(Loc.GetString("You don't have hands!")); return false; } if (Buckled) { - _notifyManager.PopupMessage(Owner, user, - Loc.GetString(Owner == user - ? "You are already buckled in!" - : "{0:They} are already buckled in!", Owner)); + var message = Loc.GetString(Owner == user + ? "You are already buckled in!" + : "{0:They} are already buckled in!", Owner); + Owner.PopupMessage(user, message); return false; } @@ -237,10 +231,10 @@ namespace Content.Server.GameObjects.Components.Buckle { if (parent == user.Transform) { - _notifyManager.PopupMessage(Owner, user, - Loc.GetString(Owner == user - ? "You can't buckle yourself there!" - : "You can't buckle {0:them} there!", Owner)); + var message = Loc.GetString(Owner == user + ? "You can't buckle yourself there!" + : "You can't buckle {0:them} there!", Owner); + Owner.PopupMessage(user, message); return false; } @@ -250,10 +244,10 @@ namespace Content.Server.GameObjects.Components.Buckle if (!strap.HasSpace(this)) { - _notifyManager.PopupMessage(Owner, user, - Loc.GetString(Owner == user - ? "You can't fit there!" - : "{0:They} can't fit there!", Owner)); + var message = Loc.GetString(Owner == user + ? "You can't fit there!" + : "{0:They} can't fit there!", Owner); + Owner.PopupMessage(user, message); return false; } @@ -284,10 +278,10 @@ namespace Content.Server.GameObjects.Components.Buckle if (!strap.TryAdd(this)) { - _notifyManager.PopupMessage(Owner, user, - Loc.GetString(Owner == user - ? "You can't buckle yourself there!" - : "You can't buckle {0:them} there!", Owner)); + var message = Loc.GetString(Owner == user + ? "You can't buckle yourself there!" + : "You can't buckle {0:them} there!", Owner); + Owner.PopupMessage(user, message); return false; } @@ -338,8 +332,7 @@ namespace Content.Server.GameObjects.Components.Buckle if (!ActionBlockerSystem.CanInteract(user)) { - _notifyManager.PopupMessage(user, user, - Loc.GetString("You can't do that!")); + user.PopupMessage(Loc.GetString("You can't do that!")); return false; } diff --git a/Content.Server/GameObjects/Components/Chemistry/ChemMasterComponent.cs b/Content.Server/GameObjects/Components/Chemistry/ChemMasterComponent.cs index c3a7dc4764..208392e4c6 100644 --- a/Content.Server/GameObjects/Components/Chemistry/ChemMasterComponent.cs +++ b/Content.Server/GameObjects/Components/Chemistry/ChemMasterComponent.cs @@ -7,12 +7,12 @@ using Content.Server.GameObjects.Components.GUI; using Content.Server.GameObjects.Components.Items.Storage; using Content.Server.GameObjects.Components.Power.ApcNetComponents; using Content.Server.GameObjects.EntitySystems; -using Content.Server.Interfaces; using Content.Server.Interfaces.GameObjects.Components.Items; using Content.Server.Utility; using Content.Shared.Chemistry; using Content.Shared.GameObjects.Components.Chemistry.ChemMaster; using Content.Shared.GameObjects.EntitySystems; +using Content.Shared.Interfaces; using Content.Shared.Interfaces.GameObjects.Components; using Robust.Server.GameObjects.Components.Container; using Robust.Server.GameObjects.Components.UserInterface; @@ -43,8 +43,6 @@ namespace Content.Server.GameObjects.Components.Chemistry [ComponentReference(typeof(IInteractUsing))] public class ChemMasterComponent : SharedChemMasterComponent, IActivate, IInteractUsing, ISolutionChange { - [Dependency] private readonly IServerNotifyManager _notifyManager = default!; - [ViewVariables] private ContainerSlot _beakerContainer = default!; [ViewVariables] private string _packPrototypeId = ""; @@ -367,8 +365,7 @@ namespace Content.Server.GameObjects.Components.Chemistry if (!args.User.TryGetComponent(out IHandsComponent? hands)) { - _notifyManager.PopupMessage(Owner.Transform.GridPosition, args.User, - Loc.GetString("You have no hands.")); + Owner.PopupMessage(args.User, Loc.GetString("You have no hands.")); return; } @@ -390,15 +387,13 @@ namespace Content.Server.GameObjects.Components.Chemistry { if (!args.User.TryGetComponent(out IHandsComponent? hands)) { - _notifyManager.PopupMessage(Owner.Transform.GridPosition, args.User, - Loc.GetString("You have no hands.")); + Owner.PopupMessage(args.User, Loc.GetString("You have no hands.")); return true; } if (hands.GetActiveHand == null) { - _notifyManager.PopupMessage(Owner.Transform.GridPosition, args.User, - Loc.GetString("You have nothing on your hand.")); + Owner.PopupMessage(args.User, Loc.GetString("You have nothing on your hand.")); return false; } @@ -407,14 +402,12 @@ namespace Content.Server.GameObjects.Components.Chemistry { if (HasBeaker) { - _notifyManager.PopupMessage(Owner.Transform.GridPosition, args.User, - Loc.GetString("This ChemMaster already has a container in it.")); + Owner.PopupMessage(args.User, Loc.GetString("This ChemMaster already has a container in it.")); } else if ((solution.Capabilities & SolutionCaps.FitsInDispenser) == 0) //Close enough to a chem master... { //If it can't fit in the chem master, don't put it in. For example, buckets and mop buckets can't fit. - _notifyManager.PopupMessage(Owner.Transform.GridPosition, args.User, - Loc.GetString("That can't fit in the ChemMaster.")); + Owner.PopupMessage(args.User, Loc.GetString("That can't fit in the ChemMaster.")); } else { @@ -424,8 +417,7 @@ namespace Content.Server.GameObjects.Components.Chemistry } else { - _notifyManager.PopupMessage(Owner.Transform.GridPosition, args.User, - Loc.GetString("You can't put this in the ChemMaster.")); + Owner.PopupMessage(args.User, Loc.GetString("You can't put this in the ChemMaster.")); } return true; @@ -435,7 +427,6 @@ namespace Content.Server.GameObjects.Components.Chemistry private void ClickSound() { - EntitySystem.Get().PlayFromEntity("/Audio/Machines/machine_switch.ogg", Owner, AudioParams.Default.WithVolume(-2f)); } } diff --git a/Content.Server/GameObjects/Components/Chemistry/InjectorComponent.cs b/Content.Server/GameObjects/Components/Chemistry/InjectorComponent.cs index d081e498a9..d315ffcceb 100644 --- a/Content.Server/GameObjects/Components/Chemistry/InjectorComponent.cs +++ b/Content.Server/GameObjects/Components/Chemistry/InjectorComponent.cs @@ -1,14 +1,13 @@ #nullable enable using System; using Content.Server.GameObjects.Components.Body.Circulatory; -using Content.Server.Interfaces; using Content.Shared.Chemistry; using Content.Shared.GameObjects.Components.Chemistry; +using Content.Shared.Interfaces; using Content.Shared.Interfaces.GameObjects.Components; using Content.Shared.Utility; using Robust.Shared.GameObjects; using Robust.Shared.Interfaces.GameObjects; -using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.Serialization; using Robust.Shared.ViewVariables; @@ -23,8 +22,6 @@ namespace Content.Server.GameObjects.Components.Chemistry [RegisterComponent] public class InjectorComponent : SharedInjectorComponent, IAfterInteract, IUse { - [Dependency] private readonly IServerNotifyManager _notifyManager = default!; - /// /// Whether or not the injector is able to draw from containers or if it's a single use /// device that can only inject. @@ -100,7 +97,7 @@ namespace Content.Server.GameObjects.Components.Chemistry throw new ArgumentOutOfRangeException(); } - _notifyManager.PopupMessage(Owner, user, Loc.GetString(msg)); + Owner.PopupMessage(user, Loc.GetString(msg)); Dirty(); } @@ -165,8 +162,7 @@ namespace Content.Server.GameObjects.Components.Chemistry var realTransferAmount = ReagentUnit.Min(_transferAmount, targetBloodstream.EmptyVolume); if (realTransferAmount <= 0) { - _notifyManager.PopupMessage(Owner.Transform.GridPosition, user, - Loc.GetString("Container full.")); + Owner.PopupMessage(user, Loc.GetString("Container full.")); return; } @@ -177,8 +173,7 @@ namespace Content.Server.GameObjects.Components.Chemistry return; } - _notifyManager.PopupMessage(Owner.Transform.GridPosition, user, - Loc.GetString("Injected {0}u", removedSolution.TotalVolume)); + Owner.PopupMessage(user, Loc.GetString("Injected {0}u", removedSolution.TotalVolume)); Dirty(); } @@ -194,8 +189,7 @@ namespace Content.Server.GameObjects.Components.Chemistry var realTransferAmount = ReagentUnit.Min(_transferAmount, targetSolution.EmptyVolume); if (realTransferAmount <= 0) { - _notifyManager.PopupMessage(Owner.Transform.GridPosition, user, - Loc.GetString("Container full.")); + Owner.PopupMessage(user, Loc.GetString("Container full.")); return; } @@ -206,8 +200,7 @@ namespace Content.Server.GameObjects.Components.Chemistry return; } - _notifyManager.PopupMessage(Owner.Transform.GridPosition, user, - Loc.GetString("Injected {0}u", removedSolution.TotalVolume)); + Owner.PopupMessage(user, Loc.GetString("Injected {0}u", removedSolution.TotalVolume)); Dirty(); } @@ -223,8 +216,7 @@ namespace Content.Server.GameObjects.Components.Chemistry var realTransferAmount = ReagentUnit.Min(_transferAmount, targetSolution.CurrentVolume); if (realTransferAmount <= 0) { - _notifyManager.PopupMessage(Owner.Transform.GridPosition, user, - Loc.GetString("Container empty")); + Owner.PopupMessage(user, Loc.GetString("Container empty")); return; } @@ -235,8 +227,7 @@ namespace Content.Server.GameObjects.Components.Chemistry return; } - _notifyManager.PopupMessage(Owner.Transform.GridPosition, user, - Loc.GetString("Drew {0}u", removedSolution.TotalVolume)); + Owner.PopupMessage(user, Loc.GetString("Drew {0}u", removedSolution.TotalVolume)); Dirty(); } diff --git a/Content.Server/GameObjects/Components/Chemistry/PourableComponent.cs b/Content.Server/GameObjects/Components/Chemistry/PourableComponent.cs index 1a507f2bcb..7f23b562df 100644 --- a/Content.Server/GameObjects/Components/Chemistry/PourableComponent.cs +++ b/Content.Server/GameObjects/Components/Chemistry/PourableComponent.cs @@ -1,9 +1,8 @@ using System.Threading.Tasks; -using Content.Server.Interfaces; using Content.Shared.Chemistry; +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.ViewVariables; @@ -19,8 +18,6 @@ namespace Content.Server.GameObjects.Components.Chemistry [RegisterComponent] class PourableComponent : Component, IInteractUsing { - [Dependency] private readonly IServerNotifyManager _notifyManager = default!; - public override string Name => "Pourable"; private ReagentUnit _transferAmount; @@ -87,8 +84,7 @@ namespace Content.Server.GameObjects.Components.Chemistry var realTransferAmount = ReagentUnit.Min(fromPourable.TransferAmount, toSolution.EmptyVolume); if (realTransferAmount <= 0) //Special message if container is full { - _notifyManager.PopupMessage(Owner.Transform.GridPosition, eventArgs.User, - Loc.GetString("Container is full")); + Owner.PopupMessage(eventArgs.User, Loc.GetString("Container is full")); return false; } @@ -97,8 +93,7 @@ namespace Content.Server.GameObjects.Components.Chemistry if (!toSolution.TryAddSolution(removedSolution)) return false; - _notifyManager.PopupMessage(Owner.Transform.GridPosition, eventArgs.User, - Loc.GetString("Transferred {0}u", removedSolution.TotalVolume)); + Owner.PopupMessage(eventArgs.User, Loc.GetString("Transferred {0}u", removedSolution.TotalVolume)); return true; } diff --git a/Content.Server/GameObjects/Components/Chemistry/ReagentDispenserComponent.cs b/Content.Server/GameObjects/Components/Chemistry/ReagentDispenserComponent.cs index 3ec235caf7..24c29dfac2 100644 --- a/Content.Server/GameObjects/Components/Chemistry/ReagentDispenserComponent.cs +++ b/Content.Server/GameObjects/Components/Chemistry/ReagentDispenserComponent.cs @@ -6,12 +6,12 @@ using Content.Server.GameObjects.Components.GUI; using Content.Server.GameObjects.Components.Items.Storage; using Content.Server.GameObjects.Components.Power.ApcNetComponents; using Content.Server.GameObjects.EntitySystems; -using Content.Server.Interfaces; using Content.Server.Interfaces.GameObjects.Components.Items; using Content.Server.Utility; using Content.Shared.Chemistry; using Content.Shared.GameObjects.Components.Chemistry.ReagentDispenser; using Content.Shared.GameObjects.EntitySystems; +using Content.Shared.Interfaces; using Content.Shared.Interfaces.GameObjects.Components; using Robust.Server.GameObjects.Components.Container; using Robust.Server.GameObjects.Components.UserInterface; @@ -40,8 +40,6 @@ namespace Content.Server.GameObjects.Components.Chemistry [ComponentReference(typeof(IInteractUsing))] public class ReagentDispenserComponent : SharedReagentDispenserComponent, IActivate, IInteractUsing, ISolutionChange { - [Dependency] private readonly IServerNotifyManager _notifyManager = default!; - [ViewVariables] private ContainerSlot _beakerContainer = default!; [ViewVariables] private string _packPrototypeId = ""; @@ -280,8 +278,7 @@ namespace Content.Server.GameObjects.Components.Chemistry if (!args.User.TryGetComponent(out IHandsComponent? hands)) { - _notifyManager.PopupMessage(Owner.Transform.GridPosition, args.User, - Loc.GetString("You have no hands.")); + Owner.PopupMessage(args.User, Loc.GetString("You have no hands.")); return; } @@ -303,15 +300,13 @@ namespace Content.Server.GameObjects.Components.Chemistry { if (!args.User.TryGetComponent(out IHandsComponent? hands)) { - _notifyManager.PopupMessage(Owner.Transform.GridPosition, args.User, - Loc.GetString("You have no hands.")); + Owner.PopupMessage(args.User, Loc.GetString("You have no hands.")); return true; } if (hands.GetActiveHand == null) { - _notifyManager.PopupMessage(Owner.Transform.GridPosition, args.User, - Loc.GetString("You have nothing on your hand.")); + Owner.PopupMessage(args.User, Loc.GetString("You have nothing on your hand.")); return false; } @@ -320,14 +315,12 @@ namespace Content.Server.GameObjects.Components.Chemistry { if (HasBeaker) { - _notifyManager.PopupMessage(Owner.Transform.GridPosition, args.User, - Loc.GetString("This dispenser already has a container in it.")); + Owner.PopupMessage(args.User, Loc.GetString("This dispenser already has a container in it.")); } else if ((solution.Capabilities & SolutionCaps.FitsInDispenser) == 0) { //If it can't fit in the dispenser, don't put it in. For example, buckets and mop buckets can't fit. - _notifyManager.PopupMessage(Owner.Transform.GridPosition, args.User, - Loc.GetString("That can't fit in the dispenser.")); + Owner.PopupMessage(args.User, Loc.GetString("That can't fit in the dispenser.")); } else { @@ -337,8 +330,7 @@ namespace Content.Server.GameObjects.Components.Chemistry } else { - _notifyManager.PopupMessage(Owner.Transform.GridPosition, args.User, - Loc.GetString("You can't put this in the dispenser.")); + Owner.PopupMessage(args.User, Loc.GetString("You can't put this in the dispenser.")); } return true; @@ -348,11 +340,8 @@ namespace Content.Server.GameObjects.Components.Chemistry private void ClickSound() { - EntitySystem.Get().PlayFromEntity("/Audio/Machines/machine_switch.ogg", Owner, AudioParams.Default.WithVolume(-2f)); } - - } } diff --git a/Content.Server/GameObjects/Components/Conveyor/ConveyorSwitchComponent.cs b/Content.Server/GameObjects/Components/Conveyor/ConveyorSwitchComponent.cs index ae5e2c3aa1..48edea9ccd 100644 --- a/Content.Server/GameObjects/Components/Conveyor/ConveyorSwitchComponent.cs +++ b/Content.Server/GameObjects/Components/Conveyor/ConveyorSwitchComponent.cs @@ -81,7 +81,7 @@ namespace Content.Server.GameObjects.Components.Conveyor } _group.AddConveyor(conveyor); - user?.PopupMessage(user, Loc.GetString("Conveyor linked.")); + user?.PopupMessage(Loc.GetString("Conveyor linked.")); } /// diff --git a/Content.Server/GameObjects/Components/Disposal/DisposalRouterComponent.cs b/Content.Server/GameObjects/Components/Disposal/DisposalRouterComponent.cs index 6cf6689e75..b615510c93 100644 --- a/Content.Server/GameObjects/Components/Disposal/DisposalRouterComponent.cs +++ b/Content.Server/GameObjects/Components/Disposal/DisposalRouterComponent.cs @@ -1,5 +1,4 @@ #nullable enable -using Content.Server.Interfaces; using Content.Server.Interfaces.GameObjects.Components.Items; using Content.Shared.GameObjects.EntitySystems; using Content.Shared.Interfaces.GameObjects.Components; @@ -11,13 +10,13 @@ using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Components; using Robust.Shared.GameObjects.Systems; using Robust.Shared.Interfaces.GameObjects; -using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.Maths; using Robust.Shared.ViewVariables; using System; using System.Collections.Generic; using Content.Server.Utility; +using Content.Shared.Interfaces; using static Content.Shared.GameObjects.Components.Disposal.SharedDisposalRouterComponent; namespace Content.Server.GameObjects.Components.Disposal @@ -27,7 +26,6 @@ namespace Content.Server.GameObjects.Components.Disposal [ComponentReference(typeof(IDisposalTubeComponent))] public class DisposalRouterComponent : DisposalJunctionComponent, IActivate { - [Dependency] private readonly IServerNotifyManager _notifyManager = default!; public override string Name => "DisposalRouter"; [ViewVariables] @@ -160,8 +158,7 @@ namespace Content.Server.GameObjects.Components.Disposal if (!args.User.TryGetComponent(out IHandsComponent? hands)) { - _notifyManager.PopupMessage(Owner.Transform.GridPosition, args.User, - Loc.GetString("You have no hands.")); + Owner.PopupMessage(args.User, Loc.GetString("You have no hands.")); return; } diff --git a/Content.Server/GameObjects/Components/Disposal/DisposalTaggerComponent.cs b/Content.Server/GameObjects/Components/Disposal/DisposalTaggerComponent.cs index 76d913e2cf..ce14df749d 100644 --- a/Content.Server/GameObjects/Components/Disposal/DisposalTaggerComponent.cs +++ b/Content.Server/GameObjects/Components/Disposal/DisposalTaggerComponent.cs @@ -1,8 +1,8 @@ #nullable enable -using Content.Server.Interfaces; using Content.Server.Interfaces.GameObjects.Components.Items; using Content.Server.Utility; using Content.Shared.GameObjects.EntitySystems; +using Content.Shared.Interfaces; using Content.Shared.Interfaces.GameObjects.Components; using Robust.Server.GameObjects.Components.UserInterface; using Robust.Server.GameObjects.EntitySystems; @@ -12,7 +12,6 @@ using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Components; using Robust.Shared.GameObjects.Systems; using Robust.Shared.Interfaces.GameObjects; -using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.Maths; using Robust.Shared.ViewVariables; @@ -25,7 +24,6 @@ namespace Content.Server.GameObjects.Components.Disposal [ComponentReference(typeof(IDisposalTubeComponent))] public class DisposalTaggerComponent : DisposalTransitComponent, IActivate { - [Dependency] private readonly IServerNotifyManager _notifyManager = default!; public override string Name => "DisposalTagger"; [ViewVariables(VVAccess.ReadWrite)] @@ -128,8 +126,7 @@ namespace Content.Server.GameObjects.Components.Disposal if (!args.User.TryGetComponent(out IHandsComponent? hands)) { - _notifyManager.PopupMessage(Owner.Transform.GridPosition, args.User, - Loc.GetString("You have no hands.")); + Owner.PopupMessage(args.User, Loc.GetString("You have no hands.")); return; } diff --git a/Content.Server/GameObjects/Components/Disposal/DisposalUnitComponent.cs b/Content.Server/GameObjects/Components/Disposal/DisposalUnitComponent.cs index ad43b62def..634a55b002 100644 --- a/Content.Server/GameObjects/Components/Disposal/DisposalUnitComponent.cs +++ b/Content.Server/GameObjects/Components/Disposal/DisposalUnitComponent.cs @@ -8,13 +8,13 @@ using Content.Server.GameObjects.Components.GUI; using Content.Server.GameObjects.Components.Items.Storage; using Content.Server.GameObjects.Components.Power.ApcNetComponents; using Content.Server.GameObjects.EntitySystems.DoAfter; -using Content.Server.Interfaces; using Content.Server.Interfaces.GameObjects.Components.Items; using Content.Server.Utility; using Content.Shared.GameObjects.Components.Body; using Content.Shared.GameObjects.Components.Disposal; using Content.Shared.GameObjects.EntitySystems; using Content.Shared.GameObjects.Verbs; +using Content.Shared.Interfaces; using Content.Shared.Interfaces.GameObjects.Components; using Robust.Server.GameObjects; using Robust.Server.GameObjects.Components.Container; @@ -43,7 +43,6 @@ namespace Content.Server.GameObjects.Components.Disposal [ComponentReference(typeof(IInteractUsing))] public class DisposalUnitComponent : SharedDisposalUnitComponent, IInteractHand, IInteractUsing, IDragDropOn { - [Dependency] private readonly IServerNotifyManager _notifyManager = default!; [Dependency] private readonly IGameTiming _gameTiming = default!; public override string Name => "DisposalUnit"; @@ -614,15 +613,13 @@ namespace Content.Server.GameObjects.Components.Disposal { if (!ActionBlockerSystem.CanInteract(eventArgs.User)) { - _notifyManager.PopupMessage(Owner.Transform.GridPosition, eventArgs.User, - Loc.GetString("You can't do that!")); + Owner.PopupMessage(eventArgs.User, Loc.GetString("You can't do that!")); return false; } if (ContainerHelpers.IsInContainer(eventArgs.User)) { - _notifyManager.PopupMessage(Owner.Transform.GridPosition, eventArgs.User, - Loc.GetString("You can't reach there!")); + Owner.PopupMessage(eventArgs.User, Loc.GetString("You can't reach there!")); return false; } @@ -633,8 +630,7 @@ namespace Content.Server.GameObjects.Components.Disposal if (!eventArgs.User.HasComponent()) { - _notifyManager.PopupMessage(Owner.Transform.GridPosition, eventArgs.User, - Loc.GetString("You have no hands!")); + Owner.PopupMessage(eventArgs.User, Loc.GetString("You have no hands!")); return false; } diff --git a/Content.Server/GameObjects/Components/Doors/AirlockComponent.cs b/Content.Server/GameObjects/Components/Doors/AirlockComponent.cs index ab58e2461c..64652f456f 100644 --- a/Content.Server/GameObjects/Components/Doors/AirlockComponent.cs +++ b/Content.Server/GameObjects/Components/Doors/AirlockComponent.cs @@ -8,6 +8,7 @@ using Content.Server.GameObjects.Components.VendingMachines; using Content.Server.Interfaces; using Content.Shared.GameObjects.Components.Doors; using Content.Shared.GameObjects.Components.Interactable; +using Content.Shared.Interfaces; using Content.Shared.Interfaces.GameObjects.Components; using Robust.Server.GameObjects; using Robust.Server.GameObjects.EntitySystems; @@ -438,16 +439,14 @@ namespace Content.Server.GameObjects.Components.Doors { if (IsBolted()) { - var notify = IoCManager.Resolve(); - notify.PopupMessage(Owner, eventArgs.User, + Owner.PopupMessage(eventArgs.User, Loc.GetString("The airlock's bolts prevent it from being forced!")); return false; } if (IsPowered()) { - var notify = IoCManager.Resolve(); - notify.PopupMessage(Owner, eventArgs.User, Loc.GetString("The powered motors block your efforts!")); + Owner.PopupMessage(eventArgs.User, Loc.GetString("The powered motors block your efforts!")); return false; } diff --git a/Content.Server/GameObjects/Components/Fluids/SprayComponent.cs b/Content.Server/GameObjects/Components/Fluids/SprayComponent.cs index e10ae9c7df..598bb16a6a 100644 --- a/Content.Server/GameObjects/Components/Fluids/SprayComponent.cs +++ b/Content.Server/GameObjects/Components/Fluids/SprayComponent.cs @@ -1,6 +1,6 @@ using Content.Server.GameObjects.Components.Chemistry; -using Content.Server.Interfaces; using Content.Shared.Chemistry; +using Content.Shared.Interfaces; using Content.Shared.Interfaces.GameObjects.Components; using Robust.Server.GameObjects.EntitySystems; using Robust.Server.Interfaces.GameObjects; @@ -17,7 +17,6 @@ namespace Content.Server.GameObjects.Components.Fluids [RegisterComponent] class SprayComponent : Component, IAfterInteract { - [Dependency] private readonly IServerNotifyManager _notifyManager = default!; [Dependency] private readonly IServerEntityManager _serverEntityManager = default!; public override string Name => "Spray"; @@ -71,7 +70,7 @@ namespace Content.Server.GameObjects.Components.Fluids { if (CurrentVolume <= 0) { - _notifyManager.PopupMessage(Owner, eventArgs.User, Loc.GetString("It's empty!")); + Owner.PopupMessage(eventArgs.User, Loc.GetString("It's empty!")); return; } diff --git a/Content.Server/GameObjects/Components/GUI/InventoryComponent.cs b/Content.Server/GameObjects/Components/GUI/InventoryComponent.cs index bc58b80601..13353f664d 100644 --- a/Content.Server/GameObjects/Components/GUI/InventoryComponent.cs +++ b/Content.Server/GameObjects/Components/GUI/InventoryComponent.cs @@ -3,12 +3,11 @@ using System.Collections.Generic; using System.Linq; using Content.Server.GameObjects.Components.Items.Clothing; using Content.Server.GameObjects.Components.Items.Storage; -using Content.Server.GameObjects.EntitySystems; using Content.Server.GameObjects.EntitySystems.Click; -using Content.Server.Interfaces; using Content.Server.Interfaces.GameObjects; using Content.Shared.GameObjects.Components.Inventory; using Content.Shared.GameObjects.EntitySystems; +using Content.Shared.Interfaces; using Robust.Server.GameObjects.Components.Container; using Robust.Shared.Containers; using Robust.Shared.GameObjects; @@ -29,7 +28,6 @@ namespace Content.Server.GameObjects.Components.GUI public class InventoryComponent : SharedInventoryComponent, IExAct, IEffectBlocker, IPressureProtection { [Dependency] private readonly IEntitySystemManager _entitySystemManager = default!; - [Dependency] private readonly IServerNotifyManager _serverNotifyManager = default!; [ViewVariables] private readonly Dictionary _slotContainers = new Dictionary(); @@ -432,7 +430,7 @@ namespace Content.Server.GameObjects.Components.GUI hands.PutInHand(clothing); if (reason != null) - _serverNotifyManager.PopupMessageCursor(Owner, reason); + Owner.PopupMessageCursor(reason); } } break; diff --git a/Content.Server/GameObjects/Components/GUI/StrippableComponent.cs b/Content.Server/GameObjects/Components/GUI/StrippableComponent.cs index fc54344448..d43600f803 100644 --- a/Content.Server/GameObjects/Components/GUI/StrippableComponent.cs +++ b/Content.Server/GameObjects/Components/GUI/StrippableComponent.cs @@ -1,15 +1,14 @@ #nullable enable using System.Collections.Generic; -using System.Linq; using System.Threading; using Content.Server.GameObjects.Components.ActionBlocking; using Content.Server.GameObjects.Components.Items.Storage; using Content.Server.GameObjects.EntitySystems.DoAfter; -using Content.Server.Interfaces; using Content.Server.Utility; using Content.Shared.GameObjects.Components.GUI; using Content.Shared.GameObjects.EntitySystems; using Content.Shared.GameObjects.Verbs; +using Content.Shared.Interfaces; using Content.Shared.Interfaces.GameObjects.Components; using Robust.Server.GameObjects.Components.UserInterface; using Robust.Server.Interfaces.GameObjects; @@ -17,7 +16,6 @@ using Robust.Server.Interfaces.Player; using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Systems; using Robust.Shared.Interfaces.GameObjects; -using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.ViewVariables; using static Content.Shared.GameObjects.Components.Inventory.EquipmentSlotDefines; @@ -27,11 +25,9 @@ namespace Content.Server.GameObjects.Components.GUI [RegisterComponent] public sealed class StrippableComponent : SharedStrippableComponent, IDragDrop { - [Dependency] private readonly IServerNotifyManager _notifyManager = default!; - public const float StripDelay = 2f; - [ViewVariables] + [ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(StrippingUiKey.Key); public override void Initialize() @@ -46,7 +42,7 @@ namespace Content.Server.GameObjects.Components.GUI Owner.EnsureComponent(); Owner.EnsureComponent(); Owner.EnsureComponent(); - + if (Owner.TryGetComponent(out CuffableComponent? cuffed)) { cuffed.OnCuffedStateChanged += UpdateSubscribed; @@ -104,7 +100,7 @@ namespace Content.Server.GameObjects.Components.GUI private Dictionary GetHandcuffs() { var dictionary = new Dictionary(); - + if (!Owner.TryGetComponent(out CuffableComponent? cuffed)) { return dictionary; @@ -173,13 +169,13 @@ namespace Content.Server.GameObjects.Components.GUI if (item == null) { - _notifyManager.PopupMessageCursor(user, Loc.GetString("You aren't holding anything!")); + user.PopupMessageCursor(Loc.GetString("You aren't holding anything!")); return false; } if (!userHands.CanDrop(userHands.ActiveHand!)) { - _notifyManager.PopupMessageCursor(user, Loc.GetString("You can't drop that!")); + user.PopupMessageCursor(Loc.GetString("You can't drop that!")); return false; } @@ -188,13 +184,13 @@ namespace Content.Server.GameObjects.Components.GUI if (inventory.TryGetSlotItem(slot, out ItemComponent _)) { - _notifyManager.PopupMessageCursor(user, Loc.GetString("{0:They} already {0:have} something there!", Owner)); + user.PopupMessageCursor(Loc.GetString("{0:They} already {0:have} something there!", Owner)); return false; } if (!inventory.CanEquip(slot, item, false)) { - _notifyManager.PopupMessageCursor(user, Loc.GetString("{0:They} cannot equip that there!", Owner)); + user.PopupMessageCursor(Loc.GetString("{0:They} cannot equip that there!", Owner)); return false; } @@ -238,13 +234,13 @@ namespace Content.Server.GameObjects.Components.GUI if (item == null) { - _notifyManager.PopupMessageCursor(user, Loc.GetString("You aren't holding anything!")); + user.PopupMessageCursor(Loc.GetString("You aren't holding anything!")); return false; } if (!userHands.CanDrop(userHands.ActiveHand!)) { - _notifyManager.PopupMessageCursor(user, Loc.GetString("You can't drop that!")); + user.PopupMessageCursor(Loc.GetString("You can't drop that!")); return false; } @@ -253,13 +249,13 @@ namespace Content.Server.GameObjects.Components.GUI if (hands.TryGetItem(hand, out var _)) { - _notifyManager.PopupMessageCursor(user, Loc.GetString("{0:They} already {0:have} something there!", Owner)); + user.PopupMessageCursor(Loc.GetString("{0:They} already {0:have} something there!", Owner)); return false; } if (!hands.CanPutInHand(item, hand, false)) { - _notifyManager.PopupMessageCursor(user, Loc.GetString("{0:They} cannot put that there!", Owner)); + user.PopupMessageCursor(Loc.GetString("{0:They} cannot put that there!", Owner)); return false; } @@ -304,13 +300,13 @@ namespace Content.Server.GameObjects.Components.GUI if (!inventory.TryGetSlotItem(slot, out ItemComponent itemToTake)) { - _notifyManager.PopupMessageCursor(user, Loc.GetString("{0:They} {0:have} nothing there!", Owner)); + user.PopupMessageCursor(Loc.GetString("{0:They} {0:have} nothing there!", Owner)); return false; } if (!inventory.CanUnequip(slot, false)) { - _notifyManager.PopupMessageCursor(user, Loc.GetString("{0:They} cannot unequip that!", Owner)); + user.PopupMessageCursor(Loc.GetString("{0:They} cannot unequip that!", Owner)); return false; } @@ -355,13 +351,13 @@ namespace Content.Server.GameObjects.Components.GUI if (!hands.TryGetItem(hand, out var heldItem)) { - _notifyManager.PopupMessageCursor(user, Loc.GetString("{0:They} {0:have} nothing there!", Owner)); + user.PopupMessageCursor(Loc.GetString("{0:They} {0:have} nothing there!", Owner)); return false; } if (!hands.CanDrop(hand, false)) { - _notifyManager.PopupMessageCursor(user, Loc.GetString("{0:They} cannot drop that!", Owner)); + user.PopupMessageCursor(Loc.GetString("{0:They} cannot drop that!", Owner)); return false; } diff --git a/Content.Server/GameObjects/Components/Gravity/GravityGeneratorComponent.cs b/Content.Server/GameObjects/Components/Gravity/GravityGeneratorComponent.cs index 3a766f985a..8ae70d4317 100644 --- a/Content.Server/GameObjects/Components/Gravity/GravityGeneratorComponent.cs +++ b/Content.Server/GameObjects/Components/Gravity/GravityGeneratorComponent.cs @@ -8,6 +8,7 @@ using Content.Server.Utility; using Content.Shared.GameObjects.Components.Gravity; using Content.Shared.GameObjects.Components.Interactable; using Content.Shared.GameObjects.EntitySystems; +using Content.Shared.Interfaces; using Content.Shared.Interfaces.GameObjects.Components; using Robust.Server.GameObjects; using Robust.Server.GameObjects.Components.UserInterface; @@ -111,9 +112,8 @@ namespace Content.Server.GameObjects.Components.Gravity breakable.FixAllDamage(); _intact = true; - var notifyManager = IoCManager.Resolve(); - - notifyManager.PopupMessage(Owner, eventArgs.User, Loc.GetString("You repair {0:theName} with {1:theName}", Owner, eventArgs.Using)); + Owner.PopupMessage(eventArgs.User, + Loc.GetString("You repair {0:theName} with {1:theName}", Owner, eventArgs.Using)); return true; } diff --git a/Content.Server/GameObjects/Components/Instruments/InstrumentComponent.cs b/Content.Server/GameObjects/Components/Instruments/InstrumentComponent.cs index 9947e7d1e9..8383d5b157 100644 --- a/Content.Server/GameObjects/Components/Instruments/InstrumentComponent.cs +++ b/Content.Server/GameObjects/Components/Instruments/InstrumentComponent.cs @@ -3,11 +3,10 @@ using System; using System.Linq; using Content.Server.GameObjects.Components.Mobs; using Content.Server.GameObjects.EntitySystems; -using Content.Server.Interfaces; -using Content.Server.Mobs; using Content.Server.Utility; using Content.Shared.GameObjects.Components.Instruments; using Content.Shared.GameObjects.EntitySystems; +using Content.Shared.Interfaces; using Content.Shared.Interfaces.GameObjects.Components; using Robust.Server.GameObjects; using Robust.Server.GameObjects.Components.UserInterface; @@ -38,7 +37,6 @@ namespace Content.Server.GameObjects.Components.Instruments IUse, IThrown { - [Dependency] private readonly IServerNotifyManager _notifyManager = default!; [Dependency] private readonly IGameTiming _gameTiming = default!; private static readonly TimeSpan OneSecAgo = TimeSpan.FromSeconds(-1); @@ -166,11 +164,11 @@ namespace Content.Server.GameObjects.Components.Instruments switch (_laggedBatches) { case (int) (MaxMidiLaggedBatches * (1 / 3d)) + 1: - _notifyManager.PopupMessage(Owner, InstrumentPlayer.AttachedEntity, + Owner.PopupMessage(InstrumentPlayer.AttachedEntity, "Your fingers are beginning to a cramp a little!"); break; case (int) (MaxMidiLaggedBatches * (2 / 3d)) + 1: - _notifyManager.PopupMessage(Owner, InstrumentPlayer.AttachedEntity, + Owner.PopupMessage(InstrumentPlayer.AttachedEntity, "Your fingers are seriously cramping up!"); break; } @@ -333,7 +331,7 @@ namespace Content.Server.GameObjects.Components.Instruments InstrumentPlayer = null; - _notifyManager.PopupMessage(Owner, mob, "Your fingers cramp up from playing!"); + Owner.PopupMessage(mob, "Your fingers cramp up from playing!"); } _timer += delta; diff --git a/Content.Server/GameObjects/Components/Interactable/HandheldLightComponent.cs b/Content.Server/GameObjects/Components/Interactable/HandheldLightComponent.cs index 6e607ae9c8..588200c738 100644 --- a/Content.Server/GameObjects/Components/Interactable/HandheldLightComponent.cs +++ b/Content.Server/GameObjects/Components/Interactable/HandheldLightComponent.cs @@ -17,7 +17,6 @@ using Robust.Server.Interfaces.GameObjects; using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Systems; using Robust.Shared.Interfaces.GameObjects; -using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.Utility; using Robust.Shared.ViewVariables; @@ -31,8 +30,6 @@ namespace Content.Server.GameObjects.Components.Interactable internal sealed class HandheldLightComponent : SharedHandheldLightComponent, IUse, IExamine, IInteractUsing, IMapInit { - [Dependency] private readonly ISharedNotifyManager _notifyManager = default!; - [ViewVariables(VVAccess.ReadWrite)] public float Wattage { get; set; } = 10; [ViewVariables] private ContainerSlot _cellContainer = default!; @@ -152,7 +149,7 @@ namespace Content.Server.GameObjects.Components.Interactable { EntitySystem.Get().PlayFromEntity("/Audio/Machines/button.ogg", Owner); - _notifyManager.PopupMessage(Owner, user, Loc.GetString("Cell missing...")); + Owner.PopupMessage(user, Loc.GetString("Cell missing...")); return; } @@ -162,7 +159,7 @@ namespace Content.Server.GameObjects.Components.Interactable if (Wattage > cell.CurrentCharge) { EntitySystem.Get().PlayFromEntity("/Audio/Machines/button.ogg", Owner); - _notifyManager.PopupMessage(Owner, user, Loc.GetString("Dead cell...")); + Owner.PopupMessage(user, Loc.GetString("Dead cell...")); return; } diff --git a/Content.Server/GameObjects/Components/Interactable/WelderComponent.cs b/Content.Server/GameObjects/Components/Interactable/WelderComponent.cs index 8987084e21..68a347f8d5 100644 --- a/Content.Server/GameObjects/Components/Interactable/WelderComponent.cs +++ b/Content.Server/GameObjects/Components/Interactable/WelderComponent.cs @@ -5,7 +5,6 @@ using Content.Server.Atmos; using Content.Server.GameObjects.Components.Chemistry; using Content.Server.GameObjects.Components.Items.Storage; using Content.Server.GameObjects.EntitySystems; -using Content.Server.Interfaces; using Content.Server.Interfaces.Chat; using Content.Server.Interfaces.GameObjects; using Content.Server.Utility; @@ -15,7 +14,6 @@ using Content.Shared.GameObjects.Components.Interactable; using Content.Shared.Interfaces.GameObjects.Components; using Content.Shared.Interfaces; using Robust.Server.GameObjects; -using Robust.Server.Interfaces.Player; using Robust.Shared.GameObjects; using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.IoC; @@ -33,8 +31,6 @@ namespace Content.Server.GameObjects.Components.Interactable public class WelderComponent : ToolComponent, IExamine, IUse, ISuicideAct, ISolutionChange { [Dependency] private readonly IEntitySystemManager _entitySystemManager = default!; - [Dependency] private readonly IServerNotifyManager _notifyManager = default!; - [Dependency] private readonly IPlayerManager _playerManager = default!; public override string Name => "Welder"; public override uint? NetID => ContentNetIDs.WELDER; @@ -108,7 +104,7 @@ namespace Content.Server.GameObjects.Components.Interactable if (!CanWeld(DefaultFuelCost)) { - _notifyManager.PopupMessage(target, user, "Can't weld!"); + target.PopupMessage(user, "Can't weld!"); return false; } @@ -137,13 +133,13 @@ namespace Content.Server.GameObjects.Components.Interactable { if (!WelderLit) { - if(!silent) _notifyManager.PopupMessage(Owner, user, Loc.GetString("The welder is turned off!")); + if(!silent) Owner.PopupMessage(user, Loc.GetString("The welder is turned off!")); return false; } if (!CanWeld(value)) { - if(!silent) _notifyManager.PopupMessage(Owner, user, Loc.GetString("The welder does not have enough fuel for that!")); + if(!silent) Owner.PopupMessage(user, Loc.GetString("The welder does not have enough fuel for that!")); return false; } @@ -192,7 +188,7 @@ namespace Content.Server.GameObjects.Components.Interactable if (!CanLitWelder()) { - _notifyManager.PopupMessage(Owner, user, Loc.GetString("The welder has no fuel left!")); + Owner.PopupMessage(user, Loc.GetString("The welder has no fuel left!")); return false; } diff --git a/Content.Server/GameObjects/Components/Items/Clothing/ClothingComponent.cs b/Content.Server/GameObjects/Components/Items/Clothing/ClothingComponent.cs index c8fe5b8b78..e0920a2773 100644 --- a/Content.Server/GameObjects/Components/Items/Clothing/ClothingComponent.cs +++ b/Content.Server/GameObjects/Components/Items/Clothing/ClothingComponent.cs @@ -2,13 +2,12 @@ using System.Collections.Generic; using Content.Server.GameObjects.Components.GUI; using Content.Server.GameObjects.Components.Items.Storage; -using Content.Server.Interfaces; using Content.Shared.GameObjects; using Content.Shared.GameObjects.Components.Items; +using Content.Shared.Interfaces; using Content.Shared.Interfaces.GameObjects.Components; using Robust.Shared.GameObjects; using Robust.Shared.Interfaces.GameObjects; -using Robust.Shared.IoC; using Robust.Shared.Serialization; using static Content.Shared.GameObjects.Components.Inventory.EquipmentSlotDefines; @@ -20,8 +19,6 @@ namespace Content.Server.GameObjects.Components.Items.Clothing [ComponentReference(typeof(IItemComponent))] public class ClothingComponent : ItemComponent, IUse { - [Dependency] private readonly IServerNotifyManager _serverNotifyManager = default!; - public override string Name => "Clothing"; public override uint? NetID => ContentNetIDs.CLOTHING; @@ -112,7 +109,7 @@ namespace Content.Server.GameObjects.Components.Items.Clothing if (!inv.Equip(slot, this, true, out var reason)) { if (reason != null) - _serverNotifyManager.PopupMessage(Owner, user, reason); + Owner.PopupMessage(user, reason); return false; } diff --git a/Content.Server/GameObjects/Components/Items/RCD/RCDAmmoComponent.cs b/Content.Server/GameObjects/Components/Items/RCD/RCDAmmoComponent.cs index 3cb63d1aa2..728d5a6a09 100644 --- a/Content.Server/GameObjects/Components/Items/RCD/RCDAmmoComponent.cs +++ b/Content.Server/GameObjects/Components/Items/RCD/RCDAmmoComponent.cs @@ -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(); - } } } diff --git a/Content.Server/GameObjects/Components/Items/RCD/RCDComponent.cs b/Content.Server/GameObjects/Components/Items/RCD/RCDComponent.cs index d8194508e4..b685db4f10 100644 --- a/Content.Server/GameObjects/Components/Items/RCD/RCDComponent.cs +++ b/Content.Server/GameObjects/Components/Items/RCD/RCDComponent.cs @@ -1,9 +1,8 @@ using System; using System.Threading; using Content.Server.GameObjects.EntitySystems.DoAfter; -using Content.Server.Interfaces; -using Content.Server.Utility; using Content.Shared.GameObjects.EntitySystems; +using Content.Shared.Interfaces; using Content.Shared.Interfaces.GameObjects.Components; using Content.Shared.Maps; using Content.Shared.Utility; @@ -30,7 +29,6 @@ namespace Content.Server.GameObjects.Components.Items.RCD [Dependency] private readonly IEntitySystemManager _entitySystemManager = default!; [Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IServerEntityManager _serverEntityManager = default!; - [Dependency] private readonly IServerNotifyManager _serverNotifyManager = default!; public override string Name => "RCD"; private RcdMode _mode = 0; //What mode are we on? Can be floors, walls, deconstruct. @@ -86,12 +84,12 @@ namespace Content.Server.GameObjects.Components.Items.RCD int mode = (int) _mode; //Firstly, cast our RCDmode mode to an int (enums are backed by ints anyway by default) mode = (++mode) % _modes.Length; //Then, do a rollover on the value so it doesnt hit an invalid state _mode = (RcdMode) mode; //Finally, cast the newly acquired int mode to an RCDmode so we can use it. - _serverNotifyManager.PopupMessage(Owner, eventArgs.User, $"The RCD is now set to {this._mode} mode."); //Prints an overhead message above the RCD + Owner.PopupMessage(eventArgs.User, Loc.GetString("The RCD is now set to {0} mode.", _mode)); //Prints an overhead message above the RCD } public void Examine(FormattedMessage message, bool inDetailsRange) { - message.AddMarkup(Loc.GetString("It's currently on {0} mode, and holds {1} charges.",_mode.ToString(), this._ammo)); + message.AddMarkup(Loc.GetString("It's currently on {0} mode, and holds {1} charges.",_mode.ToString(), _ammo)); } public async void AfterInteract(AfterInteractEventArgs eventArgs) @@ -159,7 +157,7 @@ namespace Content.Server.GameObjects.Components.Items.RCD //Less expensive checks first. Failing those ones, we need to check that the tile isn't obstructed. if (_ammo <= 0) { - _serverNotifyManager.PopupMessage(Owner, eventArgs.User, $"The RCD is out of ammo!"); + Owner.PopupMessage(eventArgs.User, Loc.GetString("The RCD is out of ammo!")); return false; } @@ -180,7 +178,7 @@ namespace Content.Server.GameObjects.Components.Items.RCD case RcdMode.Floors: if (!tile.Tile.IsEmpty) { - _serverNotifyManager.PopupMessage(Owner, eventArgs.User, $"You can only build a floor on space!"); + Owner.PopupMessage(eventArgs.User, Loc.GetString("You can only build a floor on space!")); return false; } @@ -195,13 +193,13 @@ namespace Content.Server.GameObjects.Components.Items.RCD //They tried to decon a turf but the turf is blocked if (eventArgs.Target == null && tile.IsBlockedTurf(true)) { - _serverNotifyManager.PopupMessage(Owner, eventArgs.User, $"That tile is obstructed!"); + Owner.PopupMessage(eventArgs.User, Loc.GetString("That tile is obstructed!")); return false; } //They tried to decon a non-turf but it's not in the whitelist if (eventArgs.Target != null && !eventArgs.Target.TryGetComponent(out RCDDeconstructWhitelist rcd_decon)) { - _serverNotifyManager.PopupMessage(Owner, eventArgs.User, $"You can't deconstruct that!"); + Owner.PopupMessage(eventArgs.User, Loc.GetString("You can't deconstruct that!")); return false; } @@ -210,25 +208,25 @@ namespace Content.Server.GameObjects.Components.Items.RCD case RcdMode.Walls: if (tile.Tile.IsEmpty) { - _serverNotifyManager.PopupMessage(Owner, eventArgs.User, $"Cannot build a wall on space!"); + Owner.PopupMessage(eventArgs.User, Loc.GetString("You cannot build a wall on space!")); return false; } if (tile.IsBlockedTurf(true)) { - _serverNotifyManager.PopupMessage(Owner, eventArgs.User, $"That tile is obstructed!"); + Owner.PopupMessage(eventArgs.User, Loc.GetString("That tile is obstructed!")); return false; } return true; case RcdMode.Airlock: if (tile.Tile.IsEmpty) { - _serverNotifyManager.PopupMessage(Owner, eventArgs.User, $"Cannot build an airlock on space!"); + Owner.PopupMessage(eventArgs.User, Loc.GetString("Cannot build an airlock on space!")); return false; } if (tile.IsBlockedTurf(true)) { - _serverNotifyManager.PopupMessage(Owner, eventArgs.User, $"That tile is obstructed!"); + Owner.PopupMessage(eventArgs.User, Loc.GetString("That tile is obstructed!")); return false; } return true; diff --git a/Content.Server/GameObjects/Components/Items/Storage/SecureEntityStorageComponent.cs b/Content.Server/GameObjects/Components/Items/Storage/SecureEntityStorageComponent.cs index dca9f41cc8..8b7f3b939c 100644 --- a/Content.Server/GameObjects/Components/Items/Storage/SecureEntityStorageComponent.cs +++ b/Content.Server/GameObjects/Components/Items/Storage/SecureEntityStorageComponent.cs @@ -126,8 +126,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage { if (!reader.IsAllowed(user)) { - IoCManager.Resolve() - .PopupMessage(Owner, user, Loc.GetString("Access denied")); + Owner.PopupMessage(user, Loc.GetString("Access denied")); return true; } } diff --git a/Content.Server/GameObjects/Components/Kitchen/MicrowaveComponent.cs b/Content.Server/GameObjects/Components/Kitchen/MicrowaveComponent.cs index c7ec8a84f1..56258a27f7 100644 --- a/Content.Server/GameObjects/Components/Kitchen/MicrowaveComponent.cs +++ b/Content.Server/GameObjects/Components/Kitchen/MicrowaveComponent.cs @@ -12,7 +12,6 @@ using Content.Server.GameObjects.Components.GUI; using Content.Server.GameObjects.Components.Items.Storage; using Content.Server.GameObjects.Components.Power.ApcNetComponents; using Content.Server.GameObjects.EntitySystems; -using Content.Server.Interfaces; using Content.Server.Interfaces.Chat; using Content.Server.Interfaces.GameObjects; using Content.Server.Utility; @@ -27,7 +26,6 @@ using Robust.Server.GameObjects.Components.Container; using Robust.Server.GameObjects.Components.UserInterface; using Robust.Server.GameObjects.EntitySystems; using Robust.Server.Interfaces.GameObjects; -using Robust.Server.Interfaces.Player; using Robust.Shared.Audio; using Robust.Shared.GameObjects.Systems; using Content.Shared.GameObjects.Components.Body; @@ -44,8 +42,6 @@ namespace Content.Server.GameObjects.Components.Kitchen { [Dependency] private readonly IEntityManager _entityManager = default!; [Dependency] private readonly RecipeManager _recipeManager = default!; - [Dependency] private readonly IServerNotifyManager _notifyManager = default!; - [Dependency] private readonly IPlayerManager _playerManager = default!; #region YAMLSERIALIZE private int _cookTimeDefault; @@ -206,8 +202,7 @@ namespace Content.Server.GameObjects.Components.Kitchen { if (!Powered) { - _notifyManager.PopupMessage(Owner.Transform.GridPosition, eventArgs.User, - Loc.GetString("It has no power!")); + Owner.PopupMessage(eventArgs.User, Loc.GetString("It has no power!")); return false; } @@ -215,7 +210,7 @@ namespace Content.Server.GameObjects.Components.Kitchen if (itemEntity == null) { - eventArgs.User.PopupMessage(eventArgs.User, Loc.GetString("You have no active hand!")); + eventArgs.User.PopupMessage(Loc.GetString("You have no active hand!")); return false; } @@ -236,8 +231,7 @@ namespace Content.Server.GameObjects.Components.Kitchen var realTransferAmount = ReagentUnit.Min(attackPourable.TransferAmount, solution.EmptyVolume); if (realTransferAmount <= 0) //Special message if container is full { - _notifyManager.PopupMessage(Owner.Transform.GridPosition, eventArgs.User, - Loc.GetString("Container is full")); + Owner.PopupMessage(eventArgs.User, Loc.GetString("Container is full")); return false; } @@ -248,15 +242,14 @@ namespace Content.Server.GameObjects.Components.Kitchen return false; } - _notifyManager.PopupMessage(Owner.Transform.GridPosition, eventArgs.User, - Loc.GetString("Transferred {0}u", removedSolution.TotalVolume)); + Owner.PopupMessage(eventArgs.User, Loc.GetString("Transferred {0}u", removedSolution.TotalVolume)); return true; } if (!itemEntity.TryGetComponent(typeof(ItemComponent), out var food)) { - _notifyManager.PopupMessage(Owner, eventArgs.User, "That won't work!"); + Owner.PopupMessage(eventArgs.User, "That won't work!"); return false; } diff --git a/Content.Server/GameObjects/Components/MachineLinking/SignalReceiverComponent.cs b/Content.Server/GameObjects/Components/MachineLinking/SignalReceiverComponent.cs index c1e274862a..fcd03af914 100644 --- a/Content.Server/GameObjects/Components/MachineLinking/SignalReceiverComponent.cs +++ b/Content.Server/GameObjects/Components/MachineLinking/SignalReceiverComponent.cs @@ -63,7 +63,7 @@ namespace Content.Server.GameObjects.Components.MachineLinking { if (transmitter == null) { - user.PopupMessage(user, Loc.GetString("Signal not set.")); + user.PopupMessage(Loc.GetString("Signal not set.")); return false; } diff --git a/Content.Server/GameObjects/Components/Mobs/ServerStatusEffectsComponent.cs b/Content.Server/GameObjects/Components/Mobs/ServerStatusEffectsComponent.cs index a0fb2d8166..221246867e 100644 --- a/Content.Server/GameObjects/Components/Mobs/ServerStatusEffectsComponent.cs +++ b/Content.Server/GameObjects/Components/Mobs/ServerStatusEffectsComponent.cs @@ -115,7 +115,7 @@ namespace Content.Server.GameObjects.Components.Mobs hands.StopPull(); break; default: - player.PopupMessage(player, msg.Effect.ToString()); + player.PopupMessage(msg.Effect.ToString()); break; } diff --git a/Content.Server/GameObjects/Components/Movement/ClimbableComponent.cs b/Content.Server/GameObjects/Components/Movement/ClimbableComponent.cs index cf7f44b432..aafe33baf4 100644 --- a/Content.Server/GameObjects/Components/Movement/ClimbableComponent.cs +++ b/Content.Server/GameObjects/Components/Movement/ClimbableComponent.cs @@ -73,7 +73,7 @@ namespace Content.Server.GameObjects.Components.Movement canVault = CanVault(eventArgs.User, eventArgs.Dropped, eventArgs.Target, out reason); if (!canVault) - eventArgs.User.PopupMessage(eventArgs.User, reason); + eventArgs.User.PopupMessage(reason); return canVault; } diff --git a/Content.Server/GameObjects/Components/Nutrition/DrinkComponent.cs b/Content.Server/GameObjects/Components/Nutrition/DrinkComponent.cs index 73e7efaf20..194f671221 100644 --- a/Content.Server/GameObjects/Components/Nutrition/DrinkComponent.cs +++ b/Content.Server/GameObjects/Components/Nutrition/DrinkComponent.cs @@ -130,13 +130,13 @@ namespace Content.Server.GameObjects.Components.Nutrition if (!Opened) { - target.PopupMessage(target, Loc.GetString("Open it first!")); + target.PopupMessage(Loc.GetString("Open it first!")); return false; } if (_contents.CurrentVolume.Float() <= 0) { - target.PopupMessage(target, Loc.GetString("It's empty!")); + target.PopupMessage(Loc.GetString("It's empty!")); return false; } @@ -151,14 +151,14 @@ namespace Content.Server.GameObjects.Components.Nutrition { if (_useSound == null) return false; EntitySystem.Get().PlayFromEntity(_useSound, target, AudioParams.Default.WithVolume(-2f)); - target.PopupMessage(target, Loc.GetString("Slurp")); + target.PopupMessage(Loc.GetString("Slurp")); UpdateAppearance(); return true; } //Stomach was full or can't handle whatever solution we have. _contents.TryAddSolution(split); - target.PopupMessage(target, Loc.GetString("You've had enough {0}!", Owner.Name)); + target.PopupMessage(Loc.GetString("You've had enough {0}!", Owner.Name)); return false; } diff --git a/Content.Server/GameObjects/Components/Nutrition/FoodComponent.cs b/Content.Server/GameObjects/Components/Nutrition/FoodComponent.cs index 6604f0ea1e..b346108d1e 100644 --- a/Content.Server/GameObjects/Components/Nutrition/FoodComponent.cs +++ b/Content.Server/GameObjects/Components/Nutrition/FoodComponent.cs @@ -90,7 +90,7 @@ namespace Content.Server.GameObjects.Components.Nutrition { if (_utensilsNeeded != UtensilType.None) { - eventArgs.User.PopupMessage(eventArgs.User, Loc.GetString("You need to use a {0} to eat that!", _utensilsNeeded)); + eventArgs.User.PopupMessage(Loc.GetString("You need to use a {0} to eat that!", _utensilsNeeded)); return false; } @@ -122,7 +122,7 @@ namespace Content.Server.GameObjects.Components.Nutrition if (UsesRemaining <= 0) { - user.PopupMessage(user, Loc.GetString("{0:TheName} is empty!", Owner)); + user.PopupMessage(Loc.GetString("{0:TheName} is empty!", Owner)); return false; } diff --git a/Content.Server/GameObjects/Components/Power/AME/AMEControllerComponent.cs b/Content.Server/GameObjects/Components/Power/AME/AMEControllerComponent.cs index b8a768d728..f372ea3142 100644 --- a/Content.Server/GameObjects/Components/Power/AME/AMEControllerComponent.cs +++ b/Content.Server/GameObjects/Components/Power/AME/AMEControllerComponent.cs @@ -5,7 +5,6 @@ using Content.Server.GameObjects.Components.NodeContainer; using Content.Server.GameObjects.Components.NodeContainer.NodeGroups; using Content.Server.GameObjects.Components.Power.ApcNetComponents; using Content.Server.GameObjects.Components.Power.PowerNetComponents; -using Content.Server.Interfaces; using Content.Server.Interfaces.GameObjects.Components.Items; using Content.Server.Utility; using Content.Shared.GameObjects.Components.Power.AME; @@ -20,11 +19,11 @@ using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Systems; using Robust.Shared.Interfaces.GameObjects; -using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.ViewVariables; using System.Linq; using System.Threading.Tasks; +using Content.Shared.Interfaces; namespace Content.Server.GameObjects.Components.Power.AME { @@ -33,8 +32,6 @@ namespace Content.Server.GameObjects.Components.Power.AME [ComponentReference(typeof(IInteractUsing))] public class AMEControllerComponent : SharedAMEControllerComponent, IActivate, IInteractUsing { - [Dependency] private readonly IServerNotifyManager _notifyManager = default!; - [ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(AMEControllerUiKey.Key); [ViewVariables] private bool _injecting; [ViewVariables] public int InjectionAmount; @@ -117,8 +114,7 @@ namespace Content.Server.GameObjects.Components.Power.AME if (!args.User.TryGetComponent(out IHandsComponent? hands)) { - _notifyManager.PopupMessage(Owner.Transform.GridPosition, args.User, - Loc.GetString("You have no hands.")); + Owner.PopupMessage(args.User, Loc.GetString("You have no hands.")); return; } @@ -328,15 +324,13 @@ namespace Content.Server.GameObjects.Components.Power.AME { if (!args.User.TryGetComponent(out IHandsComponent? hands)) { - _notifyManager.PopupMessage(Owner.Transform.GridPosition, args.User, - Loc.GetString("You have no hands.")); + Owner.PopupMessage(args.User, Loc.GetString("You have no hands.")); return true; } if (hands.GetActiveHand == null) { - _notifyManager.PopupMessage(Owner.Transform.GridPosition, args.User, - Loc.GetString("You have nothing on your hand.")); + Owner.PopupMessage(args.User, Loc.GetString("You have nothing on your hand.")); return false; } @@ -345,22 +339,19 @@ namespace Content.Server.GameObjects.Components.Power.AME { if (HasJar) { - _notifyManager.PopupMessage(Owner.Transform.GridPosition, args.User, - Loc.GetString("The controller already has a jar loaded.")); + Owner.PopupMessage(args.User, Loc.GetString("The controller already has a jar loaded.")); } else { _jarSlot.Insert(activeHandEntity); - _notifyManager.PopupMessage(Owner.Transform.GridPosition, args.User, - Loc.GetString("You insert the jar into the fuel slot.")); + Owner.PopupMessage(args.User, Loc.GetString("You insert the jar into the fuel slot.")); UpdateUserInterface(); } } else { - _notifyManager.PopupMessage(Owner.Transform.GridPosition, args.User, - Loc.GetString("You can't put that in the controller...")); + Owner.PopupMessage(args.User, Loc.GetString("You can't put that in the controller...")); } return true; diff --git a/Content.Server/GameObjects/Components/Power/AME/AMEPartComponent.cs b/Content.Server/GameObjects/Components/Power/AME/AMEPartComponent.cs index 45d951d203..9c07e21943 100644 --- a/Content.Server/GameObjects/Components/Power/AME/AMEPartComponent.cs +++ b/Content.Server/GameObjects/Components/Power/AME/AMEPartComponent.cs @@ -1,5 +1,4 @@ using Content.Server.GameObjects.Components.Interactable; -using Content.Server.Interfaces; using Content.Server.Interfaces.GameObjects.Components.Items; using Content.Shared.GameObjects.Components.Interactable; using Content.Shared.Interfaces.GameObjects.Components; @@ -10,6 +9,7 @@ using Robust.Shared.Interfaces.Map; using Robust.Shared.IoC; using Robust.Shared.Localization; using System.Threading.Tasks; +using Content.Shared.Interfaces; namespace Content.Server.GameObjects.Components.Power.AME { @@ -19,15 +19,14 @@ namespace Content.Server.GameObjects.Components.Power.AME { [Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IServerEntityManager _serverEntityManager = default!; - [Dependency] private readonly IServerNotifyManager _notifyManager = default!; + public override string Name => "AMEPart"; async Task IInteractUsing.InteractUsing(InteractUsingEventArgs args) { if (!args.User.TryGetComponent(out IHandsComponent hands)) { - _notifyManager.PopupMessage(Owner.Transform.GridPosition, args.User, - Loc.GetString("You have no hands.")); + Owner.PopupMessage(args.User, Loc.GetString("You have no hands.")); return true; } diff --git a/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverUsers/PoweredLightComponent.cs b/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverUsers/PoweredLightComponent.cs index 0b8890964b..31cfdf5934 100644 --- a/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverUsers/PoweredLightComponent.cs +++ b/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverUsers/PoweredLightComponent.cs @@ -4,7 +4,6 @@ using Content.Server.GameObjects.Components.GUI; using Content.Server.GameObjects.Components.Items.Storage; using Content.Server.GameObjects.Components.Mobs; using Content.Server.GameObjects.EntitySystems; -using Content.Server.Interfaces; using Content.Shared.GameObjects.Components.Damage; using Content.Shared.Damage; using Content.Shared.Interfaces.GameObjects.Components; @@ -63,8 +62,7 @@ namespace Content.Server.GameObjects.Components.Power.ApcNetComponents.PowerRece case BeginDeconstructCompMsg msg: if (!msg.BlockDeconstruct && !(_lightBulbContainer.ContainedEntity is null)) { - var notifyManager = IoCManager.Resolve(); - notifyManager.PopupMessage(Owner, msg.User, "Remove the bulb."); + Owner.PopupMessage(msg.User, Loc.GetString("Remove the bulb.")); msg.BlockDeconstruct = true; } break; diff --git a/Content.Server/GameObjects/Components/RadioComponent.cs b/Content.Server/GameObjects/Components/RadioComponent.cs index c2df969c05..df927c9c28 100644 --- a/Content.Server/GameObjects/Components/RadioComponent.cs +++ b/Content.Server/GameObjects/Components/RadioComponent.cs @@ -1,6 +1,7 @@ using Content.Server.GameObjects.EntitySystems; using Content.Server.Interfaces; using Content.Server.Interfaces.Chat; +using Content.Shared.Interfaces; using Content.Shared.Interfaces.GameObjects.Components; using Robust.Shared.GameObjects; using Robust.Shared.Interfaces.GameObjects; @@ -13,7 +14,6 @@ namespace Content.Server.GameObjects.Components class RadioComponent : Component, IUse, IListen { [Dependency] private readonly IEntitySystemManager _entitySystemManager = default!; - [Dependency] private readonly IServerNotifyManager _notifyManager = default!; public override string Name => "Radio"; @@ -60,11 +60,11 @@ namespace Content.Server.GameObjects.Components RadioOn = !RadioOn; if(RadioOn) { - _notifyManager.PopupMessage(Owner, eventArgs.User, "The radio is now on."); + Owner.PopupMessage(eventArgs.User, "The radio is now on."); } else { - _notifyManager.PopupMessage(Owner, eventArgs.User, "The radio is now off."); + Owner.PopupMessage(eventArgs.User, "The radio is now off."); } return true; } diff --git a/Content.Server/GameObjects/Components/Rotatable/FlippableComponent.cs b/Content.Server/GameObjects/Components/Rotatable/FlippableComponent.cs index 43bd0ac6c2..4ebead529b 100644 --- a/Content.Server/GameObjects/Components/Rotatable/FlippableComponent.cs +++ b/Content.Server/GameObjects/Components/Rotatable/FlippableComponent.cs @@ -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; } diff --git a/Content.Server/GameObjects/Components/Rotatable/RotatableComponent.cs b/Content.Server/GameObjects/Components/Rotatable/RotatableComponent.cs index 6534dfe9b6..a3160b6fd8 100644 --- a/Content.Server/GameObjects/Components/Rotatable/RotatableComponent.cs +++ b/Content.Server/GameObjects/Components/Rotatable/RotatableComponent.cs @@ -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; } } diff --git a/Content.Server/GameObjects/Components/Stack/StackComponent.cs b/Content.Server/GameObjects/Components/Stack/StackComponent.cs index b6c5d37b9b..a32ee539e3 100644 --- a/Content.Server/GameObjects/Components/Stack/StackComponent.cs +++ b/Content.Server/GameObjects/Components/Stack/StackComponent.cs @@ -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; diff --git a/Content.Server/GameObjects/Components/Weapon/Melee/FlashComponent.cs b/Content.Server/GameObjects/Components/Weapon/Melee/FlashComponent.cs index 104e20924d..580d1282ca 100644 --- a/Content.Server/GameObjects/Components/Weapon/Melee/FlashComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Melee/FlashComponent.cs @@ -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)); } } diff --git a/Content.Server/GameObjects/Components/Weapon/Melee/StunbatonComponent.cs b/Content.Server/GameObjects/Components/Weapon/Melee/StunbatonComponent.cs index 15bbd862c8..18e3e5c764 100644 --- a/Content.Server/GameObjects/Components/Weapon/Melee/StunbatonComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Melee/StunbatonComponent.cs @@ -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().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().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; } diff --git a/Content.Server/GameObjects/Components/Weapon/Ranged/ServerRangedWeaponComponent.cs b/Content.Server/GameObjects/Components/Weapon/Ranged/ServerRangedWeaponComponent.cs index 5c8370b7e8..d852fe0b7b 100644 --- a/Content.Server/GameObjects/Components/Weapon/Ranged/ServerRangedWeaponComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Ranged/ServerRangedWeaponComponent.cs @@ -178,7 +178,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged stun.Paralyze(3f); } - user.PopupMessage(user, Loc.GetString("The gun blows up in your face!")); + user.PopupMessage(Loc.GetString("The gun blows up in your face!")); Owner.Delete(); return; diff --git a/Content.Server/GameObjects/Components/WiresComponent.cs b/Content.Server/GameObjects/Components/WiresComponent.cs index 3ad387a7ba..31edce94c6 100644 --- a/Content.Server/GameObjects/Components/WiresComponent.cs +++ b/Content.Server/GameObjects/Components/WiresComponent.cs @@ -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; } diff --git a/Content.Server/GameObjects/EntitySystems/HandsSystem.cs b/Content.Server/GameObjects/EntitySystems/HandsSystem.cs index b5d521bac7..967335dcc5 100644 --- a/Content.Server/GameObjects/EntitySystems/HandsSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/HandsSystem.cs @@ -4,12 +4,12 @@ using Content.Server.GameObjects.Components.GUI; using Content.Server.GameObjects.Components.Items.Storage; using Content.Server.GameObjects.Components.Stack; using Content.Server.GameObjects.EntitySystems.Click; -using Content.Server.Interfaces; using Content.Server.Interfaces.GameObjects.Components.Items; using Content.Server.Throw; using Content.Shared.GameObjects.Components.Inventory; using Content.Shared.GameObjects.EntitySystems; using Content.Shared.Input; +using Content.Shared.Interfaces; using JetBrains.Annotations; using Robust.Server.GameObjects.EntitySystemMessages; using Robust.Server.Interfaces.Player; @@ -28,7 +28,6 @@ namespace Content.Server.GameObjects.EntitySystems internal sealed class HandsSystem : EntitySystem { [Dependency] private readonly IMapManager _mapManager = default!; - [Dependency] private readonly IServerNotifyManager _notifyManager = default!; private const float ThrowForce = 1.5f; // Throwing force of mobs in Newtons @@ -202,9 +201,8 @@ namespace Content.Server.GameObjects.EntitySystems if (!inventoryComp.TryGetSlotItem(equipementSlot, out ItemComponent equipmentItem) || !equipmentItem.Owner.TryGetComponent(out var storageComponent)) { - _notifyManager.PopupMessage(plyEnt, plyEnt, - Loc.GetString("You have no {0} to take something out of!", - EquipmentSlotDefines.SlotNames[equipementSlot].ToLower())); + plyEnt.PopupMessage(Loc.GetString("You have no {0} to take something out of!", + EquipmentSlotDefines.SlotNames[equipementSlot].ToLower())); return; } @@ -218,9 +216,8 @@ namespace Content.Server.GameObjects.EntitySystems { if (storageComponent.StoredEntities.Count == 0) { - _notifyManager.PopupMessage(plyEnt, plyEnt, - Loc.GetString("There's nothing in your {0} to take out!", - EquipmentSlotDefines.SlotNames[equipementSlot].ToLower())); + plyEnt.PopupMessage(Loc.GetString("There's nothing in your {0} to take out!", + EquipmentSlotDefines.SlotNames[equipementSlot].ToLower())); } else { diff --git a/Content.Server/GameObjects/EntitySystems/PointingSystem.cs b/Content.Server/GameObjects/EntitySystems/PointingSystem.cs index 26d34004f4..d271d0a052 100644 --- a/Content.Server/GameObjects/EntitySystems/PointingSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/PointingSystem.cs @@ -102,7 +102,7 @@ namespace Content.Server.GameObjects.EntitySystems if (!InRange(coords, player.Transform.GridPosition)) { - player.PopupMessage(player, Loc.GetString("You can't reach there!")); + player.PopupMessage(Loc.GetString("You can't reach there!")); return false; } diff --git a/Content.Shared/GameObjects/EntitySystems/SharedInteractionSystem.cs b/Content.Shared/GameObjects/EntitySystems/SharedInteractionSystem.cs index e795676e78..87bff6af83 100644 --- a/Content.Shared/GameObjects/EntitySystems/SharedInteractionSystem.cs +++ b/Content.Shared/GameObjects/EntitySystems/SharedInteractionSystem.cs @@ -188,7 +188,7 @@ namespace Content.Shared.GameObjects.EntitySystems if (!inRange && popup) { var message = Loc.GetString("You can't reach there!"); - origin.PopupMessage(origin, message); + origin.PopupMessage(message); } return inRange; @@ -244,7 +244,7 @@ namespace Content.Shared.GameObjects.EntitySystems if (!inRange && popup) { var message = Loc.GetString("You can't reach there!"); - origin.PopupMessage(origin, message); + origin.PopupMessage(message); } return inRange; @@ -300,7 +300,7 @@ namespace Content.Shared.GameObjects.EntitySystems if (!inRange && popup) { var message = Loc.GetString("You can't reach there!"); - origin.PopupMessage(origin, message); + origin.PopupMessage(message); } return inRange; @@ -355,7 +355,7 @@ namespace Content.Shared.GameObjects.EntitySystems if (!inRange && popup) { var message = Loc.GetString("You can't reach there!"); - origin.PopupMessage(origin, message); + origin.PopupMessage(message); } return inRange; diff --git a/Content.Shared/Interfaces/ISharedNotifyManager.cs b/Content.Shared/Interfaces/ISharedNotifyManager.cs index c7d6adcd4f..3948945d74 100644 --- a/Content.Shared/Interfaces/ISharedNotifyManager.cs +++ b/Content.Shared/Interfaces/ISharedNotifyManager.cs @@ -33,7 +33,7 @@ namespace Content.Shared.Interfaces void PopupMessageCursor(IEntity viewer, string message); } - public static class NotifyManagerExt + public static class SharedNotifyExtensions { /// /// Pops up a message at the location of for @@ -44,7 +44,8 @@ namespace Content.Shared.Interfaces /// The message to show. public static void PopupMessage(this IEntity source, IEntity viewer, string message) { - IoCManager.Resolve().PopupMessage(source, viewer, message); + var notifyManager = IoCManager.Resolve(); + notifyManager.PopupMessage(source, viewer, message); } /// @@ -56,5 +57,30 @@ namespace Content.Shared.Interfaces { viewer.PopupMessage(viewer, message); } + + /// + /// Makes a string of text float up from a location on a grid. + /// + /// Location on a grid that the message floats up from. + /// The client attached entity that the message is being sent to. + /// Text contents of the message. + public static void PopupMessage(this GridCoordinates coordinates, IEntity viewer, string message) + { + var notifyManager = IoCManager.Resolve(); + notifyManager.PopupMessage(coordinates, viewer, message); + } + + /// + /// Makes a string of text float up from a client's cursor. + /// + /// + /// The client attached entity that the message is being sent to. + /// + /// Text contents of the message. + public static void PopupMessageCursor(this IEntity viewer, string message) + { + var notifyManager = IoCManager.Resolve(); + notifyManager.PopupMessageCursor(viewer, message); + } } }