From 3e2a8738a92a7a7f52ece697bb41cde307c43ee9 Mon Sep 17 00:00:00 2001 From: Vera Aguilera Puerto <6766154+Zumorica@users.noreply.github.com> Date: Sun, 3 Oct 2021 16:15:15 +0200 Subject: [PATCH] PopupSystem now uses Filter methods for getting players from entities. (#4751) --- Content.Client/Popups/PopupSystem.cs | 10 +++++----- Content.Server/Popups/PopupSystem.cs | 6 ------ Content.Shared/Popups/SharedPopupSystem.cs | 5 ++++- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/Content.Client/Popups/PopupSystem.cs b/Content.Client/Popups/PopupSystem.cs index 48cb2faf6a..34105c0493 100644 --- a/Content.Client/Popups/PopupSystem.cs +++ b/Content.Client/Popups/PopupSystem.cs @@ -79,24 +79,24 @@ namespace Content.Client.Popups { if (!filter.CheckPrediction) return; + + PopupCursor(message); } public override void PopupCoordinates(string message, EntityCoordinates coordinates, Filter filter) { if (!filter.CheckPrediction) return; + + PopupCoordinates(message, coordinates); } public override void PopupEntity(string message, EntityUid uid, Filter filter) { if (!filter.CheckPrediction) return; - } - public override Filter GetFilterFromEntity(IEntity entity) - { - return _playerManager.LocalPlayer?.ControlledEntity == entity - ? Filter.Local() : Filter.Empty().Unpredicted(); + PopupEntity(message, uid); } #endregion diff --git a/Content.Server/Popups/PopupSystem.cs b/Content.Server/Popups/PopupSystem.cs index 85335503a7..755b359255 100644 --- a/Content.Server/Popups/PopupSystem.cs +++ b/Content.Server/Popups/PopupSystem.cs @@ -22,11 +22,5 @@ namespace Content.Server.Popups { RaiseNetworkEvent(new PopupEntityEvent(message, uid), filter); } - - public override Filter GetFilterFromEntity(IEntity entity) - { - return entity.TryGetComponent(out ActorComponent? actor) - ? Filter.SinglePlayer(actor.PlayerSession) : Filter.Empty(); - } } } diff --git a/Content.Shared/Popups/SharedPopupSystem.cs b/Content.Shared/Popups/SharedPopupSystem.cs index 0849d75fbe..4c74adf33f 100644 --- a/Content.Shared/Popups/SharedPopupSystem.cs +++ b/Content.Shared/Popups/SharedPopupSystem.cs @@ -39,7 +39,10 @@ namespace Content.Shared.Popups /// player attached to the entity. /// /// Using this method is NOT recommended, please use one of the other methods instead. - public abstract Filter GetFilterFromEntity(IEntity entity); + public Filter GetFilterFromEntity(IEntity entity) + { + return Filter.Entities(entity.Uid); + } } ///