Files
OldThink/Content.Server/Chemistry/ReagentEffectConditions/ReagentThreshold.cs
mirrorcult 31d622f941 Metabolism 3.0 (#5157)
* basic system + convert all plantmetabolism

* stragglers

* convert all old metabolisms over

* fix YAML errors + dumb serialization issue

* remove unused thingy

* reimplement

* add organ type condition

* organtype condition but real

* cleanups + test fix

* metabolismtype -> metabolizertype

* solution resilience

* fixes

* serializer + use entityuid + hashset

* this is apparently an entirely different thing

* turns out it just works

* oops
2021-11-08 15:33:45 -07:00

27 lines
939 B
C#

using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.FixedPoint;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization.Manager.Attributes;
namespace Content.Server.Chemistry.ReagentEffectConditions
{
/// <summary>
/// Used for implementing reagent effects that require a certain amount of reagent before it should be applied.
/// For instance, overdoses.
/// </summary>
public class ReagentThreshold : ReagentEffectCondition
{
[DataField("min")]
public FixedPoint2 Min = FixedPoint2.Zero;
[DataField("max")]
public FixedPoint2 Max = FixedPoint2.MaxValue;
public override bool Condition(EntityUid solutionEntity, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager)
{
return reagent.Quantity >= Min && reagent.Quantity < Max;
}
}
}