diff --git a/Content.Server/Utility/NotifyExtensions.cs b/Content.Server/Utility/NotifyExtensions.cs index d4ae473f31..ef076ce1aa 100644 --- a/Content.Server/Utility/NotifyExtensions.cs +++ b/Content.Server/Utility/NotifyExtensions.cs @@ -13,12 +13,17 @@ namespace Content.Server.Utility /// /// The entity on which to popup the message. /// The message to show. + /// + /// The instance of player manager to use, will be resolved automatically + /// if null. + /// /// /// The range in which to search for players, defaulting to one screen. /// - public static void PopupMessageOtherClients(this IEntity source, string message, int range = 15) + public static void PopupMessageOtherClients(this IEntity source, string message, IPlayerManager playerManager = null, int range = 15) { - var playerManager = IoCManager.Resolve(); + playerManager ??= IoCManager.Resolve(); + var viewers = playerManager.GetPlayersInRange(source.Transform.Coordinates, range); foreach (var viewer in viewers) @@ -33,5 +38,24 @@ namespace Content.Server.Utility source.PopupMessage(viewer.AttachedEntity, message); } } + + /// + /// Pops up a message at the given entity's location for everyone, + /// including itself, to see. + /// + /// The entity above which to show the message. + /// The message to be seen. + /// + /// The instance of player manager to use, will be resolved automatically + /// if null. + /// + /// + /// The range in which to search for players, defaulting to one screen. + /// + public static void PopupMessageEveryone(this IEntity source, string message, IPlayerManager playerManager = null, int range = 15) + { + source.PopupMessage(message); + source.PopupMessageOtherClients(message, playerManager, range); + } } }