using Content.Server.Nutrition.Components;
using Content.Shared.Chemistry.Reagent;
namespace Content.Server.Chemistry.ReagentEffects
{
///
/// Attempts to find a HungerComponent on the target,
/// and to update it's hunger values.
///
public sealed class SatiateHunger : ReagentEffect
{
///
/// How much hunger is satiated when 1u of the reagent is metabolized
///
[DataField("factor")] public float NutritionFactor { get; set; } = 3.0f;
//Remove reagent at set rate, satiate hunger if a HungerComponent can be found
public override void Effect(ReagentEffectArgs args)
{
if (args.EntityManager.TryGetComponent(args.SolutionEntity, out HungerComponent? hunger))
hunger.UpdateFood(NutritionFactor * (float) args.Quantity);
}
}
}