PopupSystem now uses Filter methods for getting players from entities. (#4751)
This commit is contained in:
committed by
GitHub
parent
45d62f6eed
commit
3e2a8738a9
@@ -79,24 +79,24 @@ namespace Content.Client.Popups
|
|||||||
{
|
{
|
||||||
if (!filter.CheckPrediction)
|
if (!filter.CheckPrediction)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
PopupCursor(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void PopupCoordinates(string message, EntityCoordinates coordinates, Filter filter)
|
public override void PopupCoordinates(string message, EntityCoordinates coordinates, Filter filter)
|
||||||
{
|
{
|
||||||
if (!filter.CheckPrediction)
|
if (!filter.CheckPrediction)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
PopupCoordinates(message, coordinates);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void PopupEntity(string message, EntityUid uid, Filter filter)
|
public override void PopupEntity(string message, EntityUid uid, Filter filter)
|
||||||
{
|
{
|
||||||
if (!filter.CheckPrediction)
|
if (!filter.CheckPrediction)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
public override Filter GetFilterFromEntity(IEntity entity)
|
PopupEntity(message, uid);
|
||||||
{
|
|
||||||
return _playerManager.LocalPlayer?.ControlledEntity == entity
|
|
||||||
? Filter.Local() : Filter.Empty().Unpredicted();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -22,11 +22,5 @@ namespace Content.Server.Popups
|
|||||||
{
|
{
|
||||||
RaiseNetworkEvent(new PopupEntityEvent(message, uid), filter);
|
RaiseNetworkEvent(new PopupEntityEvent(message, uid), filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Filter GetFilterFromEntity(IEntity entity)
|
|
||||||
{
|
|
||||||
return entity.TryGetComponent(out ActorComponent? actor)
|
|
||||||
? Filter.SinglePlayer(actor.PlayerSession) : Filter.Empty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,10 @@ namespace Content.Shared.Popups
|
|||||||
/// player attached to the entity.
|
/// player attached to the entity.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>Using this method is NOT recommended, please use one of the other methods instead.</remarks>
|
/// <remarks>Using this method is NOT recommended, please use one of the other methods instead.</remarks>
|
||||||
public abstract Filter GetFilterFromEntity(IEntity entity);
|
public Filter GetFilterFromEntity(IEntity entity)
|
||||||
|
{
|
||||||
|
return Filter.Entities(entity.Uid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user