Adds metabolism effects to pretty much every chem already in the game (#5349)
* pass 1 * a little more reagent effect for breakfast * move lots of stuff around * implements all medicines * implement all cleaning & elements * implement toxins/pyrotechnic * p * linter fixies * fixes + narcotic balancing * fix and standardize * reviews * things
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
using Content.Server.Temperature.Components;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Server.Chemistry.ReagentEffectConditions
|
||||
{
|
||||
/// <summary>
|
||||
/// Requires the solution entity to be above or below a certain temperature.
|
||||
/// Used for things like cryoxadone and pyroxadone.
|
||||
/// </summary>
|
||||
public class Temperature : ReagentEffectCondition
|
||||
{
|
||||
[DataField("min")]
|
||||
public float Min = 0;
|
||||
|
||||
[DataField("max")]
|
||||
public float Max = float.MaxValue;
|
||||
public override bool Condition(ReagentEffectArgs args)
|
||||
{
|
||||
if (args.EntityManager.TryGetComponent(args.SolutionEntity, out TemperatureComponent temp))
|
||||
{
|
||||
if (temp.CurrentTemperature > Min && temp.CurrentTemperature < Max)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,9 @@ 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.
|
||||
///
|
||||
/// This can also trigger on -other- reagents, not just the one metabolizing. By default, it uses the
|
||||
/// one being metabolized.
|
||||
/// </summary>
|
||||
public class ReagentThreshold : ReagentEffectCondition
|
||||
{
|
||||
@@ -18,15 +21,21 @@ namespace Content.Server.Chemistry.ReagentEffectConditions
|
||||
[DataField("max")]
|
||||
public FixedPoint2 Max = FixedPoint2.MaxValue;
|
||||
|
||||
[DataField("reagent")]
|
||||
public string? Reagent;
|
||||
|
||||
public override bool Condition(ReagentEffectArgs args)
|
||||
{
|
||||
if (args.Source != null)
|
||||
if (Reagent == null)
|
||||
Reagent = args.Reagent.ID;
|
||||
|
||||
var quant = FixedPoint2.Zero;
|
||||
if (args.Source != null && args.Source.ContainsReagent(Reagent))
|
||||
{
|
||||
var quant = args.Source.GetReagentQuantity(args.Reagent.ID);
|
||||
return quant >= Min && quant <= Max;
|
||||
quant = args.Source.GetReagentQuantity(args.Reagent.ID);
|
||||
}
|
||||
|
||||
return false;
|
||||
return quant >= Min && quant <= Max;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Server.Chemistry.ReagentEffectConditions
|
||||
{
|
||||
public class TotalDamage : ReagentEffectCondition
|
||||
{
|
||||
[DataField("max")]
|
||||
public FixedPoint2 Max = FixedPoint2.MaxValue;
|
||||
|
||||
[DataField("min")]
|
||||
public FixedPoint2 Min = FixedPoint2.Zero;
|
||||
|
||||
public override bool Condition(ReagentEffectArgs args)
|
||||
{
|
||||
if (args.EntityManager.TryGetComponent(args.SolutionEntity, out DamageableComponent damage))
|
||||
{
|
||||
var total = damage.TotalDamage;
|
||||
if (total > Min && total < Max)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user