From 2fb2cde1253f08488df14cb3c6bc6735903cc0fc Mon Sep 17 00:00:00 2001 From: Smirnov Peter <131467813+Sh18RW@users.noreply.github.com> Date: Fri, 19 Jul 2024 01:34:18 +0300 Subject: [PATCH] Add item checking for moth food (#30019) * Add ContainerContainer component checking for moth food * Use ItemSlotsComponent checking on food item --- Content.Server/Nutrition/EntitySystems/FoodSystem.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Content.Server/Nutrition/EntitySystems/FoodSystem.cs b/Content.Server/Nutrition/EntitySystems/FoodSystem.cs index fc9d228b05..d609f737e7 100644 --- a/Content.Server/Nutrition/EntitySystems/FoodSystem.cs +++ b/Content.Server/Nutrition/EntitySystems/FoodSystem.cs @@ -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(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) -- 2.51.2