diff --git a/Content.Server/Store/Systems/StoreSystem.cs b/Content.Server/Store/Systems/StoreSystem.cs index 24efd4378e..16a3207cc8 100644 --- a/Content.Server/Store/Systems/StoreSystem.cs +++ b/Content.Server/Store/Systems/StoreSystem.cs @@ -1,13 +1,15 @@ +using Content.Server.Mind.Components; using Content.Server.Store.Components; +using Content.Server.UserInterface; using Content.Shared.FixedPoint; using Content.Shared.Interaction; using Content.Shared.Popups; +using Content.Shared.Stacks; using Content.Shared.Store; +using JetBrains.Annotations; +using Robust.Server.GameObjects; using Robust.Shared.Prototypes; using System.Linq; -using Content.Server.UserInterface; -using Content.Shared.Stacks; -using JetBrains.Annotations; namespace Content.Server.Store.Systems; @@ -68,6 +70,11 @@ public sealed partial class StoreSystem : EntitySystem if (args.Target == null || !TryComp(args.Target, out var store)) return; + // require the store to be open before inserting currency + var user = args.User; + if (!TryComp(user, out var actor) || !_ui.SessionHasOpenUi(uid, StoreUiKey.Key, actor.PlayerSession)) + return; + args.Handled = TryAddCurrency(GetCurrencyValue(uid, component), args.Target.Value, store); if (args.Handled)