Add PopupPredictedCursor and fix doubled popups on vending machines (#36655)
* Add PopupCursorPredicted method * Fix doubled popups on vending machine restock failures * Rename to match existing pattern
This commit is contained in:
@@ -173,6 +173,16 @@ namespace Content.Client.Popups
|
||||
PopupCursor(message, type);
|
||||
}
|
||||
|
||||
public override void PopupPredictedCursor(string? message, ICommonSession recipient, PopupType type = PopupType.Small)
|
||||
{
|
||||
PopupCursor(message, recipient, type);
|
||||
}
|
||||
|
||||
public override void PopupPredictedCursor(string? message, EntityUid recipient, PopupType type = PopupType.Small)
|
||||
{
|
||||
PopupCursor(message, recipient, type);
|
||||
}
|
||||
|
||||
public override void PopupCoordinates(string? message, EntityCoordinates coordinates, Filter filter, bool replayRecord, PopupType type = PopupType.Small)
|
||||
{
|
||||
PopupCoordinates(message, coordinates, type);
|
||||
|
||||
@@ -35,6 +35,16 @@ namespace Content.Server.Popups
|
||||
RaiseNetworkEvent(new PopupCursorEvent(message, type), actor.PlayerSession);
|
||||
}
|
||||
|
||||
public override void PopupPredictedCursor(string? message, ICommonSession recipient, PopupType type = PopupType.Small)
|
||||
{
|
||||
// Do nothing, since the client already predicted the popup.
|
||||
}
|
||||
|
||||
public override void PopupPredictedCursor(string? message, EntityUid recipient, PopupType type = PopupType.Small)
|
||||
{
|
||||
// Do nothing, since the client already predicted the popup.
|
||||
}
|
||||
|
||||
public override void PopupCoordinates(string? message, EntityCoordinates coordinates, Filter filter, bool replayRecord, PopupType type = PopupType.Small)
|
||||
{
|
||||
if (message == null)
|
||||
|
||||
@@ -32,6 +32,18 @@ namespace Content.Shared.Popups
|
||||
/// <param name="type">Used to customize how this popup should appear visually.</param>
|
||||
public abstract void PopupCursor(string? message, EntityUid recipient, PopupType type = PopupType.Small);
|
||||
|
||||
/// <summary>
|
||||
/// Variant of <see cref="PopupCursor(string?, ICommonSession, PopupType)"/> for use with prediction.
|
||||
/// The local client will show the popup to the recipient. Does nothing on the server.
|
||||
/// </summary>
|
||||
public abstract void PopupPredictedCursor(string? message, ICommonSession recipient, PopupType type = PopupType.Small);
|
||||
|
||||
/// <summary>
|
||||
/// Variant of <see cref="PopupCursor(string?, EntityUid, PopupType)"/> for use with prediction.
|
||||
/// The local client will show the popup to the recipient. Does nothing on the server.
|
||||
/// </summary>
|
||||
public abstract void PopupPredictedCursor(string? message, EntityUid recipient, PopupType type = PopupType.Small);
|
||||
|
||||
/// <summary>
|
||||
/// Shows a popup at a world location to every entity in PVS range.
|
||||
/// </summary>
|
||||
|
||||
@@ -17,7 +17,7 @@ public abstract partial class SharedVendingMachineSystem
|
||||
{
|
||||
if (!TryComp<WiresPanelComponent>(target, out var panel) || !panel.Open)
|
||||
{
|
||||
Popup.PopupCursor(Loc.GetString("vending-machine-restock-needs-panel-open",
|
||||
Popup.PopupPredictedCursor(Loc.GetString("vending-machine-restock-needs-panel-open",
|
||||
("this", uid),
|
||||
("user", user),
|
||||
("target", target)),
|
||||
@@ -37,7 +37,7 @@ public abstract partial class SharedVendingMachineSystem
|
||||
{
|
||||
if (!component.CanRestock.Contains(machineComponent.PackPrototypeId))
|
||||
{
|
||||
Popup.PopupCursor(Loc.GetString("vending-machine-restock-invalid-inventory", ("this", uid), ("user", user),
|
||||
Popup.PopupPredictedCursor(Loc.GetString("vending-machine-restock-invalid-inventory", ("this", uid), ("user", user),
|
||||
("target", target)), user);
|
||||
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user