]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Add closing storage UIs to StorageInteractionTest (#28633)
authorLeon Friedrich <60421075+ElectroJr@users.noreply.github.com>
Wed, 5 Jun 2024 22:14:25 +0000 (10:14 +1200)
committerGitHub <noreply@github.com>
Wed, 5 Jun 2024 22:14:25 +0000 (18:14 -0400)
Content.IntegrationTests/Tests/Storage/StorageInteractionTest.cs
Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs

index 34402dd5e627caab9bc197a2bd315b1cb462b566..8d0de707f3b287c4741f45d0006a2bb7413d8e9d 100644 (file)
@@ -4,6 +4,7 @@ using Content.IntegrationTests.Tests.Interaction;
 using Content.Shared.Input;
 using Content.Shared.PDA;
 using Content.Shared.Storage;
+using Content.Shared.Timing;
 using Robust.Client.UserInterface;
 using Robust.Shared.Containers;
 using Robust.Shared.GameObjects;
@@ -27,11 +28,22 @@ public sealed class StorageInteractionTest : InteractionTest
         Assert.That(IsUiOpen(StorageComponent.StorageUiKey.Key), Is.False);
         Assert.That(IsUiOpen(PdaUiKey.Key), Is.False);
 
+        await Server.WaitPost(() => SEntMan.RemoveComponent<UseDelayComponent>(STarget!.Value));
+        await RunTicks(5);
+
         // Activating the backpack opens the UI
         await Activate();
         Assert.That(IsUiOpen(StorageComponent.StorageUiKey.Key), Is.True);
         Assert.That(IsUiOpen(PdaUiKey.Key), Is.False);
 
+        // Activating it again closes the UI
+        await Activate();
+        Assert.That(IsUiOpen(StorageComponent.StorageUiKey.Key), Is.False);
+
+        // Open it again
+        await Activate();
+        Assert.That(IsUiOpen(StorageComponent.StorageUiKey.Key), Is.True);
+
         // Pick up a PDA
         var pda = await PlaceInHands("PassengerPDA");
         var sPda = ToServer(pda);
index d87b57bfc8dde7d052c90c8ca30c0b9b756612cd..f20e2f9ab1f2cd077f5949586be75d04f364ceb4 100644 (file)
@@ -298,7 +298,7 @@ public abstract class SharedStorageSystem : EntitySystem
             return;
 
         // prevent spamming bag open / honkerton honk sound
-        silent |= TryComp<UseDelayComponent>(uid, out var useDelay) && UseDelay.IsDelayed((uid, useDelay));
+        silent |= TryComp<UseDelayComponent>(uid, out var useDelay) && UseDelay.IsDelayed((uid, useDelay), id: OpenUiUseDelayID);
         if (!CanInteract(entity, (uid, storageComp), silent: silent))
             return;
 
@@ -308,7 +308,7 @@ public abstract class SharedStorageSystem : EntitySystem
                 Audio.PlayPredicted(storageComp.StorageOpenSound, uid, entity);
 
             if (useDelay != null)
-                UseDelay.TryResetDelay((uid, useDelay));
+                UseDelay.TryResetDelay((uid, useDelay), id: OpenUiUseDelayID);
         }
 
         _ui.OpenUi(uid, StorageComponent.StorageUiKey.Key, entity);