Add item checking for moth food (#30019)

* Add ContainerContainer component checking for moth food

* Use ItemSlotsComponent checking on food item
This commit is contained in:
Smirnov Peter
2024-07-19 01:34:18 +03:00
committed by GitHub
parent 437fc936a2
commit 2fb2cde125

View 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)