RaiseLocalEvent(target, ref ev);
//Prevents food usage with a wrong utensil
- if ((ev.Types & utensil.Comp.Types) == 0)
+ if (ev.Types != UtensilType.None && (ev.Types & utensil.Comp.Types) == 0)
{
_popup.PopupClient(Loc.GetString("ingestion-try-use-wrong-utensil", ("verb", GetEdibleVerb(target)), ("food", target), ("utensil", utensil.Owner)), user, user);
return true;
/// </summary>
/// <param name="food">Entity being eaten</param>
/// <param name="stomachs">Stomachs available to digest</param>
- public bool IsDigestibleBy(EntityUid food, List<Entity<StomachComponent, OrganComponent>> stomachs)
+ /// <param name="popup">Should we also display popup text if it exists?</param>
+ public bool IsDigestibleBy(EntityUid food, List<Entity<StomachComponent, OrganComponent>> stomachs, out bool popup)
{
+ popup = false;
var ev = new IsDigestibleEvent();
RaiseLocalEvent(food, ref ev);
}
// If we didn't find a stomach that can digest our food then it doesn't exist.
+ popup = true;
return false;
}
return;
// Can we digest the specific item we're trying to eat?
- if (!IsDigestibleBy(args.Ingested, stomachs))
+ if (!IsDigestibleBy(args.Ingested, stomachs, out var popup))
{
- if (!args.Ingest)
+ if (!args.Ingest || !popup)
return;
if (forceFed)