Add two-message overload to PopupPredicted (#26907)
Added two-message overload to PopupPredicted
This commit is contained in:
@@ -184,6 +184,12 @@ namespace Content.Client.Popups
|
|||||||
PopupEntity(message, uid, recipient.Value, type);
|
PopupEntity(message, uid, recipient.Value, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void PopupPredicted(string? recipientMessage, string? othersMessage, EntityUid uid, EntityUid? recipient, PopupType type = PopupType.Small)
|
||||||
|
{
|
||||||
|
if (recipient != null && _timing.IsFirstTimePredicted)
|
||||||
|
PopupEntity(recipientMessage, uid, recipient.Value, type);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Network Event Handlers
|
#region Network Event Handlers
|
||||||
|
|||||||
@@ -126,5 +126,10 @@ namespace Content.Server.Popups
|
|||||||
RaiseNetworkEvent(new PopupEntityEvent(message, type, GetNetEntity(uid)));
|
RaiseNetworkEvent(new PopupEntityEvent(message, type, GetNetEntity(uid)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void PopupPredicted(string? recipientMessage, string? othersMessage, EntityUid uid, EntityUid? recipient, PopupType type = PopupType.Small)
|
||||||
|
{
|
||||||
|
PopupPredicted(othersMessage, uid, recipient, type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,8 +116,9 @@ public sealed class BurialSystem : EntitySystem
|
|||||||
{
|
{
|
||||||
if (used != null)
|
if (used != null)
|
||||||
{
|
{
|
||||||
_popupSystem.PopupClient(Loc.GetString("grave-start-digging-user", ("grave", uid), ("tool", used)), user, user);
|
var selfMessage = Loc.GetString("grave-start-digging-user", ("grave", uid), ("tool", used));
|
||||||
_popupSystem.PopupEntity(Loc.GetString("grave-start-digging-others", ("user", user), ("grave", uid), ("tool", used)), user, Filter.PvsExcept(user), true);
|
var othersMessage = Loc.GetString("grave-start-digging-others", ("user", user), ("grave", uid), ("tool", used));
|
||||||
|
_popupSystem.PopupPredicted(selfMessage, othersMessage, user, user);
|
||||||
component.ActiveShovelDigging = true;
|
component.ActiveShovelDigging = true;
|
||||||
Dirty(uid, component);
|
Dirty(uid, component);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,9 +57,11 @@ public sealed partial class BonkSystem : EntitySystem
|
|||||||
if (user == source)
|
if (user == source)
|
||||||
{
|
{
|
||||||
// Non-local, non-bonking players
|
// Non-local, non-bonking players
|
||||||
_popupSystem.PopupEntity(Loc.GetString("bonkable-success-message-others", ("user", userName), ("bonkable", bonkableName)), user, Filter.PvsExcept(user), true);
|
var othersMessage = Loc.GetString("bonkable-success-message-others", ("user", userName), ("bonkable", bonkableName));
|
||||||
// Local, bonking player
|
// Local, bonking player
|
||||||
_popupSystem.PopupClient(Loc.GetString("bonkable-success-message-user", ("user", userName), ("bonkable", bonkableName)), user, user);
|
var selfMessage = Loc.GetString("bonkable-success-message-user", ("user", userName), ("bonkable", bonkableName));
|
||||||
|
|
||||||
|
_popupSystem.PopupPredicted(selfMessage, othersMessage, user, user);
|
||||||
}
|
}
|
||||||
else if (source != null)
|
else if (source != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -307,8 +307,7 @@ public sealed partial class ClimbSystem : VirtualController
|
|||||||
("climbable", climbable));
|
("climbable", climbable));
|
||||||
}
|
}
|
||||||
|
|
||||||
_popupSystem.PopupEntity(othersMessage, uid, Filter.PvsExcept(user, entityManager: EntityManager), true);
|
_popupSystem.PopupPredicted(selfMessage, othersMessage, uid, user);
|
||||||
_popupSystem.PopupClient(selfMessage, uid, user);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -94,6 +94,12 @@ namespace Content.Shared.Popups
|
|||||||
/// will do nothing and the server will show the message to every player in PVS range.
|
/// will do nothing and the server will show the message to every player in PVS range.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract void PopupPredicted(string? message, EntityUid uid, EntityUid? recipient, PopupType type = PopupType.Small);
|
public abstract void PopupPredicted(string? message, EntityUid uid, EntityUid? recipient, PopupType type = PopupType.Small);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Variant of <see cref="PopupPredicted(string?, EntityUid, EntityUid?, PopupType)"/> that displays <paramref name="recipientMessage"/>
|
||||||
|
/// to the recipient and <paramref name="othersMessage"/> to everyone else in PVS range.
|
||||||
|
/// </summary>
|
||||||
|
public abstract void PopupPredicted(string? recipientMessage, string? othersMessage, EntityUid uid, EntityUid? recipient, PopupType type = PopupType.Small);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -195,8 +195,9 @@ public sealed class WieldableSystem : EntitySystem
|
|||||||
&& !_delay.TryResetDelay((used, useDelay), true))
|
&& !_delay.TryResetDelay((used, useDelay), true))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
_popupSystem.PopupClient(Loc.GetString("wieldable-component-successful-wield", ("item", used)), user, user);
|
var selfMessage = Loc.GetString("wieldable-component-successful-wield", ("item", used));
|
||||||
_popupSystem.PopupEntity(Loc.GetString("wieldable-component-successful-wield-other", ("user", user), ("item", used)), user, Filter.PvsExcept(user), true);
|
var othersMessage = Loc.GetString("wieldable-component-successful-wield-other", ("user", user), ("item", used));
|
||||||
|
_popupSystem.PopupPredicted(selfMessage, othersMessage, user, user);
|
||||||
|
|
||||||
var targEv = new ItemWieldedEvent();
|
var targEv = new ItemWieldedEvent();
|
||||||
RaiseLocalEvent(used, ref targEv);
|
RaiseLocalEvent(used, ref targEv);
|
||||||
@@ -239,10 +240,9 @@ public sealed class WieldableSystem : EntitySystem
|
|||||||
if (component.UnwieldSound != null)
|
if (component.UnwieldSound != null)
|
||||||
_audioSystem.PlayPredicted(component.UnwieldSound, uid, args.User);
|
_audioSystem.PlayPredicted(component.UnwieldSound, uid, args.User);
|
||||||
|
|
||||||
_popupSystem.PopupClient(Loc.GetString("wieldable-component-failed-wield",
|
var selfMessage = Loc.GetString("wieldable-component-failed-wield", ("item", uid));
|
||||||
("item", uid)), args.User.Value, args.User.Value);
|
var othersMessage = Loc.GetString("wieldable-component-failed-wield-other", ("user", args.User.Value), ("item", uid));
|
||||||
_popupSystem.PopupEntity(Loc.GetString("wieldable-component-failed-wield-other",
|
_popupSystem.PopupPredicted(selfMessage, othersMessage, args.User.Value, args.User.Value);
|
||||||
("user", args.User.Value), ("item", uid)), args.User.Value, Filter.PvsExcept(args.User.Value), true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_appearance.SetData(uid, WieldableVisuals.Wielded, false);
|
_appearance.SetData(uid, WieldableVisuals.Wielded, false);
|
||||||
|
|||||||
Reference in New Issue
Block a user