]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Can no longer place an infinite quantity of items inside a microwave (#23577)
authorSpeltIncorrectyl <66873282+SpeltIncorrectyl@users.noreply.github.com>
Fri, 5 Jan 2024 20:03:48 +0000 (20:03 +0000)
committerGitHub <noreply@github.com>
Fri, 5 Jan 2024 20:03:48 +0000 (15:03 -0500)
* initial commit

* rewrote code to early return to reduce nesting

* added VV to Capacity field of MicrowaveComponent

Content.Server/Kitchen/Components/MicrowaveComponent.cs
Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs
Resources/Locale/en-US/kitchen/components/microwave-component.ftl
Resources/Prototypes/Entities/Structures/Machines/microwave.yml

index 45f927389ef0cad28de6564cc1587ae383367fd2..631ce6a45016f1ce7f85d0b6f10f1c928d6b4203 100644 (file)
@@ -66,6 +66,9 @@ namespace Content.Server.Kitchen.Components
         public int CurrentCookTimeButtonIndex;
 
         public Container Storage = default!;
+
+        [DataField, ViewVariables(VVAccess.ReadWrite)]
+        public int Capacity = 10;
     }
 
     public sealed class BeingMicrowavedEvent : HandledEntityEventArgs
index 9c3d0239661e3d0e8a8f953510d4b7fc221d3a06..fb9ea290421ea64b09ecb46a27c8e186afc6f052 100644 (file)
@@ -31,6 +31,7 @@ using Robust.Shared.Audio.Systems;
 using Robust.Shared.Containers;
 using Robust.Shared.Player;
 using System.Linq;
+using Content.Shared.Access.Components;
 
 namespace Content.Server.Kitchen.EntitySystems
 {
@@ -260,6 +261,12 @@ namespace Content.Server.Kitchen.EntitySystems
                 return;
             }
 
+            if (ent.Comp.Storage.Count >= ent.Comp.Capacity)
+            {
+                _popupSystem.PopupEntity(Loc.GetString("microwave-component-interact-full"), ent, args.User);
+                return;
+            }
+
             args.Handled = true;
             _handsSystem.TryDropIntoContainer(args.User, args.Used, ent.Comp.Storage);
             UpdateUserInterfaceState(ent, ent.Comp);
index 74bbd553d98098c8db93d5bf6bcc0e45b46ae123..f6be847874a3eefb05ecb9c519a62d23376831c1 100644 (file)
@@ -10,6 +10,7 @@ microwave-component-suicide-others-message = {$victim} is trying to cook their h
 microwave-component-suicide-multi-head-message = You cook your heads!
 microwave-component-suicide-message = You cook your head!
 microwave-component-upgrade-cook-time = cook time
+microwave-component-interact-full = It's full.
 
 ## Bound UI
 
index 586b4b0af00f3fd58ffb54c5d7fadf7f440e6535..16e43494a672a7f7f63d21e242d371fbd318850e 100644 (file)
@@ -5,6 +5,7 @@
   description: It's magic.
   components:
   - type: Microwave
+    capacity: 10
   - type: Appearance
   - type: GenericVisualizer
     visuals: