]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Add item checking for moth food (#30019)
authorSmirnov Peter <131467813+Sh18RW@users.noreply.github.com>
Thu, 18 Jul 2024 22:34:18 +0000 (01:34 +0300)
committerGitHub <noreply@github.com>
Thu, 18 Jul 2024 22:34:18 +0000 (01:34 +0300)
* Add ContainerContainer component checking for moth food

* Use ItemSlotsComponent checking on food item

Content.Server/Nutrition/EntitySystems/FoodSystem.cs

index fc9d228b056a69fc7d9ece445761d86641305198..d609f737e72edbaa29b8b31752dfe2c95781825c 100644 (file)
@@ -10,7 +10,6 @@ using Content.Shared.Administration.Logs;
 using Content.Shared.Body.Components;
 using Content.Shared.Body.Organ;
 using Content.Shared.Chemistry;
-using Content.Shared.Chemistry.Reagent;
 using Content.Shared.Database;
 using Content.Shared.DoAfter;
 using Content.Shared.FixedPoint;
@@ -31,6 +30,7 @@ using Robust.Shared.Audio;
 using Robust.Shared.Audio.Systems;
 using Robust.Shared.Utility;
 using System.Linq;
+using Content.Shared.Containers.ItemSlots;
 using Robust.Server.GameObjects;
 using Content.Shared.Whitelist;
 
@@ -138,6 +138,16 @@ public sealed class FoodSystem : EntitySystem
             return (false, true);
         }
 
+        // Checks for used item slots
+        if (TryComp<ItemSlotsComponent>(food, out var itemSlots))
+        {
+            if (itemSlots.Slots.Any(slot => slot.Value.HasItem))
+            {
+                _popup.PopupEntity(Loc.GetString("food-has-used-storage", ("food", food)), user, user);
+                return (false, true);
+            }
+        }
+
         var flavors = _flavorProfile.GetLocalizedFlavorsMessage(food, user, foodSolution);
 
         if (GetUsesRemaining(food, foodComp) <= 0)