diff --git a/Content.Server/Body/Metabolism/MetabolizerComponent.cs b/Content.Server/Body/Metabolism/MetabolizerComponent.cs index 3064173df7..56d666cb4a 100644 --- a/Content.Server/Body/Metabolism/MetabolizerComponent.cs +++ b/Content.Server/Body/Metabolism/MetabolizerComponent.cs @@ -52,11 +52,26 @@ namespace Content.Server.Body.Metabolism [DataField("metabolizerTypes", customTypeSerializer:typeof(PrototypeIdHashSetSerializer))] public HashSet? MetabolizerTypes = null; + /// + /// Should this metabolizer remove chemicals that have no metabolisms defined? + /// As a stop-gap, basically. + /// + [DataField("removeEmpty")] + public bool RemoveEmpty = false; + + /// + /// How many reagents can this metabolizer process at once? + /// Used to nerf 'stacked poisons' where having 5+ different poisons in a syringe, even at low + /// quantity, would be muuuuch better than just one poison acting. + /// + [DataField("maxReagents")] + public int MaxReagentsProcessable = 3; + /// /// A list of metabolism groups that this metabolizer will act on, in order of precedence. /// - [DataField("groups", required: true)] - public List MetabolismGroups = default!; + [DataField("groups")] + public List? MetabolismGroups = default!; } /// diff --git a/Content.Server/Body/Metabolism/MetabolizerSystem.cs b/Content.Server/Body/Metabolism/MetabolizerSystem.cs index f5b89680dc..a767222515 100644 --- a/Content.Server/Body/Metabolism/MetabolizerSystem.cs +++ b/Content.Server/Body/Metabolism/MetabolizerSystem.cs @@ -9,10 +9,12 @@ using Content.Shared.Body.Mechanism; using Content.Shared.Chemistry.Components; using Content.Shared.Chemistry.Reagent; using Content.Shared.FixedPoint; +using Content.Shared.MobState.Components; using JetBrains.Annotations; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Prototypes; +using Robust.Shared.Random; namespace Content.Server.Body.Metabolism { @@ -22,6 +24,7 @@ namespace Content.Server.Body.Metabolism { [Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!; + [Dependency] private readonly IRobustRandom _random = default!; public override void Initialize() { @@ -102,17 +105,35 @@ namespace Content.Server.Body.Metabolism if (solutionEntityUid == null || solution == null) return; - // we found our guy - foreach (var reagent in solution.Contents.ToArray()) + + // randomize the reagent list so we don't have any weird quirks + // like alphabetical order or insertion order mattering for processing + var list = solution.Contents.ToArray(); + _random.Shuffle(list); + + int reagents = 0; + foreach (var reagent in list) { if (!_prototypeManager.TryIndex(reagent.ReagentId, out var proto)) continue; + FixedPoint2 mostToRemove = FixedPoint2.Zero; if (proto.Metabolisms == null) + { + if (meta.RemoveEmpty) + _solutionContainerSystem.TryRemoveReagent(solutionEntityUid.Value, solution, reagent.ReagentId, FixedPoint2.New(1)); continue; + } + + // we're done here entirely if this is true + if (reagents >= meta.MaxReagentsProcessable) + return; + reagents += 1; // loop over all our groups and see which ones apply - FixedPoint2 mostToRemove = FixedPoint2.Zero; + if (meta.MetabolismGroups == null) + continue; + foreach (var group in meta.MetabolismGroups) { if (!proto.Metabolisms.Keys.Contains(group.Id)) @@ -124,16 +145,27 @@ namespace Content.Server.Body.Metabolism if (entry.MetabolismRate > mostToRemove) mostToRemove = entry.MetabolismRate; + // if it's possible for them to be dead, and they are, + // then we shouldn't process any effects, but should probably + // still remove reagents + if (EntityManager.TryGetComponent(solutionEntityUid.Value, out var state)) + { + if (state.IsDead()) + continue; + } + + var args = new ReagentEffectArgs(solutionEntityUid.Value, meta.OwnerUid, solution, proto, entry.MetabolismRate, + EntityManager, null); + // do all effects, if conditions apply foreach (var effect in entry.Effects) { bool failed = false; - var quant = new Solution.ReagentQuantity(reagent.ReagentId, reagent.Quantity); if (effect.Conditions != null) { foreach (var cond in effect.Conditions) { - if (!cond.Condition(solutionEntityUid.Value, meta.OwnerUid, quant, EntityManager)) + if (!cond.Condition(args)) failed = true; } @@ -141,7 +173,7 @@ namespace Content.Server.Body.Metabolism continue; } - effect.Metabolize(solutionEntityUid.Value, meta.OwnerUid, quant, EntityManager); + effect.Metabolize(args); } } diff --git a/Content.Server/Botany/Components/PlantHolderComponent.cs b/Content.Server/Botany/Components/PlantHolderComponent.cs index 03c7d760da..a5a85362a1 100644 --- a/Content.Server/Botany/Components/PlantHolderComponent.cs +++ b/Content.Server/Botany/Components/PlantHolderComponent.cs @@ -566,7 +566,7 @@ namespace Content.Server.Botany.Components foreach (var reagent in solutionSystem.RemoveEachReagent(OwnerUid, solution, amt)) { var reagentProto = _prototypeManager.Index(reagent); - reagentProto.ReactionPlant(OwnerUid, new Solution.ReagentQuantity(reagent, amt)); + reagentProto.ReactionPlant(OwnerUid, new Solution.ReagentQuantity(reagent, amt), solution); } } diff --git a/Content.Server/Chemistry/ReagentEffectConditions/OrganType.cs b/Content.Server/Chemistry/ReagentEffectConditions/OrganType.cs index cff9bc780f..ea327ab490 100644 --- a/Content.Server/Chemistry/ReagentEffectConditions/OrganType.cs +++ b/Content.Server/Chemistry/ReagentEffectConditions/OrganType.cs @@ -22,9 +22,12 @@ namespace Content.Server.Chemistry.ReagentEffectConditions [DataField("shouldHave")] public bool ShouldHave = true; - public override bool Condition(EntityUid solutionEntity, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager) + public override bool Condition(ReagentEffectArgs args) { - if (entityManager.TryGetComponent(organEntity, out var metabolizer) + if (args.OrganEntity == null) + return false; + + if (args.EntityManager.TryGetComponent(args.OrganEntity.Value, out var metabolizer) && metabolizer.MetabolizerTypes != null && metabolizer.MetabolizerTypes.Contains(Type)) return ShouldHave; diff --git a/Content.Server/Chemistry/ReagentEffectConditions/ReagentThreshold.cs b/Content.Server/Chemistry/ReagentEffectConditions/ReagentThreshold.cs index 38e682864e..d6a586eb84 100644 --- a/Content.Server/Chemistry/ReagentEffectConditions/ReagentThreshold.cs +++ b/Content.Server/Chemistry/ReagentEffectConditions/ReagentThreshold.cs @@ -18,9 +18,15 @@ namespace Content.Server.Chemistry.ReagentEffectConditions [DataField("max")] public FixedPoint2 Max = FixedPoint2.MaxValue; - public override bool Condition(EntityUid solutionEntity, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager) + public override bool Condition(ReagentEffectArgs args) { - return reagent.Quantity >= Min && reagent.Quantity < Max; + if (args.Source != null) + { + var quant = args.Source.GetReagentQuantity(args.Reagent.ID); + return quant >= Min && quant <= Max; + } + + return false; } } } diff --git a/Content.Server/Chemistry/ReagentEffects/AddToSolutionReaction.cs b/Content.Server/Chemistry/ReagentEffects/AddToSolutionReaction.cs new file mode 100644 index 0000000000..11036849fa --- /dev/null +++ b/Content.Server/Chemistry/ReagentEffects/AddToSolutionReaction.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; +using Content.Server.Chemistry.EntitySystems; +using Content.Shared.Chemistry.Components; +using Content.Shared.Chemistry.Reagent; +using Content.Shared.FixedPoint; +using JetBrains.Annotations; +using Robust.Shared.GameObjects; +using Robust.Shared.Serialization.Manager.Attributes; +using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set; + +namespace Content.Server.Chemistry.ReagentEffects +{ + [UsedImplicitly] + public class AddToSolutionReaction : ReagentEffect + { + [DataField("solution")] + private string _solution = "reagents"; + + public override void Metabolize(ReagentEffectArgs args) + { + // TODO see if this is correct + if (!EntitySystem.Get() + .TryGetSolution(args.SolutionEntity, _solution, out var solutionContainer)) + return; + + if (EntitySystem.Get() + .TryAddReagent(args.SolutionEntity, solutionContainer, args.Reagent.ID, args.Metabolizing, out var accepted)) + args.Source?.RemoveReagent(args.Reagent.ID, accepted); + } + } +} diff --git a/Content.Server/Chemistry/ReagentEffects/ExtinguishReaction.cs b/Content.Server/Chemistry/ReagentEffects/ExtinguishReaction.cs new file mode 100644 index 0000000000..be34222439 --- /dev/null +++ b/Content.Server/Chemistry/ReagentEffects/ExtinguishReaction.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic; +using Content.Server.Atmos.Components; +using Content.Server.Atmos.EntitySystems; +using Content.Shared.Chemistry.Components; +using Content.Shared.Chemistry.Reagent; +using Content.Shared.FixedPoint; +using JetBrains.Annotations; +using Robust.Shared.GameObjects; +using Robust.Shared.Serialization.Manager.Attributes; +using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set; + +namespace Content.Server.Chemistry.ReagentEffects +{ + [UsedImplicitly] + public class ExtinguishReaction : ReagentEffect + { + public override void Metabolize(ReagentEffectArgs args) + { + if (!args.EntityManager.TryGetComponent(args.SolutionEntity, out FlammableComponent? flammable)) return; + + var flammableSystem = EntitySystem.Get(); + flammableSystem.Extinguish(args.SolutionEntity, flammable); + flammableSystem.AdjustFireStacks(args.SolutionEntity, -1.5f * (float) args.Metabolizing, flammable); + } + } +} diff --git a/Content.Server/Chemistry/ReagentEffects/FlammableReaction.cs b/Content.Server/Chemistry/ReagentEffects/FlammableReaction.cs new file mode 100644 index 0000000000..9c2471f2a0 --- /dev/null +++ b/Content.Server/Chemistry/ReagentEffects/FlammableReaction.cs @@ -0,0 +1,25 @@ +using System.Collections.Generic; +using Content.Server.Atmos.Components; +using Content.Server.Atmos.EntitySystems; +using Content.Shared.Chemistry.Components; +using Content.Shared.Chemistry.Reagent; +using Content.Shared.FixedPoint; +using JetBrains.Annotations; +using Robust.Shared.GameObjects; +using Robust.Shared.Serialization.Manager.Attributes; +using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set; + +namespace Content.Server.Chemistry.ReagentEffects +{ + [UsedImplicitly] + public class FlammableReaction : ReagentEffect + { + public override void Metabolize(ReagentEffectArgs args) + { + if (!args.EntityManager.TryGetComponent(args.SolutionEntity, out FlammableComponent? flammable)) return; + + EntitySystem.Get().AdjustFireStacks(args.SolutionEntity, args.Metabolizing.Float() / 5f, flammable); + args.Source?.RemoveReagent(args.Reagent.ID, args.Metabolizing); + } + } +} diff --git a/Content.Server/Chemistry/ReagentEffects/HealthChange.cs b/Content.Server/Chemistry/ReagentEffects/HealthChange.cs index 4bcf996caf..0536ed39c2 100644 --- a/Content.Server/Chemistry/ReagentEffects/HealthChange.cs +++ b/Content.Server/Chemistry/ReagentEffects/HealthChange.cs @@ -19,9 +19,9 @@ namespace Content.Server.Chemistry.ReagentEffects [DataField("damage", required: true)] public DamageSpecifier Damage = default!; - public override void Metabolize(EntityUid solutionEntity, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager) + public override void Metabolize(ReagentEffectArgs args) { - EntitySystem.Get().TryChangeDamage(solutionEntity, Damage, true); + EntitySystem.Get().TryChangeDamage(args.SolutionEntity, Damage * args.Metabolizing, true); } } } diff --git a/Content.Server/Chemistry/ReagentEffects/MovespeedModifier.cs b/Content.Server/Chemistry/ReagentEffects/MovespeedModifier.cs index 8af80cf40e..a230c8ab91 100644 --- a/Content.Server/Chemistry/ReagentEffects/MovespeedModifier.cs +++ b/Content.Server/Chemistry/ReagentEffects/MovespeedModifier.cs @@ -37,9 +37,9 @@ namespace Content.Server.Chemistry.ReagentEffects /// /// Remove reagent at set rate, changes the movespeed modifiers and adds a MovespeedModifierMetabolismComponent if not already there. /// - public override void Metabolize(EntityUid solutionEntity, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager) + public override void Metabolize(ReagentEffectArgs args) { - var status = entityManager.EnsureComponent(solutionEntity); + var status = args.EntityManager.EnsureComponent(args.SolutionEntity); // Only refresh movement if we need to. var modified = !status.WalkSpeedModifier.Equals(WalkSpeedModifier) || @@ -48,10 +48,10 @@ namespace Content.Server.Chemistry.ReagentEffects status.WalkSpeedModifier = WalkSpeedModifier; status.SprintSpeedModifier = SprintSpeedModifier; - IncreaseTimer(status, StatusLifetime * reagent.Quantity.Float()); + IncreaseTimer(status, StatusLifetime * args.Metabolizing.Float()); if (modified) - EntitySystem.Get().RefreshMovementSpeedModifiers(solutionEntity); + EntitySystem.Get().RefreshMovementSpeedModifiers(args.SolutionEntity); } public void IncreaseTimer(MovespeedModifierMetabolismComponent status, float time) diff --git a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustHealth.cs b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustHealth.cs index b79e91cecb..3a8174203c 100644 --- a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustHealth.cs +++ b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustHealth.cs @@ -1,4 +1,5 @@ using Content.Shared.Chemistry.Components; +using Content.Shared.Chemistry.Reagent; using JetBrains.Annotations; using Robust.Shared.GameObjects; @@ -6,9 +7,9 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism { public class PlantAdjustHealth : PlantAdjustAttribute { - public override void Metabolize(EntityUid plantHolder, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager) + public override void Metabolize(ReagentEffectArgs args) { - if (!CanMetabolize(plantHolder, out var plantHolderComp, entityManager)) + if (!CanMetabolize(args.SolutionEntity, out var plantHolderComp, args.EntityManager)) return; plantHolderComp.Health += Amount; diff --git a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustMutationLevel.cs b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustMutationLevel.cs index 7cb2d6b8ff..98d8ae011a 100644 --- a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustMutationLevel.cs +++ b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustMutationLevel.cs @@ -1,4 +1,5 @@ using Content.Shared.Chemistry.Components; +using Content.Shared.Chemistry.Reagent; using JetBrains.Annotations; using Robust.Shared.GameObjects; @@ -6,9 +7,9 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism { public class PlantAdjustMutationLevel : PlantAdjustAttribute { - public override void Metabolize(EntityUid plantHolder, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager) + public override void Metabolize(ReagentEffectArgs args) { - if (!CanMetabolize(plantHolder, out var plantHolderComp, entityManager)) + if (!CanMetabolize(args.SolutionEntity, out var plantHolderComp, args.EntityManager)) return; plantHolderComp.MutationLevel += Amount * plantHolderComp.MutationMod; diff --git a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustMutationMod.cs b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustMutationMod.cs index b205dbe6ca..85d538e828 100644 --- a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustMutationMod.cs +++ b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustMutationMod.cs @@ -1,4 +1,5 @@ using Content.Shared.Chemistry.Components; +using Content.Shared.Chemistry.Reagent; using JetBrains.Annotations; using Robust.Shared.GameObjects; @@ -7,9 +8,9 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism [UsedImplicitly] public class PlantAdjustMutationMod : PlantAdjustAttribute { - public override void Metabolize(EntityUid plantHolder, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager) + public override void Metabolize(ReagentEffectArgs args) { - if (!CanMetabolize(plantHolder, out var plantHolderComp, entityManager)) + if (!CanMetabolize(args.SolutionEntity, out var plantHolderComp, args.EntityManager)) return; plantHolderComp.MutationMod += Amount; diff --git a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustNutrition.cs b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustNutrition.cs index 3fb8a37e1f..e9d628ae5b 100644 --- a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustNutrition.cs +++ b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustNutrition.cs @@ -1,4 +1,5 @@ using Content.Shared.Chemistry.Components; +using Content.Shared.Chemistry.Reagent; using JetBrains.Annotations; using Robust.Shared.GameObjects; @@ -7,9 +8,9 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism [UsedImplicitly] public class PlantAdjustNutrition : PlantAdjustAttribute { - public override void Metabolize(EntityUid plantHolder, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager) + public override void Metabolize(ReagentEffectArgs args) { - if (!CanMetabolize(plantHolder, out var plantHolderComp, entityManager)) + if (!CanMetabolize(args.SolutionEntity, out var plantHolderComp, args.EntityManager)) return; plantHolderComp.AdjustNutrient(Amount); diff --git a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustPests.cs b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustPests.cs index a7e3137c4b..53148214a7 100644 --- a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustPests.cs +++ b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustPests.cs @@ -1,4 +1,5 @@ using Content.Shared.Chemistry.Components; +using Content.Shared.Chemistry.Reagent; using JetBrains.Annotations; using Robust.Shared.GameObjects; @@ -7,9 +8,9 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism [UsedImplicitly] public class PlantAdjustPests : PlantAdjustAttribute { - public override void Metabolize(EntityUid plantHolder, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager) + public override void Metabolize(ReagentEffectArgs args) { - if (!CanMetabolize(plantHolder, out var plantHolderComp, entityManager)) + if (!CanMetabolize(args.SolutionEntity, out var plantHolderComp, args.EntityManager)) return; plantHolderComp.PestLevel += Amount; diff --git a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustToxins.cs b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustToxins.cs index e838a312b7..4e46fcb433 100644 --- a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustToxins.cs +++ b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustToxins.cs @@ -1,4 +1,5 @@ using Content.Shared.Chemistry.Components; +using Content.Shared.Chemistry.Reagent; using JetBrains.Annotations; using Robust.Shared.GameObjects; @@ -7,9 +8,9 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism [UsedImplicitly] public class PlantAdjustToxins : PlantAdjustAttribute { - public override void Metabolize(EntityUid plantHolder, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager) + public override void Metabolize(ReagentEffectArgs args) { - if (!CanMetabolize(plantHolder, out var plantHolderComp, entityManager)) + if (!CanMetabolize(args.SolutionEntity, out var plantHolderComp, args.EntityManager)) return; plantHolderComp.Toxins += Amount; diff --git a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustWater.cs b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustWater.cs index f290546d45..1bd5f34784 100644 --- a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustWater.cs +++ b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustWater.cs @@ -1,4 +1,5 @@ using Content.Shared.Chemistry.Components; +using Content.Shared.Chemistry.Reagent; using JetBrains.Annotations; using Robust.Shared.GameObjects; @@ -7,9 +8,9 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism [UsedImplicitly] public class PlantAdjustWater : PlantAdjustAttribute { - public override void Metabolize(EntityUid plantHolder, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager) + public override void Metabolize(ReagentEffectArgs args) { - if (!CanMetabolize(plantHolder, out var plantHolderComp, entityManager)) + if (!CanMetabolize(args.SolutionEntity, out var plantHolderComp, args.EntityManager)) return; plantHolderComp.AdjustWater(Amount); diff --git a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustWeeds.cs b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustWeeds.cs index 279060e0f7..fb561121f8 100644 --- a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustWeeds.cs +++ b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustWeeds.cs @@ -1,4 +1,5 @@ using Content.Shared.Chemistry.Components; +using Content.Shared.Chemistry.Reagent; using JetBrains.Annotations; using Robust.Shared.GameObjects; @@ -7,9 +8,9 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism [UsedImplicitly] public class PlantAdjustWeeds : PlantAdjustAttribute { - public override void Metabolize(EntityUid plantHolder, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager) + public override void Metabolize(ReagentEffectArgs args) { - if (!CanMetabolize(plantHolder, out var plantHolderComp, entityManager)) + if (!CanMetabolize(args.SolutionEntity, out var plantHolderComp, args.EntityManager)) return; plantHolderComp.WeedLevel += Amount; diff --git a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAffectGrowth.cs b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAffectGrowth.cs index 347c0bf929..5c26ab63ee 100644 --- a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAffectGrowth.cs +++ b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAffectGrowth.cs @@ -1,4 +1,5 @@ using Content.Shared.Chemistry.Components; +using Content.Shared.Chemistry.Reagent; using JetBrains.Annotations; using Robust.Shared.GameObjects; @@ -7,9 +8,9 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism [UsedImplicitly] public class PlantAffectGrowth : PlantAdjustAttribute { - public override void Metabolize(EntityUid plantHolder, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager) + public override void Metabolize(ReagentEffectArgs args) { - if (!CanMetabolize(plantHolder, out var plantHolderComp, entityManager)) + if (!CanMetabolize(args.SolutionEntity, out var plantHolderComp, args.EntityManager)) return; plantHolderComp.AffectGrowth((int) Amount); diff --git a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantClonexadone.cs b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantClonexadone.cs index 616b77ab69..43172d656f 100644 --- a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantClonexadone.cs +++ b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantClonexadone.cs @@ -15,9 +15,9 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism [DataDefinition] public class PlantClonexadone : ReagentEffect { - public override void Metabolize(EntityUid plantHolder, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager) + public override void Metabolize(ReagentEffectArgs args) { - if (!entityManager.TryGetComponent(plantHolder, out PlantHolderComponent? plantHolderComp) + if (!args.EntityManager.TryGetComponent(args.SolutionEntity, out PlantHolderComponent? plantHolderComp) || plantHolderComp.Seed == null || plantHolderComp.Dead) return; diff --git a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantDiethylamine.cs b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantDiethylamine.cs index 4e4d2ad462..f8e771cd9f 100644 --- a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantDiethylamine.cs +++ b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantDiethylamine.cs @@ -15,9 +15,9 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism [DataDefinition] public class PlantDiethylamine : ReagentEffect { - public override void Metabolize(EntityUid plantHolder, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager) + public override void Metabolize(ReagentEffectArgs args) { - if (!entityManager.TryGetComponent(plantHolder, out PlantHolderComponent? plantHolderComp) + if (!args.EntityManager.TryGetComponent(args.SolutionEntity, out PlantHolderComponent? plantHolderComp) || plantHolderComp.Seed == null || plantHolderComp.Dead || plantHolderComp.Seed.Immutable) return; diff --git a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/RobustHarvest.cs b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/RobustHarvest.cs index 49ee3c2b97..ef4b777b47 100644 --- a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/RobustHarvest.cs +++ b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/RobustHarvest.cs @@ -15,9 +15,9 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism [DataDefinition] public class RobustHarvest : ReagentEffect { - public override void Metabolize(EntityUid plantHolder, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager) + public override void Metabolize(ReagentEffectArgs args) { - if (!entityManager.TryGetComponent(plantHolder, out PlantHolderComponent? plantHolderComp) + if (!args.EntityManager.TryGetComponent(args.SolutionEntity, out PlantHolderComponent? plantHolderComp) || plantHolderComp.Seed == null || plantHolderComp.Dead || plantHolderComp.Seed.Immutable) return; diff --git a/Content.Server/Chemistry/ReagentEffects/SatiateHunger.cs b/Content.Server/Chemistry/ReagentEffects/SatiateHunger.cs index f63e7181d4..e1a219f707 100644 --- a/Content.Server/Chemistry/ReagentEffects/SatiateHunger.cs +++ b/Content.Server/Chemistry/ReagentEffects/SatiateHunger.cs @@ -18,10 +18,10 @@ namespace Content.Server.Chemistry.ReagentEffects [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 Metabolize(EntityUid solutionEntity, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager) + public override void Metabolize(ReagentEffectArgs args) { - if (entityManager.TryGetComponent(solutionEntity, out HungerComponent? hunger)) - hunger.UpdateFood(NutritionFactor); + if (args.EntityManager.TryGetComponent(args.SolutionEntity, out HungerComponent? hunger)) + hunger.UpdateFood(NutritionFactor * (float) args.Metabolizing); } } } diff --git a/Content.Server/Chemistry/ReagentEffects/SatiateThirst.cs b/Content.Server/Chemistry/ReagentEffects/SatiateThirst.cs index 28e8c728ab..a53e8325da 100644 --- a/Content.Server/Chemistry/ReagentEffects/SatiateThirst.cs +++ b/Content.Server/Chemistry/ReagentEffects/SatiateThirst.cs @@ -18,10 +18,10 @@ namespace Content.Server.Chemistry.ReagentEffects public float HydrationFactor { get; set; } = 3.0f; /// Satiate thirst if a ThirstComponent can be found - public override void Metabolize(EntityUid solutionEntity, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager) + public override void Metabolize(ReagentEffectArgs args) { - if (entityManager.TryGetComponent(solutionEntity, out ThirstComponent? thirst)) - thirst.UpdateThirst(HydrationFactor); + if (args.EntityManager.TryGetComponent(args.SolutionEntity, out ThirstComponent? thirst)) + thirst.UpdateThirst(HydrationFactor * (float) args.Metabolizing); } } } diff --git a/Content.Server/Chemistry/ReagentEffects/WashCreamPieReaction.cs b/Content.Server/Chemistry/ReagentEffects/WashCreamPieReaction.cs new file mode 100644 index 0000000000..0b8481422a --- /dev/null +++ b/Content.Server/Chemistry/ReagentEffects/WashCreamPieReaction.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; +using Content.Server.Nutrition.EntitySystems; +using Content.Shared.Chemistry.Components; +using Content.Shared.Chemistry.Reagent; +using Content.Shared.FixedPoint; +using Content.Shared.Nutrition.Components; +using JetBrains.Annotations; +using Robust.Shared.GameObjects; +using Robust.Shared.Serialization.Manager.Attributes; +using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set; + +namespace Content.Server.Chemistry.ReagentEffects +{ + [UsedImplicitly] + public class WashCreamPieReaction : ReagentEffect + { + public override void Metabolize(ReagentEffectArgs args) + { + if (!args.EntityManager.TryGetComponent(args.SolutionEntity, out CreamPiedComponent? creamPied)) return; + + EntitySystem.Get().SetCreamPied(args.SolutionEntity, creamPied, false); + } + } +} diff --git a/Content.Server/Chemistry/ReagentEntityReactions/AddToSolutionReaction.cs b/Content.Server/Chemistry/ReagentEntityReactions/AddToSolutionReaction.cs deleted file mode 100644 index ad48f5a26c..0000000000 --- a/Content.Server/Chemistry/ReagentEntityReactions/AddToSolutionReaction.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Collections.Generic; -using Content.Server.Chemistry.EntitySystems; -using Content.Shared.Chemistry.Components; -using Content.Shared.Chemistry.Reagent; -using Content.Shared.FixedPoint; -using JetBrains.Annotations; -using Robust.Shared.GameObjects; -using Robust.Shared.Serialization.Manager.Attributes; -using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set; - -namespace Content.Server.Chemistry.ReagentEntityReactions -{ - [UsedImplicitly] - public class AddToSolutionReaction : ReagentEntityReaction - { - [DataField("solution")] - private string _solution = "reagents"; - - [DataField("reagents", true, customTypeSerializer: typeof(PrototypeIdHashSetSerializer))] - // ReSharper disable once CollectionNeverUpdated.Local - private readonly HashSet _reagents = new(); - - protected override void React(EntityUid uid, ReagentPrototype reagent, FixedPoint2 volume, Solution? source, IEntityManager entityManager) - { - // TODO see if this is correct - if (!EntitySystem.Get() - .TryGetSolution(uid, _solution, out var solutionContainer) - || (_reagents.Count > 0 && !_reagents.Contains(reagent.ID))) return; - - if (EntitySystem.Get() - .TryAddReagent(uid, solutionContainer, reagent.ID, volume, out var accepted)) - source?.RemoveReagent(reagent.ID, accepted); - } - } -} diff --git a/Content.Server/Chemistry/ReagentEntityReactions/ExtinguishReaction.cs b/Content.Server/Chemistry/ReagentEntityReactions/ExtinguishReaction.cs deleted file mode 100644 index 00c5fa455c..0000000000 --- a/Content.Server/Chemistry/ReagentEntityReactions/ExtinguishReaction.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Collections.Generic; -using Content.Server.Atmos.Components; -using Content.Server.Atmos.EntitySystems; -using Content.Shared.Chemistry.Components; -using Content.Shared.Chemistry.Reagent; -using Content.Shared.FixedPoint; -using JetBrains.Annotations; -using Robust.Shared.GameObjects; -using Robust.Shared.Serialization.Manager.Attributes; -using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set; - -namespace Content.Server.Chemistry.ReagentEntityReactions -{ - [UsedImplicitly] - public class ExtinguishReaction : ReagentEntityReaction - { - [DataField("reagents", true, customTypeSerializer:typeof(PrototypeIdHashSetSerializer))] - // ReSharper disable once CollectionNeverUpdated.Local - private readonly HashSet _reagents = new (); - - protected override void React(EntityUid uid, ReagentPrototype reagent, FixedPoint2 volume, Solution? source, IEntityManager entityManager) - { - if (!entityManager.TryGetComponent(uid, out FlammableComponent? flammable) || !_reagents.Contains(reagent.ID)) return; - - var flammableSystem = EntitySystem.Get(); - flammableSystem.Extinguish(uid, flammable); - flammableSystem.AdjustFireStacks(uid, -1.5f, flammable); - } - } -} diff --git a/Content.Server/Chemistry/ReagentEntityReactions/FlammableReaction.cs b/Content.Server/Chemistry/ReagentEntityReactions/FlammableReaction.cs deleted file mode 100644 index 2ec8aea1e1..0000000000 --- a/Content.Server/Chemistry/ReagentEntityReactions/FlammableReaction.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.Collections.Generic; -using Content.Server.Atmos.Components; -using Content.Server.Atmos.EntitySystems; -using Content.Shared.Chemistry.Components; -using Content.Shared.Chemistry.Reagent; -using Content.Shared.FixedPoint; -using JetBrains.Annotations; -using Robust.Shared.GameObjects; -using Robust.Shared.Serialization.Manager.Attributes; -using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set; - -namespace Content.Server.Chemistry.ReagentEntityReactions -{ - [UsedImplicitly] - public class FlammableReaction : ReagentEntityReaction - { - [DataField("reagents", true, customTypeSerializer:typeof(PrototypeIdHashSetSerializer))] - // ReSharper disable once CollectionNeverUpdated.Local - private readonly HashSet _reagents = new (); - - protected override void React(EntityUid uid, ReagentPrototype reagent, FixedPoint2 volume, Solution? source, IEntityManager entityManager) - { - if (!entityManager.TryGetComponent(uid, out FlammableComponent? flammable) || !_reagents.Contains(reagent.ID)) return; - - EntitySystem.Get().AdjustFireStacks(uid, volume.Float() / 10f, flammable); - source?.RemoveReagent(reagent.ID, volume); - } - } -} diff --git a/Content.Server/Chemistry/ReagentEntityReactions/WashCreamPieReaction.cs b/Content.Server/Chemistry/ReagentEntityReactions/WashCreamPieReaction.cs deleted file mode 100644 index 1c6420e492..0000000000 --- a/Content.Server/Chemistry/ReagentEntityReactions/WashCreamPieReaction.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System.Collections.Generic; -using Content.Server.Nutrition.EntitySystems; -using Content.Shared.Chemistry.Components; -using Content.Shared.Chemistry.Reagent; -using Content.Shared.FixedPoint; -using Content.Shared.Nutrition.Components; -using JetBrains.Annotations; -using Robust.Shared.GameObjects; -using Robust.Shared.Serialization.Manager.Attributes; -using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set; - -namespace Content.Server.Chemistry.ReagentEntityReactions -{ - [UsedImplicitly] - public class WashCreamPieReaction : ReagentEntityReaction - { - [DataField("reagents", true, customTypeSerializer:typeof(PrototypeIdHashSetSerializer))] - // ReSharper disable once CollectionNeverUpdated.Local - private readonly HashSet _reagents = new (); - - protected override void React(EntityUid uid, ReagentPrototype reagent, FixedPoint2 volume, Solution? source, IEntityManager entityManager) - { - if (!entityManager.TryGetComponent(uid, out CreamPiedComponent? creamPied) || !_reagents.Contains(reagent.ID)) return; - - EntitySystem.Get().SetCreamPied(uid, creamPied, false); - } - } -} diff --git a/Content.Shared/Chemistry/ChemistrySystem.cs b/Content.Shared/Chemistry/ChemistrySystem.cs index 6036bafdcb..35eff04b4e 100644 --- a/Content.Shared/Chemistry/ChemistrySystem.cs +++ b/Content.Shared/Chemistry/ChemistrySystem.cs @@ -34,14 +34,36 @@ namespace Content.Shared.Chemistry if (!EntityManager.TryGetComponent(uid, out ReactiveComponent? reactive)) return; - foreach (var reaction in reactive.Reactions) - { - // If we have a source solution, use the reagent quantity we have left. Otherwise, use the reaction volume specified. - reaction.React(method, uid, reagent, source?.GetReagentQuantity(reagent.ID) ?? reactVolume, source, EntityManager); + // If we have a source solution, use the reagent quantity we have left. Otherwise, use the reaction volume specified. + var args = new ReagentEffectArgs(uid, null, source, reagent, + source?.GetReagentQuantity(reagent.ID) ?? reactVolume, EntityManager, method); - // Make sure we still have enough reagent to go... - if (source != null && !source.ContainsReagent(reagent.ID)) - break; + foreach (var entry in reactive.Reactions) + { + if (!entry.Methods.Contains(method)) + continue; + + if (entry.Reagents != null && !entry.Reagents.Contains(reagent.ID)) + continue; + + foreach (var effect in entry.Effects) + { + bool failed = false; + foreach (var cond in effect.Conditions ?? new ReagentEffectCondition[] { }) + { + if (!cond.Condition(args)) + failed = true; + } + + if (failed) + continue; + + effect.Metabolize(args); + + // Make sure we still have enough reagent to go... + if (source != null && !source.ContainsReagent(reagent.ID)) + break; + } } } } diff --git a/Content.Shared/Chemistry/Reaction/ReactiveComponent.cs b/Content.Shared/Chemistry/Reaction/ReactiveComponent.cs index c5c4830eb0..4d08016256 100644 --- a/Content.Shared/Chemistry/Reaction/ReactiveComponent.cs +++ b/Content.Shared/Chemistry/Reaction/ReactiveComponent.cs @@ -1,7 +1,9 @@ using System; +using System.Collections.Generic; using Content.Shared.Chemistry.Reagent; using Robust.Shared.GameObjects; using Robust.Shared.Serialization.Manager.Attributes; +using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set; namespace Content.Shared.Chemistry.Reaction { @@ -10,7 +12,20 @@ namespace Content.Shared.Chemistry.Reaction { public override string Name => "Reactive"; - [DataField("reactions", true, serverOnly:true)] - public ReagentEntityReaction[] Reactions { get; } = Array.Empty(); + [DataField("reactions", required: true, readOnly: true, serverOnly: true)] + public List Reactions { get; } = default!; + } + + [DataDefinition] + public class ReactiveReagentEffectEntry + { + [DataField("methods")] + public HashSet Methods = default!; + + [DataField("reagents", customTypeSerializer: typeof(PrototypeIdHashSetSerializer))] + public HashSet? Reagents = null; + + [DataField("effects", required: true)] + public List Effects = default!; } } diff --git a/Content.Shared/Chemistry/Reagent/ReagentEffect.cs b/Content.Shared/Chemistry/Reagent/ReagentEffect.cs index 740e25f515..a6d97e232d 100644 --- a/Content.Shared/Chemistry/Reagent/ReagentEffect.cs +++ b/Content.Shared/Chemistry/Reagent/ReagentEffect.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using Content.Shared.Chemistry.Components; using Content.Shared.Chemistry.Reagent; +using Content.Shared.FixedPoint; using JetBrains.Annotations; using Robust.Shared.GameObjects; using Robust.Shared.Serialization.Manager.Attributes; @@ -21,6 +22,23 @@ namespace Content.Shared.Chemistry.Reagent [DataField("conditions")] public ReagentEffectCondition[]? Conditions; - public abstract void Metabolize(EntityUid solutionEntity, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager); + public abstract void Metabolize(ReagentEffectArgs args); } + + public enum ReactionMethod + { + Touch, + Injection, + Ingestion, + } + + public readonly record struct ReagentEffectArgs( + EntityUid SolutionEntity, + EntityUid? OrganEntity, + Solution? Source, + ReagentPrototype Reagent, + FixedPoint2 Metabolizing, + IEntityManager EntityManager, + ReactionMethod? Method + ); } diff --git a/Content.Shared/Chemistry/Reagent/ReagentEffectCondition.cs b/Content.Shared/Chemistry/Reagent/ReagentEffectCondition.cs index 3f10041bd7..40df2383b7 100644 --- a/Content.Shared/Chemistry/Reagent/ReagentEffectCondition.cs +++ b/Content.Shared/Chemistry/Reagent/ReagentEffectCondition.cs @@ -9,6 +9,6 @@ namespace Content.Shared.Chemistry.Reagent [MeansImplicitUse] public abstract class ReagentEffectCondition { - public abstract bool Condition(EntityUid solutionEntity, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager); + public abstract bool Condition(ReagentEffectArgs args); } } diff --git a/Content.Shared/Chemistry/Reagent/ReagentEntityReaction.cs b/Content.Shared/Chemistry/Reagent/ReagentEntityReaction.cs deleted file mode 100644 index 6f2587ce99..0000000000 --- a/Content.Shared/Chemistry/Reagent/ReagentEntityReaction.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System; -using Content.Shared.FixedPoint; -using Robust.Shared.GameObjects; -using Robust.Shared.Serialization.Manager.Attributes; -using Robust.Shared.ViewVariables; - -namespace Content.Shared.Chemistry.Reagent -{ - public enum ReactionMethod - { - Touch, - Injection, - Ingestion, - } - - [ImplicitDataDefinitionForInheritors] - public abstract class ReagentEntityReaction - { - [ViewVariables] - [DataField("touch")] - public bool Touch { get; } = false; - - [ViewVariables] - [DataField("injection")] - public bool Injection { get; } = false; - - [ViewVariables] - [DataField("ingestion")] - public bool Ingestion { get; } = false; - - public void React(ReactionMethod method, EntityUid uid, ReagentPrototype reagent, FixedPoint2 volume, Components.Solution? source, IEntityManager entityManager) - { - switch (method) - { - case ReactionMethod.Touch: - if (!Touch) - return; - break; - case ReactionMethod.Injection: - if(!Injection) - return; - break; - case ReactionMethod.Ingestion: - if(!Ingestion) - return; - break; - default: - throw new ArgumentOutOfRangeException(nameof(method), method, null); - } - - React(uid, reagent, volume, source, entityManager); - } - - protected abstract void React(EntityUid uid, ReagentPrototype reagent, FixedPoint2 volume, Components.Solution? source, IEntityManager entityManager); - } -} diff --git a/Content.Shared/Chemistry/Reagent/ReagentPrototype.cs b/Content.Shared/Chemistry/Reagent/ReagentPrototype.cs index 833b5de07f..95d9f0cc5e 100644 --- a/Content.Shared/Chemistry/Reagent/ReagentPrototype.cs +++ b/Content.Shared/Chemistry/Reagent/ReagentPrototype.cs @@ -106,7 +106,7 @@ namespace Content.Shared.Chemistry.Reagent return removed; } - public void ReactionPlant(EntityUid? plantHolder, Solution.ReagentQuantity amount) + public void ReactionPlant(EntityUid? plantHolder, Solution.ReagentQuantity amount, Solution solution) { if (plantHolder == null) return; @@ -114,7 +114,9 @@ namespace Content.Shared.Chemistry.Reagent var entMan = IoCManager.Resolve(); foreach (var plantMetabolizable in _plantMetabolism) { - plantMetabolizable.Metabolize(plantHolder.Value, plantHolder.Value, amount, entMan); + plantMetabolizable.Metabolize( + new ReagentEffectArgs(plantHolder.Value, null, solution, this, amount.Quantity, entMan, null) + ); } } } diff --git a/Resources/Prototypes/Body/Mechanisms/human.yml b/Resources/Prototypes/Body/Mechanisms/human.yml index 240772942e..3d53eeb359 100644 --- a/Resources/Prototypes/Body/Mechanisms/human.yml +++ b/Resources/Prototypes/Body/Mechanisms/human.yml @@ -118,6 +118,7 @@ # This is done because these chemicals need to have some effect even if they aren't being filtered out of your body. # You're technically 'immune to poison' without a heart, but.. uhh, you'll have bigger problems on your hands. - type: Metabolizer + maxReagents: 2 metabolizerTypes: [Human] groups: - id: Medicine @@ -147,6 +148,8 @@ # TODO: Have it work off of the ent's solution container, and move this # to intestines instead. - type: Metabolizer + # mm yummy + maxReagents: 3 metabolizerTypes: [Human] groups: - id: Food @@ -164,6 +167,7 @@ size: 1 compatibility: Biological - type: Metabolizer # The liver metabolizes certain chemicals only, like alcohol. + maxReagents: 1 metabolizerTypes: [Human] groups: - id: Alcohol @@ -182,3 +186,8 @@ - type: Mechanism size: 1 compatibility: Biological + # The kidneys just remove anything that doesn't currently have any metabolisms, as a stopgap. + - type: Metabolizer + maxReagents: 5 + metabolizerTypes: [Human] + removeEmpty: true diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/simplemob.yml b/Resources/Prototypes/Entities/Mobs/NPCs/simplemob.yml index 7ea449a142..658d4c0d73 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/simplemob.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/simplemob.yml @@ -6,17 +6,14 @@ components: - type: Reactive reactions: + - reagents: [Water] + methods: [Touch] + effects: - !type:ExtinguishReaction - touch: true - reagents: - - Water + - reagents: [WeldingFuel, Thermite, Plasma, Ethanol] + methods: [Touch] + effects: - !type:FlammableReaction - touch: true - reagents: - - WeldingFuel - - Thermite - - Plasma - - Ethanol - type: UtilityAI behaviorSets: - Clothing diff --git a/Resources/Prototypes/Entities/Mobs/Species/human.yml b/Resources/Prototypes/Entities/Mobs/Species/human.yml index b8b1b136cd..44070c836f 100644 --- a/Resources/Prototypes/Entities/Mobs/Species/human.yml +++ b/Resources/Prototypes/Entities/Mobs/Species/human.yml @@ -12,23 +12,18 @@ - FootstepSound - type: Reactive reactions: - - !type:ExtinguishReaction - touch: true - reagents: - - Water - - !type:FlammableReaction - touch: true - reagents: - - WeldingFuel - - Thermite - - Plasma - - Ethanol - - Oil - - !type:WashCreamPieReaction - touch: true - reagents: - - Water - - SpaceCleaner + - reagents: [Water] + methods: [Touch] + effects: + - !type:ExtinguishReaction + - reagents: [WeldingFuel, Thermite, Plasma, Ethanol] + methods: [Touch] + effects: + - !type:FlammableReaction + - reagents: [Water, SpaceCleaner] + methods: [Touch] + effects: + - !type:WashCreamPieReaction - type: Flashable - type: Hands - type: MovementSpeedModifier diff --git a/Resources/Prototypes/Entities/Objects/Specific/rehydrateable.yml b/Resources/Prototypes/Entities/Objects/Specific/rehydrateable.yml index eec2db044b..890c5bdc2d 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/rehydrateable.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/rehydrateable.yml @@ -20,13 +20,11 @@ state: cube - type: Reactive reactions: + - reagents: [Water] + methods: [Touch, Ingestion, Injection] + effects: - !type:AddToSolutionReaction solution: cube - touch: true - ingestion: true - injection: true - reagents: - - Water - type: Rehydratable target: MobMonkey - type: CollisionWake @@ -62,13 +60,11 @@ solution: plushie - type: Reactive reactions: - - !type:AddToSolutionReaction - solution: plushie - touch: true - ingestion: true - injection: true - reagents: - - Water + - reagents: [Water] + methods: [Touch, Ingestion, Injection] + effects: + - !type:AddToSolutionReaction + solution: plushie - type: Rehydratable target: MobCarp - type: CollisionWake diff --git a/Resources/Prototypes/Entities/Structures/Walls/barricades.yml b/Resources/Prototypes/Entities/Structures/Walls/barricades.yml index 1310a3a9ea..2ef899c146 100644 --- a/Resources/Prototypes/Entities/Structures/Walls/barricades.yml +++ b/Resources/Prototypes/Entities/Structures/Walls/barricades.yml @@ -46,19 +46,6 @@ damage: types: Heat : 1 #per second, scales with number of fire 'stacks' - - type: Reactive - reactions: - - !type:ExtinguishReaction - touch: true - reagents: - - Water - - !type:FlammableReaction - touch: true - reagents: - - WeldingFuel - - Thermite - - Plasma - - Ethanol - type: Appearance visuals: - type: FireVisualizer diff --git a/Resources/Prototypes/Entities/Structures/soil.yml b/Resources/Prototypes/Entities/Structures/soil.yml index dc2cec7cd3..33c4ffd9ea 100644 --- a/Resources/Prototypes/Entities/Structures/soil.yml +++ b/Resources/Prototypes/Entities/Structures/soil.yml @@ -50,6 +50,9 @@ anchored: true - type: Reactive reactions: + - reagents: [Water] + methods: [Touch, Ingestion, Injection] + effects: - !type:AddToSolutionReaction solution: soil - type: Appearance