CatStation/Content.Shared/EntityConditions/Conditions/Body/MouthUncoveredEntityConditionSystem.cs
ScarKy0 1cdf296bb6
Action Requirements (#46029)
* FAILURE

* oh it was that easy

* actually this is how its supposed to be yeah

* remove mobstate and satiation

* replacements

* cleaner

* discord remarks

* refactor: extract ActionRequirementsSystem.DoCancel method, fix typo in ActionRequirementsComponent

* review

---------

Co-authored-by: Fildrance <fildrance@gmail.com>
2026-09-16 12:08:40 +00:00

36 lines
1.3 KiB
C#

using Content.Shared.Inventory;
using Content.Shared.Nutrition.Components;
using Content.Shared.Nutrition.EntitySystems;
using Robust.Shared.Prototypes;
namespace Content.Shared.EntityConditions.Conditions.Body;
/// <summary>
/// A condition which passes if the specified entity has their mouth uncovered, generally meaning they're able to eat or drink.
/// </summary>
public sealed partial class MouthUncoveredEntityConditionSystem : EntityConditionSystem<InventoryComponent, MouthUncoveredCondition>
{
[Dependency] private IngestionSystem _ingestion = default!;
/// <inheritdoc/>
protected override void Condition(Entity<InventoryComponent> entity, ref EntityConditionEvent<MouthUncoveredCondition> args)
{
args.Result = _ingestion.HasMouthAvailable(entity, args.Condition.Slots);
}
}
/// <inheritdoc cref="EntityCondition"/>
public sealed partial class MouthUncoveredCondition : EntityConditionBase<MouthUncoveredCondition>
{
/// <summary>
/// The slots to check for <see cref="IngestionBlockerComponent"/>.
/// </summary>
[DataField]
public SlotFlags Slots = SlotFlags.HEAD | SlotFlags.MASK;
/// <inheritdoc/>
public override string EntityConditionGuidebookText(IPrototypeManager prototype)
{
return Loc.GetString("entity-condition-guidebook-mouth-uncovered-condition");
}
}