Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add item checking for moth food #30019

Merged
merged 2 commits into from
Jul 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion Content.Server/Nutrition/EntitySystems/FoodSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
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;
Expand All @@ -31,6 +30,7 @@
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;

Expand Down Expand Up @@ -138,6 +138,16 @@ private void OnFeedFood(Entity<FoodComponent> entity, ref AfterInteractEvent arg
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)
Expand Down
Loading