Wizard Recall shows Disappearing text at Coordinate (#35272)
* Add prediction for coordinate based popups * Remove use of deprecated EntityCoordinates.ToMap * RecallItem displays disppearing text at entity coordinates * Update Content.Shared/ItemRecall/SharedItemRecallSystem.cs Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> * Update Content.Shared/Popups/SharedPopupSystem.cs Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> * Add ItemRecall message for witnesses * Update Content.Shared/ItemRecall/SharedItemRecallSystem.cs Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> * Update Resources/Locale/en-US/item-recall/item-recall.ftl Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> * Fix namespace issues * Fix Loc string * Dont fixstuff tired.. * Prefix THE * Filter around the entity, and remove recipient if needed * Alphabetical imports * Update Content.Client/Popups/PopupSystem.cs Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> * fixup * Better handling. --------- Co-authored-by: Cooper Wallace <CooperWallace@users.noreply.github.com> Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
This commit is contained in:
@@ -123,6 +123,12 @@ namespace Content.Client.Popups
|
||||
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)
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Content.Server.Popups
|
||||
{
|
||||
[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)
|
||||
{
|
||||
@@ -47,8 +47,7 @@ namespace Content.Server.Popups
|
||||
{
|
||||
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);
|
||||
}
|
||||
@@ -70,6 +69,21 @@ namespace Content.Server.Popups
|
||||
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)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
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;
|
||||
@@ -83,7 +84,10 @@ public abstract partial class SharedItemRecallSystem : EntitySystem
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -58,6 +58,13 @@ namespace Content.Shared.Popups
|
||||
/// </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>
|
||||
|
||||
@@ -4,6 +4,8 @@ item-recall-marked-description = Recall {THE($item)} back into your hand.
|
||||
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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user