Files
crystall-punk-14/Content.Server/Chemistry/ReagentEffects/SatiateHunger.cs
mirrorcult 8aa4f998de Metabolism refactor (#4395)
* metabolism -> respirator, add reageanteffect and reagenteffectcondition, start on metabolizercomp/system

* move LiverBehavior metabolism logic to Metabolizer

* minor tweaks and update all YAML

* how about actually taking conditions into account

* off by one

* removals

* reviews
2021-07-31 13:50:32 +02:00

29 lines
1.0 KiB
C#

using Content.Server.Nutrition.Components;
using Content.Shared.Chemistry;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.Chemistry.Solution;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization.Manager.Attributes;
namespace Content.Server.Chemistry.ReagentEffects
{
/// <summary>
/// Attempts to find a HungerComponent on the target,
/// and to update it's hunger values.
/// </summary>
public class SatiateHunger : ReagentEffect
{
/// <summary>
/// How much hunger is satiated when 1u of the reagent is metabolized
/// </summary>
[DataField("nutritionFactor")] public float NutritionFactor { get; set; } = 3.0f;
//Remove reagent at set rate, satiate hunger if a HungerComponent can be found
public override void Metabolize(IEntity solutionEntity, Solution.ReagentQuantity amount)
{
if (solutionEntity.TryGetComponent(out HungerComponent? hunger))
hunger.UpdateFood(NutritionFactor);
}
}
}