]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Uplink store has to be open to receive TC (#14341)
authordeltanedas <39013340+deltanedas@users.noreply.github.com>
Sat, 29 Apr 2023 04:41:24 +0000 (04:41 +0000)
committerGitHub <noreply@github.com>
Sat, 29 Apr 2023 04:41:24 +0000 (14:41 +1000)
Co-authored-by: deltanedas <@deltanedas:kde.org>
Content.Server/Store/Systems/StoreSystem.cs

index 24efd4378e564f787ad0ca1c4328ab56c97e1977..16a3207cc874e99ba231c2b23622d8ebf3b2e48f 100644 (file)
@@ -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<StoreComponent>(args.Target, out var store))
             return;
 
+        // require the store to be open before inserting currency
+        var user = args.User;
+        if (!TryComp<ActorComponent>(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)