PopupMessage(message, type, coordinates, null, true);
}
+ public override void PopupPredictedCoordinates(string? message, EntityCoordinates coordinates, EntityUid? recipient, PopupType type = PopupType.Small)
+ {
+ if (recipient != null && _timing.IsFirstTimePredicted)
+ PopupCoordinates(message, coordinates, recipient.Value, type);
+ }
+
private void PopupCursorInternal(string? message, PopupType type, bool recordReplay)
{
if (message == null)
{
[Dependency] private readonly IPlayerManager _player = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!;
- [Dependency] private readonly TransformSystem _xform = default!;
+ [Dependency] private readonly SharedTransformSystem _transform = default!;
public override void PopupCursor(string? message, PopupType type = PopupType.Small)
{
{
if (message == null)
return;
-
- var mapPos = coordinates.ToMap(EntityManager, _xform);
+ var mapPos = _transform.ToMapCoordinates(coordinates);
var filter = Filter.Empty().AddPlayersByPvs(mapPos, entManager: EntityManager, playerMan: _player, cfgMan: _cfg);
RaiseNetworkEvent(new PopupCoordinatesEvent(message, type, GetNetCoordinates(coordinates)), filter);
}
RaiseNetworkEvent(new PopupCoordinatesEvent(message, type, GetNetCoordinates(coordinates)), actor.PlayerSession);
}
+ public override void PopupPredictedCoordinates(string? message, EntityCoordinates coordinates, EntityUid? recipient, PopupType type = PopupType.Small)
+ {
+ if (message == null)
+ return;
+
+ var mapPos = _transform.ToMapCoordinates(coordinates);
+ var filter = Filter.Empty().AddPlayersByPvs(mapPos, entManager: EntityManager, playerMan: _player, cfgMan: _cfg);
+ if (recipient != null)
+ {
+ // Don't send to recipient, since they predicted it locally
+ filter = filter.RemovePlayerByAttachedEntity(recipient.Value);
+ }
+ RaiseNetworkEvent(new PopupCoordinatesEvent(message, type, GetNetCoordinates(coordinates)), filter);
+ }
+
public override void PopupEntity(string? message, EntityUid uid, PopupType type = PopupType.Small)
{
if (message == null)
using Content.Shared.Actions;
using Content.Shared.Hands.Components;
using Content.Shared.Hands.EntitySystems;
+using Content.Shared.IdentityManagement;
using Content.Shared.Popups;
using Content.Shared.Projectiles;
using Robust.Shared.GameStates;
if (TryComp<EmbeddableProjectileComponent>(ent, out var projectile))
_proj.EmbedDetach(ent, projectile, actionOwner.Value);
- _popups.PopupPredicted(Loc.GetString("item-recall-item-summon", ("item", ent)), actionOwner.Value, actionOwner.Value);
+ _popups.PopupPredicted(Loc.GetString("item-recall-item-summon-self", ("item", ent)),
+ Loc.GetString("item-recall-item-summon-others", ("item", ent), ("name", Identity.Entity(actionOwner.Value, EntityManager))),
+ actionOwner.Value, actionOwner.Value);
+ _popups.PopupPredictedCoordinates(Loc.GetString("item-recall-item-disappear", ("item", ent)), Transform(ent).Coordinates, actionOwner.Value);
_hands.TryForcePickupAnyHand(actionOwner.Value, ent);
}
/// </summary>
public abstract void PopupCoordinates(string? message, EntityCoordinates coordinates, ICommonSession recipient, PopupType type = PopupType.Small);
+ /// <summary>
+ /// Variant of <see cref="PopupCoordinates(string, EntityCoordinates, PopupType)"/> for use with prediction. The local client will
+ /// the popup to the recipient, and the server will show it to every other player in PVS range. If recipient is null, the local
+ // client will do nothing and the server will show the message to every player in PVS range.
+ /// </summary>
+ public abstract void PopupPredictedCoordinates(string? message, EntityCoordinates coordinates, EntityUid? recipient, PopupType type = PopupType.Small);
+
/// <summary>
/// Shows a popup above an entity for every player in pvs range.
/// </summary>
item-recall-item-marked = You draw a magical sigil on {THE($item)}.
item-recall-item-already-marked = {CAPITALIZE(THE($item))} is already marked!
item-recall-item-mark-empty = You must be holding an item!
-item-recall-item-summon = {CAPITALIZE(THE($item))} appears in your hand!
+item-recall-item-summon-self = {CAPITALIZE(THE($item))} appears in your hand!
+item-recall-item-summon-others = {CAPITALIZE(THE($item))} appears in {THE($name)}'s hand!
+item-recall-item-disappear = {CAPITALIZE(THE($item))} disappears!
item-recall-item-unmark = You feel your connection with {THE($item)} sever.