From cd29f475b98bc7411ef7edf677f4b9ea689cbb02 Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Sat, 10 Sep 2022 00:39:22 +1000 Subject: [PATCH] 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. --- Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs b/Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs index fdc69aec3c..72a311e61c 100644 --- a/Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs +++ b/Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs @@ -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 /// 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; }