Fix item slot mispredict (#11134)
On master it replays it every tick so it gets spammed. The server also plays it to the client as well so you get a duplicate.
This commit is contained in:
parent
5ccffffd84
commit
cd29f475b9
1 changed files with 5 additions and 1 deletions
|
|
@ -11,6 +11,8 @@ using Robust.Shared.GameStates;
|
|||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Utility;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
namespace Content.Shared.Containers.ItemSlots
|
||||
{
|
||||
|
|
@ -19,6 +21,8 @@ namespace Content.Shared.Containers.ItemSlots
|
|||
/// </summary>
|
||||
public sealed class ItemSlotsSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IGameTiming _timing = default!;
|
||||
[Dependency] private readonly INetManager _netManager = default!;
|
||||
[Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!;
|
||||
[Dependency] private readonly SharedContainerSystem _containers = default!;
|
||||
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
|
||||
|
|
@ -237,7 +241,7 @@ namespace Content.Shared.Containers.ItemSlots
|
|||
|
||||
if (slot.Whitelist != null && !slot.Whitelist.IsValid(usedUid))
|
||||
{
|
||||
if (popup.HasValue && !string.IsNullOrWhiteSpace(slot.WhitelistFailPopup))
|
||||
if (_netManager.IsClient && _timing.IsFirstTimePredicted && popup.HasValue && !string.IsNullOrWhiteSpace(slot.WhitelistFailPopup))
|
||||
_popupSystem.PopupEntity(Loc.GetString(slot.WhitelistFailPopup), uid, Filter.Entities(popup.Value));
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue