From 45be0f8e91d6d34023b61d4ca5c7518a424ab7db Mon Sep 17 00:00:00 2001 From: deltanedas <39013340+deltanedas@users.noreply.github.com> Date: Sat, 29 Apr 2023 04:41:24 +0000 Subject: [PATCH] Uplink store has to be open to receive TC (#14341) Co-authored-by: deltanedas <@deltanedas:kde.org> --- Content.Server/Store/Systems/StoreSystem.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) 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) -- 2.51.2