Kill SharedEntityExtensions and all popup extensions (#20909)
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
@@ -1,53 +0,0 @@
|
||||
using Content.Shared.Popups;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Server.Popups
|
||||
{
|
||||
public static class PopupExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Pops up a message for every player around <see cref="source"/> to see,
|
||||
/// except for <see cref="source"/> itself.
|
||||
/// </summary>
|
||||
/// <param name="source">The entity on which to popup the message.</param>
|
||||
/// <param name="message">The message to show.</param>
|
||||
[Obsolete("Use PopupSystem.PopupEntity instead")]
|
||||
public static void PopupMessageOtherClients(this EntityUid source, string message)
|
||||
{
|
||||
var viewers = Filter.Empty()
|
||||
.AddPlayersByPvs(source)
|
||||
.Recipients;
|
||||
|
||||
foreach (var viewer in viewers)
|
||||
{
|
||||
if (viewer.AttachedEntity is not {Valid: true} viewerEntity || source == viewerEntity || viewer.AttachedEntity == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
source.PopupMessage(viewerEntity, message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pops up a message at the given entity's location for everyone,
|
||||
/// including itself, to see.
|
||||
/// </summary>
|
||||
/// <param name="source">The entity above which to show the message.</param>
|
||||
/// <param name="message">The message to be seen.</param>
|
||||
/// <param name="playerManager">
|
||||
/// The instance of player manager to use, will be resolved automatically
|
||||
/// if null.
|
||||
/// </param>
|
||||
/// <param name="range">
|
||||
/// The range in which to search for players, defaulting to one screen.
|
||||
/// </param>
|
||||
[Obsolete("Use PopupSystem.PopupEntity instead")]
|
||||
public static void PopupMessageEveryone(this EntityUid source, string message, IPlayerManager? playerManager = null, int range = 15)
|
||||
{
|
||||
source.PopupMessage(message);
|
||||
source.PopupMessageOtherClients(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Popups;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
namespace Content.Server.Popups
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public sealed class PopupMsgCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "srvpopupmsg";
|
||||
public string Description => "";
|
||||
public string Help => "";
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var source = EntityUid.Parse(args[0]);
|
||||
var viewer = EntityUid.Parse(args[1]);
|
||||
var msg = args[2];
|
||||
|
||||
source.PopupMessage(viewer, msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ namespace Content.Server.Popups
|
||||
{
|
||||
[Dependency] private readonly IPlayerManager _player = default!;
|
||||
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
||||
[Dependency] private readonly TransformSystem _xform = default!;
|
||||
|
||||
public override void PopupCursor(string message, PopupType type = PopupType.Small)
|
||||
{
|
||||
@@ -36,7 +37,7 @@ namespace Content.Server.Popups
|
||||
|
||||
public override void PopupCoordinates(string message, EntityCoordinates coordinates, PopupType type = PopupType.Small)
|
||||
{
|
||||
var mapPos = coordinates.ToMap(EntityManager);
|
||||
var mapPos = coordinates.ToMap(EntityManager, _xform);
|
||||
var filter = Filter.Empty().AddPlayersByPvs(mapPos, entManager: EntityManager, playerMan: _player, cfgMan: _cfg);
|
||||
RaiseNetworkEvent(new PopupCoordinatesEvent(message, type, GetNetCoordinates(coordinates)), filter);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user