diff --git a/Content.Client/Entry/EntryPoint.cs b/Content.Client/Entry/EntryPoint.cs index 73b04aa78a..9b55a8faec 100644 --- a/Content.Client/Entry/EntryPoint.cs +++ b/Content.Client/Entry/EntryPoint.cs @@ -91,6 +91,8 @@ namespace Content.Client.Entry prototypes.RegisterIgnore("aiFaction"); prototypes.RegisterIgnore("behaviorSet"); prototypes.RegisterIgnore("advertisementsPack"); + prototypes.RegisterIgnore("metabolizerType"); + prototypes.RegisterIgnore("metabolismGroup"); ClientContentIoC.Register(); diff --git a/Content.Server/Body/Metabolism/MetabolizerComponent.cs b/Content.Server/Body/Metabolism/MetabolizerComponent.cs index 24960fe756..3064173df7 100644 --- a/Content.Server/Body/Metabolism/MetabolizerComponent.cs +++ b/Content.Server/Body/Metabolism/MetabolizerComponent.cs @@ -1,18 +1,23 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; +using Content.Shared.Body.Metabolism; using Content.Shared.Body.Networks; using Content.Shared.Chemistry.Reagent; using Content.Shared.FixedPoint; +using Robust.Shared.Analyzers; using Robust.Shared.GameObjects; using Robust.Shared.Serialization.Manager.Attributes; +using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary; +using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List; +using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set; namespace Content.Server.Body.Metabolism { /// /// Handles metabolizing various reagents with given effects. /// - [RegisterComponent] + [RegisterComponent, Friend(typeof(MetabolizerSystem))] public class MetabolizerComponent : Component { public override string Name => "Metabolizer"; @@ -27,33 +32,44 @@ namespace Content.Server.Body.Metabolism public float UpdateFrequency = 1.0f; /// - /// From which solution will this metabolizer attempt to metabolize chemicals in its parent bodies' bloodstream, - /// as opposed to a solution container on the metabolizing entity itself. + /// From which solution will this metabolizer attempt to metabolize chemicals /// [DataField("solution")] public string SolutionName { get; set; } = SharedBloodstreamComponent.DefaultSolutionName; /// - /// A dictionary mapping reagent string IDs to a list of effects & associated metabolism rate. + /// Does this component use a solution on it's parent entity (the body) or itself /// - /// - [DataField("metabolisms", required: true, customTypeSerializer:typeof(PrototypeIdDictionarySerializer))] - public Dictionary Metabolisms = default!; + /// + /// Most things will use the parent entity (bloodstream). + /// + [DataField("solutionOnBody")] + public bool SolutionOnBody = true; + + /// + /// List of metabolizer types that this organ is. ex. Human, Slime, Felinid, w/e. + /// + [DataField("metabolizerTypes", customTypeSerializer:typeof(PrototypeIdHashSetSerializer))] + public HashSet? MetabolizerTypes = null; + + /// + /// A list of metabolism groups that this metabolizer will act on, in order of precedence. + /// + [DataField("groups", required: true)] + public List MetabolismGroups = default!; } + /// + /// Contains data about how a metabolizer will metabolize a single group. + /// This allows metabolizers to remove certain groups much faster, or not at all. + /// [DataDefinition] - public class ReagentEffectsEntry + public class MetabolismGroupEntry { - /// - /// Amount of reagent to metabolize, per metabolism cycle. - /// - [DataField("metabolismRate")] - public FixedPoint2 MetabolismRate = FixedPoint2.New(1.0f); + [DataField("id", required: true, customTypeSerializer:typeof(PrototypeIdSerializer))] + public string Id = default!; - /// - /// A list of effects to apply when these reagents are metabolized. - /// - [DataField("effects", required: true)] - public ReagentEffect[] Effects = default!; + [DataField("rateModifier")] + public FixedPoint2 MetabolismRateModifier = 1.0; } } diff --git a/Content.Server/Body/Metabolism/MetabolizerSystem.cs b/Content.Server/Body/Metabolism/MetabolizerSystem.cs index 3f1d3dffe5..f5b89680dc 100644 --- a/Content.Server/Body/Metabolism/MetabolizerSystem.cs +++ b/Content.Server/Body/Metabolism/MetabolizerSystem.cs @@ -1,5 +1,8 @@ using System.Collections.Generic; +using System.Linq; using Content.Server.Body.Circulatory; +using Content.Server.Body.Mechanism; +using Content.Server.Chemistry.Components.SolutionManager; using Content.Server.Chemistry.EntitySystems; using Content.Shared.Body.Components; using Content.Shared.Body.Mechanism; @@ -9,6 +12,7 @@ using Content.Shared.FixedPoint; using JetBrains.Annotations; using Robust.Shared.GameObjects; using Robust.Shared.IoC; +using Robust.Shared.Prototypes; namespace Content.Server.Body.Metabolism { @@ -16,9 +20,8 @@ namespace Content.Server.Body.Metabolism [UsedImplicitly] public class MetabolizerSystem : EntitySystem { - [Dependency] - private readonly SolutionContainerSystem _solutionContainerSystem = default!; - + [Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!; + [Dependency] private readonly IPrototypeManager _prototypeManager = default!; public override void Initialize() { @@ -29,7 +32,20 @@ namespace Content.Server.Body.Metabolism private void OnMetabolizerInit(EntityUid uid, MetabolizerComponent component, ComponentInit args) { - _solutionContainerSystem.EnsureSolution(uid, component.SolutionName); + if (!component.SolutionOnBody) + { + _solutionContainerSystem.EnsureSolution(uid, component.SolutionName); + } + else + { + if (EntityManager.TryGetComponent(uid, out var mech)) + { + if (mech.Body != null) + { + _solutionContainerSystem.EnsureSolution(mech.Body.OwnerUid, component.SolutionName); + } + } + } } public override void Update(float frameTime) @@ -43,80 +59,96 @@ namespace Content.Server.Body.Metabolism // Only update as frequently as it should if (metab.AccumulatedFrametime >= metab.UpdateFrequency) { - metab.AccumulatedFrametime = 0.0f; - TryMetabolize(metab); + metab.AccumulatedFrametime -= metab.UpdateFrequency; + TryMetabolize(metab.OwnerUid, metab); } } } - private void TryMetabolize(MetabolizerComponent comp) + private void TryMetabolize(EntityUid uid, MetabolizerComponent? meta=null, MechanismComponent? mech=null) { - var owner = comp.Owner; - IReadOnlyList reagentList = new List(); - Solution? solution = null; - SharedBodyComponent? body = null; + if (!Resolve(uid, ref meta)) + return; - // if this field is passed we should try and take from the bloodstream over anything else - if (owner.TryGetComponent(out var mech)) + Resolve(uid, ref mech, false); + + // First step is get the solution we actually care about + Solution? solution = null; + EntityUid? solutionEntityUid = null; + SolutionContainerManagerComponent? manager = null; + + if (meta.SolutionOnBody) { - body = mech.Body; - if (body != null) + if (mech != null) { - if (body.Owner.HasComponent() - && _solutionContainerSystem.TryGetSolution(body.OwnerUid, comp.SolutionName, out solution) - && solution.CurrentVolume >= FixedPoint2.Zero) + var body = mech.Body; + + if (body != null) { - reagentList = solution.Contents; + if (!Resolve(body.OwnerUid, ref manager, false)) + return; + _solutionContainerSystem.TryGetSolution(body.OwnerUid, meta.SolutionName, out solution, manager); + solutionEntityUid = body.OwnerUid; } } } - - if (solution == null || reagentList.Count == 0) + else { - // We're all outta ideas on where to metabolize from - return; + if (!Resolve(uid, ref manager, false)) + return; + _solutionContainerSystem.TryGetSolution(uid, meta.SolutionName, out solution, manager); + solutionEntityUid = uid; } - List removeReagents = new(5); - var ent = body?.Owner ?? owner; - - // Run metabolism for each reagent, remove metabolized reagents - foreach (var reagent in reagentList) + if (solutionEntityUid == null || solution == null) + return; + // we found our guy + foreach (var reagent in solution.Contents.ToArray()) { - if (!comp.Metabolisms.ContainsKey(reagent.ReagentId)) + if (!_prototypeManager.TryIndex(reagent.ReagentId, out var proto)) continue; - var metabolism = comp.Metabolisms[reagent.ReagentId]; - // Run metabolism code for each reagent - foreach (var effect in metabolism.Effects) - { - var conditionsMet = true; - if (effect.Conditions != null) - { - // yes this is 3 nested for loops, but all of these lists are - // basically guaranteed to be small or empty - foreach (var condition in effect.Conditions) - { - if (!condition.Condition(ent, reagent)) - { - conditionsMet = false; - break; - } - } - } + if (proto.Metabolisms == null) + continue; - if (!conditionsMet) + // loop over all our groups and see which ones apply + FixedPoint2 mostToRemove = FixedPoint2.Zero; + foreach (var group in meta.MetabolismGroups) + { + if (!proto.Metabolisms.Keys.Contains(group.Id)) continue; - // If we're part of a body, pass that entity to Metabolize - // Otherwise, just pass our owner entity, maybe we're a plant or something - effect.Metabolize(ent, reagent); + var entry = proto.Metabolisms[group.Id]; + + // we don't remove reagent for every group, just whichever had the biggest rate + if (entry.MetabolismRate > mostToRemove) + mostToRemove = entry.MetabolismRate; + + // 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)) + failed = true; + } + + if (failed) + continue; + } + + effect.Metabolize(solutionEntityUid.Value, meta.OwnerUid, quant, EntityManager); + } } - removeReagents.Add(new Solution.ReagentQuantity(reagent.ReagentId, metabolism.MetabolismRate)); + // remove a certain amount of reagent + if (mostToRemove > FixedPoint2.Zero) + _solutionContainerSystem.TryRemoveReagent(solutionEntityUid.Value, solution, reagent.ReagentId, mostToRemove); } - - _solutionContainerSystem.TryRemoveAllReagents(ent.Uid, solution, removeReagents); } } } diff --git a/Content.Server/Botany/Components/PlantHolderComponent.cs b/Content.Server/Botany/Components/PlantHolderComponent.cs index ea23a6aaf1..8c6d2660b0 100644 --- a/Content.Server/Botany/Components/PlantHolderComponent.cs +++ b/Content.Server/Botany/Components/PlantHolderComponent.cs @@ -10,6 +10,7 @@ using Content.Server.Popups; using Content.Shared.ActionBlocker; using Content.Shared.Audio; using Content.Shared.Botany; +using Content.Shared.Chemistry.Components; using Content.Shared.Chemistry.Reagent; using Content.Shared.Examine; using Content.Shared.FixedPoint; @@ -561,11 +562,11 @@ namespace Content.Server.Botany.Components } else { - var one = FixedPoint2.New(1); - foreach (var reagent in solutionSystem.RemoveEachReagent(Owner.Uid, solution, one)) + var amt = FixedPoint2.New(1); + foreach (var reagent in solutionSystem.RemoveEachReagent(OwnerUid, solution, amt)) { var reagentProto = _prototypeManager.Index(reagent); - reagentProto.ReactionPlant(Owner); + reagentProto.ReactionPlant(OwnerUid, new Solution.ReagentQuantity(reagent, amt)); } } diff --git a/Content.Server/Chemistry/PlantMetabolism/AdjustHealth.cs b/Content.Server/Chemistry/PlantMetabolism/AdjustHealth.cs deleted file mode 100644 index 9e3d539e2d..0000000000 --- a/Content.Server/Chemistry/PlantMetabolism/AdjustHealth.cs +++ /dev/null @@ -1,18 +0,0 @@ -using JetBrains.Annotations; -using Robust.Shared.GameObjects; - -namespace Content.Server.Chemistry.PlantMetabolism -{ - [UsedImplicitly] - public class AdjustHealth : AdjustAttribute - { - public override void Metabolize(IEntity plantHolder, float customPlantMetabolism = 1f) - { - if (!CanMetabolize(plantHolder, out var plantHolderComp)) - return; - - plantHolderComp.Health += Amount; - plantHolderComp.CheckHealth(); - } - } -} diff --git a/Content.Server/Chemistry/PlantMetabolism/AdjustMutationLevel.cs b/Content.Server/Chemistry/PlantMetabolism/AdjustMutationLevel.cs deleted file mode 100644 index 55501c86d7..0000000000 --- a/Content.Server/Chemistry/PlantMetabolism/AdjustMutationLevel.cs +++ /dev/null @@ -1,17 +0,0 @@ -using JetBrains.Annotations; -using Robust.Shared.GameObjects; - -namespace Content.Server.Chemistry.PlantMetabolism -{ - [UsedImplicitly] - public class AdjustMutationLevel : AdjustAttribute - { - public override void Metabolize(IEntity plantHolder, float customPlantMetabolism = 1f) - { - if (!CanMetabolize(plantHolder, out var plantHolderComp, false)) - return; - - plantHolderComp.MutationLevel += Amount * plantHolderComp.MutationMod * customPlantMetabolism; - } - } -} diff --git a/Content.Server/Chemistry/PlantMetabolism/AdjustMutationMod.cs b/Content.Server/Chemistry/PlantMetabolism/AdjustMutationMod.cs deleted file mode 100644 index 501932c885..0000000000 --- a/Content.Server/Chemistry/PlantMetabolism/AdjustMutationMod.cs +++ /dev/null @@ -1,17 +0,0 @@ -using JetBrains.Annotations; -using Robust.Shared.GameObjects; - -namespace Content.Server.Chemistry.PlantMetabolism -{ - [UsedImplicitly] - public class AdjustMutationMod : AdjustAttribute - { - public override void Metabolize(IEntity plantHolder, float customPlantMetabolism = 1f) - { - if (!CanMetabolize(plantHolder, out var plantHolderComp)) - return; - - plantHolderComp.MutationMod += Amount; - } - } -} diff --git a/Content.Server/Chemistry/PlantMetabolism/AdjustNutrition.cs b/Content.Server/Chemistry/PlantMetabolism/AdjustNutrition.cs deleted file mode 100644 index 22764fbcee..0000000000 --- a/Content.Server/Chemistry/PlantMetabolism/AdjustNutrition.cs +++ /dev/null @@ -1,18 +0,0 @@ -using JetBrains.Annotations; -using Robust.Shared.GameObjects; - -namespace Content.Server.Chemistry.PlantMetabolism -{ - [UsedImplicitly] - public class AdjustNutrition : AdjustAttribute - { - public override void Metabolize(IEntity plantHolder, float customPlantMetabolism = 1f) - { - if (!CanMetabolize(plantHolder, out var plantHolderComp, false)) - return; - - plantHolderComp.AdjustNutrient(Amount); - return; - } - } -} diff --git a/Content.Server/Chemistry/PlantMetabolism/AdjustPests.cs b/Content.Server/Chemistry/PlantMetabolism/AdjustPests.cs deleted file mode 100644 index c31a5d7138..0000000000 --- a/Content.Server/Chemistry/PlantMetabolism/AdjustPests.cs +++ /dev/null @@ -1,17 +0,0 @@ -using JetBrains.Annotations; -using Robust.Shared.GameObjects; - -namespace Content.Server.Chemistry.PlantMetabolism -{ - [UsedImplicitly] - public class AdjustPests : AdjustAttribute - { - public override void Metabolize(IEntity plantHolder, float customPlantMetabolism = 1f) - { - if (!CanMetabolize(plantHolder, out var plantHolderComp)) - return; - - plantHolderComp.PestLevel += Amount; - } - } -} diff --git a/Content.Server/Chemistry/PlantMetabolism/AdjustToxins.cs b/Content.Server/Chemistry/PlantMetabolism/AdjustToxins.cs deleted file mode 100644 index f9d281c0e4..0000000000 --- a/Content.Server/Chemistry/PlantMetabolism/AdjustToxins.cs +++ /dev/null @@ -1,17 +0,0 @@ -using JetBrains.Annotations; -using Robust.Shared.GameObjects; - -namespace Content.Server.Chemistry.PlantMetabolism -{ - [UsedImplicitly] - public class AdjustToxins : AdjustAttribute - { - public override void Metabolize(IEntity plantHolder, float customPlantMetabolism = 1f) - { - if (!CanMetabolize(plantHolder, out var plantHolderComp, false)) - return; - - plantHolderComp.Toxins += Amount; - } - } -} diff --git a/Content.Server/Chemistry/PlantMetabolism/AdjustWater.cs b/Content.Server/Chemistry/PlantMetabolism/AdjustWater.cs deleted file mode 100644 index f9b39b041d..0000000000 --- a/Content.Server/Chemistry/PlantMetabolism/AdjustWater.cs +++ /dev/null @@ -1,17 +0,0 @@ -using JetBrains.Annotations; -using Robust.Shared.GameObjects; - -namespace Content.Server.Chemistry.PlantMetabolism -{ - [UsedImplicitly] - public class AdjustWater : AdjustAttribute - { - public override void Metabolize(IEntity plantHolder, float customPlantMetabolism = 1f) - { - if (!CanMetabolize(plantHolder, out var plantHolderComp, false)) - return; - - plantHolderComp.AdjustWater(Amount); - } - } -} diff --git a/Content.Server/Chemistry/PlantMetabolism/AdjustWeeds.cs b/Content.Server/Chemistry/PlantMetabolism/AdjustWeeds.cs deleted file mode 100644 index e78c0cfe36..0000000000 --- a/Content.Server/Chemistry/PlantMetabolism/AdjustWeeds.cs +++ /dev/null @@ -1,17 +0,0 @@ -using JetBrains.Annotations; -using Robust.Shared.GameObjects; - -namespace Content.Server.Chemistry.PlantMetabolism -{ - [UsedImplicitly] - public class AdjustWeeds : AdjustAttribute - { - public override void Metabolize(IEntity plantHolder, float customPlantMetabolism = 1f) - { - if (!CanMetabolize(plantHolder, out var plantHolderComp, false)) - return; - - plantHolderComp.WeedLevel += Amount; - } - } -} diff --git a/Content.Server/Chemistry/PlantMetabolism/AffectGrowth.cs b/Content.Server/Chemistry/PlantMetabolism/AffectGrowth.cs deleted file mode 100644 index 5fc534b7ba..0000000000 --- a/Content.Server/Chemistry/PlantMetabolism/AffectGrowth.cs +++ /dev/null @@ -1,17 +0,0 @@ -using JetBrains.Annotations; -using Robust.Shared.GameObjects; - -namespace Content.Server.Chemistry.PlantMetabolism -{ - [UsedImplicitly] - public class AffectGrowth : AdjustAttribute - { - public override void Metabolize(IEntity plantHolder, float customPlantMetabolism = 1f) - { - if (!CanMetabolize(plantHolder, out var plantHolderComp)) - return; - - plantHolderComp.AffectGrowth((int) Amount); - } - } -} diff --git a/Content.Server/Chemistry/ReagentEffectConditions/OrganType.cs b/Content.Server/Chemistry/ReagentEffectConditions/OrganType.cs new file mode 100644 index 0000000000..cff9bc780f --- /dev/null +++ b/Content.Server/Chemistry/ReagentEffectConditions/OrganType.cs @@ -0,0 +1,34 @@ +using Content.Server.Body.Metabolism; +using Content.Shared.Body.Metabolism; +using Content.Shared.Chemistry.Components; +using Content.Shared.Chemistry.Reagent; +using Robust.Shared.GameObjects; +using Robust.Shared.Serialization.Manager.Attributes; +using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; + +namespace Content.Server.Chemistry.ReagentEffectConditions +{ + /// + /// Requires that the metabolizing organ is or is not tagged with a certain MetabolizerType + /// + public class OrganType : ReagentEffectCondition + { + [DataField("type", required: true, customTypeSerializer: typeof(PrototypeIdSerializer))] + public string Type = default!; + + /// + /// Does this condition pass when the organ has the type, or when it doesn't have the type? + /// + [DataField("shouldHave")] + public bool ShouldHave = true; + + public override bool Condition(EntityUid solutionEntity, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager) + { + if (entityManager.TryGetComponent(organEntity, out var metabolizer) + && metabolizer.MetabolizerTypes != null + && metabolizer.MetabolizerTypes.Contains(Type)) + return ShouldHave; + return !ShouldHave; + } + } +} diff --git a/Content.Server/Chemistry/ReagentEffectConditions/ReagentThreshold.cs b/Content.Server/Chemistry/ReagentEffectConditions/ReagentThreshold.cs index ed89541272..38e682864e 100644 --- a/Content.Server/Chemistry/ReagentEffectConditions/ReagentThreshold.cs +++ b/Content.Server/Chemistry/ReagentEffectConditions/ReagentThreshold.cs @@ -18,7 +18,7 @@ namespace Content.Server.Chemistry.ReagentEffectConditions [DataField("max")] public FixedPoint2 Max = FixedPoint2.MaxValue; - public override bool Condition(IEntity solutionEntity, Solution.ReagentQuantity reagent) + public override bool Condition(EntityUid solutionEntity, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager) { return reagent.Quantity >= Min && reagent.Quantity < Max; } diff --git a/Content.Server/Chemistry/ReagentEffects/HealthChange.cs b/Content.Server/Chemistry/ReagentEffects/HealthChange.cs index 8cb7113064..4bcf996caf 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(IEntity solutionEntity, Solution.ReagentQuantity amount) + public override void Metabolize(EntityUid solutionEntity, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager) { - EntitySystem.Get().TryChangeDamage(solutionEntity.Uid, Damage, true); + EntitySystem.Get().TryChangeDamage(solutionEntity, Damage, true); } } } diff --git a/Content.Server/Chemistry/ReagentEffects/MovespeedModifier.cs b/Content.Server/Chemistry/ReagentEffects/MovespeedModifier.cs index 519d599a3a..8af80cf40e 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(IEntity solutionEntity, Solution.ReagentQuantity amount) + public override void Metabolize(EntityUid solutionEntity, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager) { - solutionEntity.EnsureComponent(out MovespeedModifierMetabolismComponent status); + var status = entityManager.EnsureComponent(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 * amount.Quantity.Float()); + IncreaseTimer(status, StatusLifetime * reagent.Quantity.Float()); if (modified) - EntitySystem.Get().RefreshMovementSpeedModifiers(solutionEntity.Uid); + EntitySystem.Get().RefreshMovementSpeedModifiers(solutionEntity); } public void IncreaseTimer(MovespeedModifierMetabolismComponent status, float time) diff --git a/Content.Server/Chemistry/PlantMetabolism/AdjustAttribute.cs b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustAttribute.cs similarity index 70% rename from Content.Server/Chemistry/PlantMetabolism/AdjustAttribute.cs rename to Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustAttribute.cs index 7a718650e1..83ed7eb94e 100644 --- a/Content.Server/Chemistry/PlantMetabolism/AdjustAttribute.cs +++ b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustAttribute.cs @@ -1,15 +1,17 @@ using System.Diagnostics.CodeAnalysis; using Content.Server.Botany.Components; using Content.Shared.Botany; +using Content.Shared.Chemistry.Components; +using Content.Shared.Chemistry.Reagent; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Random; using Robust.Shared.Serialization.Manager.Attributes; -namespace Content.Server.Chemistry.PlantMetabolism +namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism { [ImplicitDataDefinitionForInheritors] - public abstract class AdjustAttribute : IPlantMetabolizable + public abstract class PlantAdjustAttribute : ReagentEffect { [Dependency] private readonly IRobustRandom _robustRandom = default!; @@ -21,13 +23,16 @@ namespace Content.Server.Chemistry.PlantMetabolism /// /// The entity holding the plant /// The plant holder component + /// The entity manager /// Whether to check if it has an alive plant or not /// - public bool CanMetabolize(IEntity plantHolder, [NotNullWhen(true)] out PlantHolderComponent? plantHolderComponent, bool mustHaveAlivePlant = true) + public bool CanMetabolize(EntityUid plantHolder, [NotNullWhen(true)] out PlantHolderComponent? plantHolderComponent, + IEntityManager entityManager, + bool mustHaveAlivePlant = true) { plantHolderComponent = null; - if (plantHolder.Deleted || !plantHolder.TryGetComponent(out plantHolderComponent) + if (!entityManager.TryGetComponent(plantHolder, out plantHolderComponent) || mustHaveAlivePlant && (plantHolderComponent.Seed == null || plantHolderComponent.Dead)) return false; @@ -36,7 +41,5 @@ namespace Content.Server.Chemistry.PlantMetabolism return !(Prob <= 0f) && _robustRandom.Prob(Prob); } - - public abstract void Metabolize(IEntity plantHolder, float customPlantMetabolism = 1f); } } diff --git a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustHealth.cs b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustHealth.cs new file mode 100644 index 0000000000..b79e91cecb --- /dev/null +++ b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustHealth.cs @@ -0,0 +1,18 @@ +using Content.Shared.Chemistry.Components; +using JetBrains.Annotations; +using Robust.Shared.GameObjects; + +namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism +{ + public class PlantAdjustHealth : PlantAdjustAttribute + { + public override void Metabolize(EntityUid plantHolder, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager) + { + if (!CanMetabolize(plantHolder, out var plantHolderComp, entityManager)) + return; + + plantHolderComp.Health += Amount; + plantHolderComp.CheckHealth(); + } + } +} diff --git a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustMutationLevel.cs b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustMutationLevel.cs new file mode 100644 index 0000000000..7cb2d6b8ff --- /dev/null +++ b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustMutationLevel.cs @@ -0,0 +1,17 @@ +using Content.Shared.Chemistry.Components; +using JetBrains.Annotations; +using Robust.Shared.GameObjects; + +namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism +{ + public class PlantAdjustMutationLevel : PlantAdjustAttribute + { + public override void Metabolize(EntityUid plantHolder, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager) + { + if (!CanMetabolize(plantHolder, out var plantHolderComp, 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 new file mode 100644 index 0000000000..b205dbe6ca --- /dev/null +++ b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustMutationMod.cs @@ -0,0 +1,18 @@ +using Content.Shared.Chemistry.Components; +using JetBrains.Annotations; +using Robust.Shared.GameObjects; + +namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism +{ + [UsedImplicitly] + public class PlantAdjustMutationMod : PlantAdjustAttribute + { + public override void Metabolize(EntityUid plantHolder, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager) + { + if (!CanMetabolize(plantHolder, out var plantHolderComp, entityManager)) + return; + + plantHolderComp.MutationMod += Amount; + } + } +} diff --git a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustNutrition.cs b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustNutrition.cs new file mode 100644 index 0000000000..3fb8a37e1f --- /dev/null +++ b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustNutrition.cs @@ -0,0 +1,19 @@ +using Content.Shared.Chemistry.Components; +using JetBrains.Annotations; +using Robust.Shared.GameObjects; + +namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism +{ + [UsedImplicitly] + public class PlantAdjustNutrition : PlantAdjustAttribute + { + public override void Metabolize(EntityUid plantHolder, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager) + { + if (!CanMetabolize(plantHolder, out var plantHolderComp, entityManager)) + return; + + plantHolderComp.AdjustNutrient(Amount); + return; + } + } +} diff --git a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustPests.cs b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustPests.cs new file mode 100644 index 0000000000..a7e3137c4b --- /dev/null +++ b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustPests.cs @@ -0,0 +1,18 @@ +using Content.Shared.Chemistry.Components; +using JetBrains.Annotations; +using Robust.Shared.GameObjects; + +namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism +{ + [UsedImplicitly] + public class PlantAdjustPests : PlantAdjustAttribute + { + public override void Metabolize(EntityUid plantHolder, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager) + { + if (!CanMetabolize(plantHolder, out var plantHolderComp, entityManager)) + return; + + plantHolderComp.PestLevel += Amount; + } + } +} diff --git a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustToxins.cs b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustToxins.cs new file mode 100644 index 0000000000..e838a312b7 --- /dev/null +++ b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustToxins.cs @@ -0,0 +1,18 @@ +using Content.Shared.Chemistry.Components; +using JetBrains.Annotations; +using Robust.Shared.GameObjects; + +namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism +{ + [UsedImplicitly] + public class PlantAdjustToxins : PlantAdjustAttribute + { + public override void Metabolize(EntityUid plantHolder, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager) + { + if (!CanMetabolize(plantHolder, out var plantHolderComp, entityManager)) + return; + + plantHolderComp.Toxins += Amount; + } + } +} diff --git a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustWater.cs b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustWater.cs new file mode 100644 index 0000000000..f290546d45 --- /dev/null +++ b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustWater.cs @@ -0,0 +1,18 @@ +using Content.Shared.Chemistry.Components; +using JetBrains.Annotations; +using Robust.Shared.GameObjects; + +namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism +{ + [UsedImplicitly] + public class PlantAdjustWater : PlantAdjustAttribute + { + public override void Metabolize(EntityUid plantHolder, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager) + { + if (!CanMetabolize(plantHolder, out var plantHolderComp, entityManager)) + return; + + plantHolderComp.AdjustWater(Amount); + } + } +} diff --git a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustWeeds.cs b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustWeeds.cs new file mode 100644 index 0000000000..279060e0f7 --- /dev/null +++ b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustWeeds.cs @@ -0,0 +1,18 @@ +using Content.Shared.Chemistry.Components; +using JetBrains.Annotations; +using Robust.Shared.GameObjects; + +namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism +{ + [UsedImplicitly] + public class PlantAdjustWeeds : PlantAdjustAttribute + { + public override void Metabolize(EntityUid plantHolder, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager) + { + if (!CanMetabolize(plantHolder, out var plantHolderComp, entityManager)) + return; + + plantHolderComp.WeedLevel += Amount; + } + } +} diff --git a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAffectGrowth.cs b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAffectGrowth.cs new file mode 100644 index 0000000000..347c0bf929 --- /dev/null +++ b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAffectGrowth.cs @@ -0,0 +1,18 @@ +using Content.Shared.Chemistry.Components; +using JetBrains.Annotations; +using Robust.Shared.GameObjects; + +namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism +{ + [UsedImplicitly] + public class PlantAffectGrowth : PlantAdjustAttribute + { + public override void Metabolize(EntityUid plantHolder, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager) + { + if (!CanMetabolize(plantHolder, out var plantHolderComp, entityManager)) + return; + + plantHolderComp.AffectGrowth((int) Amount); + } + } +} diff --git a/Content.Server/Chemistry/PlantMetabolism/Clonexadone.cs b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantClonexadone.cs similarity index 67% rename from Content.Server/Chemistry/PlantMetabolism/Clonexadone.cs rename to Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantClonexadone.cs index 69eb5ddddd..616b77ab69 100644 --- a/Content.Server/Chemistry/PlantMetabolism/Clonexadone.cs +++ b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantClonexadone.cs @@ -1,21 +1,23 @@ using System; using Content.Server.Botany.Components; using Content.Shared.Botany; +using Content.Shared.Chemistry.Components; +using Content.Shared.Chemistry.Reagent; using JetBrains.Annotations; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Random; using Robust.Shared.Serialization.Manager.Attributes; -namespace Content.Server.Chemistry.PlantMetabolism +namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism { [UsedImplicitly] [DataDefinition] - public class Clonexadone : IPlantMetabolizable + public class PlantClonexadone : ReagentEffect { - public void Metabolize(IEntity plantHolder, float customPlantMetabolism = 1) + public override void Metabolize(EntityUid plantHolder, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager) { - if (plantHolder.Deleted || !plantHolder.TryGetComponent(out PlantHolderComponent? plantHolderComp) + if (!entityManager.TryGetComponent(plantHolder, out PlantHolderComponent? plantHolderComp) || plantHolderComp.Seed == null || plantHolderComp.Dead) return; diff --git a/Content.Server/Chemistry/PlantMetabolism/Diethylamine.cs b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantDiethylamine.cs similarity index 68% rename from Content.Server/Chemistry/PlantMetabolism/Diethylamine.cs rename to Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantDiethylamine.cs index efecce3a79..4e4d2ad462 100644 --- a/Content.Server/Chemistry/PlantMetabolism/Diethylamine.cs +++ b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantDiethylamine.cs @@ -1,5 +1,7 @@ using Content.Server.Botany.Components; using Content.Shared.Botany; +using Content.Shared.Chemistry.Components; +using Content.Shared.Chemistry.Reagent; using JetBrains.Annotations; using Robust.Shared.GameObjects; using Robust.Shared.IoC; @@ -7,29 +9,29 @@ using Robust.Shared.Maths; using Robust.Shared.Random; using Robust.Shared.Serialization.Manager.Attributes; -namespace Content.Server.Chemistry.PlantMetabolism +namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism { [UsedImplicitly] [DataDefinition] - public class Diethylamine : IPlantMetabolizable + public class PlantDiethylamine : ReagentEffect { - public void Metabolize(IEntity plantHolder, float customPlantMetabolism = 1) + public override void Metabolize(EntityUid plantHolder, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager) { - if (plantHolder.Deleted || !plantHolder.TryGetComponent(out PlantHolderComponent? plantHolderComp) + if (!entityManager.TryGetComponent(plantHolder, out PlantHolderComponent? plantHolderComp) || plantHolderComp.Seed == null || plantHolderComp.Dead || plantHolderComp.Seed.Immutable) return; var random = IoCManager.Resolve(); - var chance = MathHelper.Lerp(15f, 125f, plantHolderComp.Seed.Lifespan) * 2f * customPlantMetabolism; + var chance = MathHelper.Lerp(15f, 125f, plantHolderComp.Seed.Lifespan) * 2f; if (random.Prob(chance)) { plantHolderComp.CheckForDivergence(true); plantHolderComp.Seed.Lifespan++; } - chance = MathHelper.Lerp(15f, 125f, plantHolderComp.Seed.Endurance) * 2f * customPlantMetabolism; + chance = MathHelper.Lerp(15f, 125f, plantHolderComp.Seed.Endurance) * 2f; if (random.Prob(chance)) { plantHolderComp.CheckForDivergence(true); diff --git a/Content.Server/Chemistry/PlantMetabolism/RobustHarvest.cs b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/RobustHarvest.cs similarity index 68% rename from Content.Server/Chemistry/PlantMetabolism/RobustHarvest.cs rename to Content.Server/Chemistry/ReagentEffects/PlantMetabolism/RobustHarvest.cs index 854310479b..49ee3c2b97 100644 --- a/Content.Server/Chemistry/PlantMetabolism/RobustHarvest.cs +++ b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/RobustHarvest.cs @@ -1,5 +1,7 @@ using Content.Server.Botany.Components; using Content.Shared.Botany; +using Content.Shared.Chemistry.Components; +using Content.Shared.Chemistry.Reagent; using JetBrains.Annotations; using Robust.Shared.GameObjects; using Robust.Shared.IoC; @@ -7,22 +9,22 @@ using Robust.Shared.Maths; using Robust.Shared.Random; using Robust.Shared.Serialization.Manager.Attributes; -namespace Content.Server.Chemistry.PlantMetabolism +namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism { [UsedImplicitly] [DataDefinition] - public class RobustHarvest : IPlantMetabolizable + public class RobustHarvest : ReagentEffect { - public void Metabolize(IEntity plantHolder, float customPlantMetabolism = 1f) + public override void Metabolize(EntityUid plantHolder, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager) { - if (plantHolder.Deleted || !plantHolder.TryGetComponent(out PlantHolderComponent? plantHolderComp) + if (!entityManager.TryGetComponent(plantHolder, out PlantHolderComponent? plantHolderComp) || plantHolderComp.Seed == null || plantHolderComp.Dead || plantHolderComp.Seed.Immutable) return; var random = IoCManager.Resolve(); - var chance = MathHelper.Lerp(15f, 150f, plantHolderComp.Seed.Potency) * 3.5f * customPlantMetabolism; + var chance = MathHelper.Lerp(15f, 150f, plantHolderComp.Seed.Potency) * 3.5f; if (random.Prob(chance)) { @@ -30,7 +32,7 @@ namespace Content.Server.Chemistry.PlantMetabolism plantHolderComp.Seed.Potency++; } - chance = MathHelper.Lerp(6f, 2f, plantHolderComp.Seed.Yield) * 0.15f * customPlantMetabolism; + chance = MathHelper.Lerp(6f, 2f, plantHolderComp.Seed.Yield) * 0.15f; if (random.Prob(chance)) { diff --git a/Content.Server/Chemistry/ReagentEffects/SatiateHunger.cs b/Content.Server/Chemistry/ReagentEffects/SatiateHunger.cs index aed1be8fda..f63e7181d4 100644 --- a/Content.Server/Chemistry/ReagentEffects/SatiateHunger.cs +++ b/Content.Server/Chemistry/ReagentEffects/SatiateHunger.cs @@ -15,12 +15,12 @@ namespace Content.Server.Chemistry.ReagentEffects /// /// How much hunger is satiated when 1u of the reagent is metabolized /// - [DataField("nutritionFactor")] public float NutritionFactor { get; set; } = 3.0f; + [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(IEntity solutionEntity, Solution.ReagentQuantity amount) + public override void Metabolize(EntityUid solutionEntity, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager) { - if (solutionEntity.TryGetComponent(out HungerComponent? hunger)) + if (entityManager.TryGetComponent(solutionEntity, out HungerComponent? hunger)) hunger.UpdateFood(NutritionFactor); } } diff --git a/Content.Server/Chemistry/ReagentEffects/SatiateThirst.cs b/Content.Server/Chemistry/ReagentEffects/SatiateThirst.cs index ce2de5789d..28e8c728ab 100644 --- a/Content.Server/Chemistry/ReagentEffects/SatiateThirst.cs +++ b/Content.Server/Chemistry/ReagentEffects/SatiateThirst.cs @@ -14,13 +14,13 @@ namespace Content.Server.Chemistry.ReagentEffects { /// How much thirst is satiated each metabolism tick. Not currently tied to /// rate or anything. - [DataField("hydrationFactor")] + [DataField("factor")] public float HydrationFactor { get; set; } = 3.0f; /// Satiate thirst if a ThirstComponent can be found - public override void Metabolize(IEntity solutionEntity, Solution.ReagentQuantity amount) + public override void Metabolize(EntityUid solutionEntity, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager) { - if (solutionEntity.TryGetComponent(out ThirstComponent? thirst)) + if (entityManager.TryGetComponent(solutionEntity, out ThirstComponent? thirst)) thirst.UpdateThirst(HydrationFactor); } } diff --git a/Content.Shared/Body/Metabolism/MetabolismGroupPrototype.cs b/Content.Shared/Body/Metabolism/MetabolismGroupPrototype.cs new file mode 100644 index 0000000000..7a7a1dad52 --- /dev/null +++ b/Content.Shared/Body/Metabolism/MetabolismGroupPrototype.cs @@ -0,0 +1,12 @@ +using Robust.Shared.Prototypes; +using Robust.Shared.Serialization.Manager.Attributes; + +namespace Content.Shared.Body.Metabolism +{ + [Prototype("metabolismGroup")] + public class MetabolismGroupPrototype : IPrototype + { + [DataField("id", required: true)] + public string ID { get; } = default!; + } +} diff --git a/Content.Shared/Body/Metabolism/MetabolizerTypePrototype.cs b/Content.Shared/Body/Metabolism/MetabolizerTypePrototype.cs new file mode 100644 index 0000000000..a66b4f24f8 --- /dev/null +++ b/Content.Shared/Body/Metabolism/MetabolizerTypePrototype.cs @@ -0,0 +1,12 @@ +using Robust.Shared.Prototypes; +using Robust.Shared.Serialization.Manager.Attributes; + +namespace Content.Shared.Body.Metabolism +{ + [Prototype("metabolizerType")] + public class MetabolizerTypePrototype : IPrototype + { + [DataField("id", required: true)] + public string ID { get; } = default!; + } +} diff --git a/Content.Shared/Botany/IPlantMetabolizable.cs b/Content.Shared/Botany/IPlantMetabolizable.cs deleted file mode 100644 index e70b271194..0000000000 --- a/Content.Shared/Botany/IPlantMetabolizable.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Robust.Shared.GameObjects; - -namespace Content.Shared.Botany -{ - public interface IPlantMetabolizable - { - /// - /// Metabolize unit(s) of a reagent. - /// - /// Entity holding the plant - /// Units to metabolize - void Metabolize(IEntity plantHolder, float customPlantMetabolism = 1f); - } -} diff --git a/Content.Shared/Chemistry/Reagent/ReagentEffect.cs b/Content.Shared/Chemistry/Reagent/ReagentEffect.cs index d8aebb5ae9..740e25f515 100644 --- a/Content.Shared/Chemistry/Reagent/ReagentEffect.cs +++ b/Content.Shared/Chemistry/Reagent/ReagentEffect.cs @@ -1,5 +1,7 @@ using System.Collections.Generic; +using Content.Shared.Chemistry.Components; using Content.Shared.Chemistry.Reagent; +using JetBrains.Annotations; using Robust.Shared.GameObjects; using Robust.Shared.Serialization.Manager.Attributes; @@ -7,9 +9,10 @@ namespace Content.Shared.Chemistry.Reagent { /// /// Reagent effects describe behavior that occurs when a reagent is ingested and metabolized by some - /// organ. They only trigger when their conditions ( + /// organ. They only trigger when all of are satisfied. /// [ImplicitDataDefinitionForInheritors] + [MeansImplicitUse] public abstract class ReagentEffect { /// @@ -18,6 +21,6 @@ namespace Content.Shared.Chemistry.Reagent [DataField("conditions")] public ReagentEffectCondition[]? Conditions; - public abstract void Metabolize(IEntity solutionEntity, Components.Solution.ReagentQuantity amount); + public abstract void Metabolize(EntityUid solutionEntity, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager); } } diff --git a/Content.Shared/Chemistry/Reagent/ReagentEffectCondition.cs b/Content.Shared/Chemistry/Reagent/ReagentEffectCondition.cs index aea367fce9..3f10041bd7 100644 --- a/Content.Shared/Chemistry/Reagent/ReagentEffectCondition.cs +++ b/Content.Shared/Chemistry/Reagent/ReagentEffectCondition.cs @@ -1,12 +1,14 @@ using Content.Shared.Chemistry.Components; +using JetBrains.Annotations; using Robust.Shared.GameObjects; using Robust.Shared.Serialization.Manager.Attributes; namespace Content.Shared.Chemistry.Reagent { [ImplicitDataDefinitionForInheritors] + [MeansImplicitUse] public abstract class ReagentEffectCondition { - public abstract bool Condition(IEntity solutionEntity, Solution.ReagentQuantity reagent); + public abstract bool Condition(EntityUid solutionEntity, EntityUid organEntity, Solution.ReagentQuantity reagent, IEntityManager entityManager); } } diff --git a/Content.Shared/Chemistry/Reagent/ReagentPrototype.cs b/Content.Shared/Chemistry/Reagent/ReagentPrototype.cs index f4dd05b88e..833b5de07f 100644 --- a/Content.Shared/Chemistry/Reagent/ReagentPrototype.cs +++ b/Content.Shared/Chemistry/Reagent/ReagentPrototype.cs @@ -1,29 +1,35 @@ using System; using System.Collections.Generic; +using Content.Shared.Body.Metabolism; using Content.Shared.Botany; +using Content.Shared.Chemistry.Components; using Content.Shared.Chemistry.Reaction; using Content.Shared.FixedPoint; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; using Robust.Shared.Map; using Robust.Shared.Maths; using Robust.Shared.Prototypes; using Robust.Shared.Serialization.Manager.Attributes; +using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; +using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary; +using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List; using Robust.Shared.ViewVariables; namespace Content.Shared.Chemistry.Reagent { [Prototype("reagent")] [DataDefinition] - public class ReagentPrototype : IPrototype + public class ReagentPrototype : IPrototype, IInheritingPrototype { + [DataField("metabolisms", serverOnly: true, customTypeSerializer: typeof(PrototypeIdDictionarySerializer))] + public Dictionary? Metabolisms = null; + [DataField("tileReactions", serverOnly: true)] private readonly List _tileReactions = new(0); [DataField("plantMetabolism", serverOnly: true)] - private readonly List _plantMetabolism = new(0); - - [DataField("customPlantMetabolism")] - private readonly float _customPlantMetabolism = 1f; + private readonly List _plantMetabolism = new(0); [ViewVariables] [DataField("id", required: true)] @@ -32,6 +38,13 @@ namespace Content.Shared.Chemistry.Reagent [DataField("name")] public string Name { get; } = string.Empty; + [DataField("parent", customTypeSerializer:typeof(PrototypeIdSerializer))] + public string? Parent { get; private set; } + + [NeverPushInheritance] + [DataField("abstract")] + public bool Abstract { get; private set; } + [DataField("desc")] public string Description { get; } = string.Empty; @@ -41,12 +54,6 @@ namespace Content.Shared.Chemistry.Reagent [DataField("color")] public Color SubstanceColor { get; } = Color.White; - [DataField("toxin")] - public bool Toxin { get; } - - [DataField("boozePower")] - public int BoozePower { get; } - [DataField("boilingPoint")] public float? BoilingPoint { get; } @@ -58,7 +65,7 @@ namespace Content.Shared.Chemistry.Reagent //List of metabolism effects this reagent has, should really only be used server-side. public IReadOnlyList TileReactions => _tileReactions; - public IReadOnlyList PlantMetabolism => _plantMetabolism; + public IReadOnlyList PlantMetabolism => _plantMetabolism; /// /// If the substance color is too dark we user a lighter version to make the text color readable when the user examines a solution. @@ -99,15 +106,32 @@ namespace Content.Shared.Chemistry.Reagent return removed; } - public void ReactionPlant(IEntity? plantHolder) + public void ReactionPlant(EntityUid? plantHolder, Solution.ReagentQuantity amount) { - if (plantHolder == null || plantHolder.Deleted) + if (plantHolder == null) return; + var entMan = IoCManager.Resolve(); foreach (var plantMetabolizable in _plantMetabolism) { - plantMetabolizable.Metabolize(plantHolder, _customPlantMetabolism); + plantMetabolizable.Metabolize(plantHolder.Value, plantHolder.Value, amount, entMan); } } } + + [DataDefinition] + public class ReagentEffectsEntry + { + /// + /// Amount of reagent to metabolize, per metabolism cycle. + /// + [DataField("metabolismRate")] + public FixedPoint2 MetabolismRate = FixedPoint2.New(1.0f); + + /// + /// A list of effects to apply when these reagents are metabolized. + /// + [DataField("effects", required: true)] + public ReagentEffect[] Effects = default!; + } } diff --git a/Content.Shared/StatusEffect/StatusEffectsComponent.cs b/Content.Shared/StatusEffect/StatusEffectsComponent.cs index 21833a5e58..5bfd33f345 100644 --- a/Content.Shared/StatusEffect/StatusEffectsComponent.cs +++ b/Content.Shared/StatusEffect/StatusEffectsComponent.cs @@ -5,6 +5,7 @@ using Robust.Shared.GameObjects; using Robust.Shared.GameStates; using Robust.Shared.Serialization; using Robust.Shared.Serialization.Manager.Attributes; +using Robust.Shared.ViewVariables; namespace Content.Shared.StatusEffect { @@ -15,6 +16,7 @@ namespace Content.Shared.StatusEffect { public override string Name => "StatusEffects"; + [ViewVariables] public Dictionary ActiveEffects = new(); /// @@ -33,12 +35,14 @@ namespace Content.Shared.StatusEffect /// /// The start and end times of the status effect. /// + [ViewVariables] public (TimeSpan, TimeSpan) Cooldown; /// /// The name of the relevant component that /// was added alongside the effect, if any. /// + [ViewVariables] public string? RelevantComponent; public StatusEffectState((TimeSpan, TimeSpan) cooldown, string? relevantComponent=null) diff --git a/Content.Shared/StatusEffect/StatusEffectsSystem.cs b/Content.Shared/StatusEffect/StatusEffectsSystem.cs index dc19da84d8..1ef7b95ffb 100644 --- a/Content.Shared/StatusEffect/StatusEffectsSystem.cs +++ b/Content.Shared/StatusEffect/StatusEffectsSystem.cs @@ -320,6 +320,7 @@ namespace Content.Shared.StatusEffect var timer = status.ActiveEffects[key].Cooldown; timer.Item2 += time; + status.ActiveEffects[key].Cooldown = timer; return true; } @@ -347,6 +348,7 @@ namespace Content.Shared.StatusEffect return false; timer.Item2 -= time; + status.ActiveEffects[key].Cooldown = timer; return true; } diff --git a/Resources/Prototypes/Body/Mechanisms/human.yml b/Resources/Prototypes/Body/Mechanisms/human.yml index 238cafa652..e5ef0e5c95 100644 --- a/Resources/Prototypes/Body/Mechanisms/human.yml +++ b/Resources/Prototypes/Body/Mechanisms/human.yml @@ -103,8 +103,6 @@ behaviors: - !type:LungBehavior {} -# TODO DAMAGE UNITS. Some of these damage effects were scaled up to integers. -# Scale back down when damage units are in. - type: entity id: OrganHumanHeart parent: BaseHumanOrgan @@ -122,98 +120,11 @@ # 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 - metabolisms: - Arithrazine: - effects: - - !type:HealthChange - damage: - groups: - Toxin: -2 # -1 Multiplying by 2. pls give damage units - Brute: 1 # 0.5 - Bicaridine: - effects: - - !type:HealthChange - damage: - groups: - Brute: -2 - Dermaline: - effects: - - !type:HealthChange - damage: - groups: - Burn: -3 - Dexalin: - effects: - - !type:HealthChange - damage: - types: - Asphyxiation: -1 - DexalinPlus: - effects: - - !type:HealthChange - damage: - types: - Asphyxiation: -3 - Dylovene: - effects: - - !type:HealthChange - damage: - types: - Poison: -1 - Ephedrine: - effects: - - !type:MovespeedModifier - walkSpeedModifier: 1.2 - sprintSpeedModifier: 1.2 - HeartbreakerToxin: - effects: - - !type:HealthChange - damage: - types: - Asphyxiation: 4 - Kelotane: - effects: - - !type:HealthChange - damage: - groups: - Burn: -1 - Lexorin: - effects: - - !type:HealthChange - damage: - groups: - Airloss: 7 - Meth: - effects: - - !type:HealthChange - damage: - types: - Poison: 2 # 2.5 - - !type:MovespeedModifier - walkSpeedModifier: 1.3 - sprintSpeedModifier: 1.3 - - !type:HealthChange - conditions: - - !type:ReagentThreshold - min: 10 - damage: - types: - Poison: 4 # this is added to the base damage of the meth. - Omnizine: - effects: - - !type:HealthChange - damage: - groups: - Burn: -3 # -2. w/o damage units did not divide into 3 types - Toxin: -2 - Airloss: -2 - Brute: -3 # -2. w/o damage units did not divide into 3 types - Synaptizine: - effects: - - !type:HealthChange - damage: - types: - Poison: 1 # 0.5 pls damage units + metabolizerTypes: [Human] + groups: + - id: Medicine + - id: Poison + - id: Narcotic - type: entity id: OrganHumanStomach @@ -237,92 +148,11 @@ # The stomach metabolizes stuff like foods and drinks. # TODO: Have it work off of the ent's solution container, and move this # to intestines instead. - - type: Metabolizer # Release me from this hell called 1 reagent for every drink - # TODO please make every drink their own base thing - metabolisms: - Flour: - effects: - - !type:SatiateHunger - JuiceApple: - effects: - - !type:SatiateThirst - JuiceBerry: - effects: - - !type:SatiateThirst - JuiceBanana: - effects: - - !type:SatiateThirst - JuiceCarrot: - effects: - - !type:SatiateThirst - JuiceLime: - effects: - - !type:SatiateThirst - JuiceLemon: - effects: - - !type:SatiateThirst - JuiceGrape: - effects: - - !type:SatiateThirst - JuiceOrange: - effects: - - !type:SatiateThirst - JuiceTomato: - effects: - - !type:SatiateThirst - JuiceBerryPoison: - effects: - - !type:SatiateThirst - - !type:HealthChange - damage: - types: - Poison: 1 - JuiceWatermelon: - effects: - - !type:SatiateThirst - JuicePineapple: - effects: - - !type:SatiateThirst - Nutriment: - effects: - - !type:SatiateHunger - Water: - effects: - - !type:SatiateThirst - hydrationFactor: 2 - Coffee: - effects: - - !type:SatiateThirst - Tea: - effects: - - !type:SatiateThirst - Milk: - effects: - - !type:SatiateThirst - MilkSpoiled: - effects: - - !type:SatiateThirst - hydrationFactor: -2 - MilkSoy: - effects: - - !type:SatiateThirst - hydrationFactor: 2 # soyboys stay winning - MilkOat: - effects: - - !type:SatiateThirst - hydrationFactor: 2 # oatboys stay winning - Cola: - effects: - - !type:SatiateThirst - hydrationFactor: 0.5 # sodaboys stay losing - FourteenLoko: - effects: - - !type:SatiateThirst - hydrationFactor: 2 - - !type:HealthChange - damage: - types: - Poison: 1 + - type: Metabolizer + metabolizerTypes: [Human] + groups: + - id: Food + - id: Drink - type: entity id: OrganHumanLiver @@ -336,270 +166,10 @@ size: 1 compatibility: Biological - type: Metabolizer # The liver metabolizes certain chemicals only, like alcohol. - metabolisms: # TODO there needs to be a better way to do this than just add every damn drink - #Basic Alchohol - Ale: - effects: - - !type:SatiateThirst - Beer: - effects: - - !type:SatiateThirst - BlueCuracao: - effects: - - !type:SatiateThirst - Cognac: - effects: - - !type:SatiateThirst - DeadRum: - effects: - - !type:SatiateThirst - Gin: - effects: - - !type:SatiateThirst - Kahlua: - effects: - - !type:SatiateThirst - MelonLiquor: - effects: - - !type:SatiateThirst - NTCahors: - effects: - - !type:SatiateThirst - PoisonWine: - effects: - - !type:SatiateThirst - - !type:HealthChange - damage: - types: - Poison: 1 - Rum: - effects: - - !type:SatiateThirst - Sake: - effects: - - !type:SatiateThirst - Tequila: - effects: - - !type:SatiateThirst - Vermouth: - effects: - - !type:SatiateThirst - Vodka: - effects: - - !type:SatiateThirst - Whiskey: - effects: - - !type:SatiateThirst - Wine: - effects: - - !type:SatiateThirst - - #Mixed Alcohol - - AcidSpit: - effects: - - !type:SatiateThirst - AlliesCocktail: - effects: - - !type:SatiateThirst - Aloe: - effects: - - !type:SatiateThirst - Amasec: - effects: - - !type:SatiateThirst - Andalusia: - effects: - - !type:SatiateThirst - Antifreeze: - effects: - - !type:SatiateThirst - AtomicBomb: - effects: - - !type:SatiateThirst - B52: - effects: - - !type:SatiateThirst - BahamaMama: - effects: - - !type:SatiateThirst - BananaHonk: - effects: - - !type:SatiateThirst - Barefoot: - effects: - - !type:SatiateThirst - BeepskySmash: - effects: - - !type:SatiateThirst - Bilk: - effects: - - !type:SatiateThirst - BlackRussian: - effects: - - !type:SatiateThirst - BloodyMary: - effects: - - !type:SatiateThirst - Booger: - effects: - - !type:SatiateThirst - BraveBull: - effects: - - !type:SatiateThirst - CubaLibre: - effects: - - !type:SatiateThirst - DemonsBlood: - effects: - - !type:SatiateThirst - DevilsKiss: - effects: - - !type:SatiateThirst - DoctorsDelight: - effects: - - !type:SatiateThirst - DriestMartini: - effects: - - !type:SatiateThirst - ErikaSuprise: - effects: - - !type:SatiateThirst - GargleBlaster: - effects: - - !type:SatiateThirst - GinTonic: - effects: - - !type:SatiateThirst - Goldschlager: - effects: - - !type:SatiateThirst - Grog: - effects: - - !type:SatiateThirst - HippiesDelight: - effects: - - !type:SatiateThirst - Hooch: - effects: - - !type:SatiateThirst - IcedBeer: - effects: - - !type:SatiateThirst - IrishCarBomb: - effects: - - !type:SatiateThirst - IrishCream: - effects: - - !type:SatiateThirst - IrishCoffee: - effects: - - !type:SatiateThirst - KiraSpecial: - effects: - - !type:SatiateThirst - Lean: - effects: - - !type:SatiateThirst - LeanShine: # who added this? - effects: - - !type:SatiateThirst - LongIslandIcedTea: - effects: - - !type:SatiateThirst - Manhattan: - effects: - - !type:SatiateThirst - ManhattanProject: - effects: - - !type:SatiateThirst - ManlyDorf: - effects: - - !type:SatiateThirst - Margarita: - effects: - - !type:SatiateThirst - Martini: - effects: - - !type:SatiateThirst - Mead: - effects: - - !type:SatiateThirst - Mojito: - effects: - - !type:SatiateThirst - Moonshine: - effects: - - !type:SatiateThirst - Neurotoxin: - effects: - - !type:SatiateThirst - - !type:HealthChange - damage: - types: - Poison: 1 - Patron: - effects: - - !type:SatiateThirst - RedMead: - effects: - - !type:SatiateThirst - Rewriter: - effects: - - !type:SatiateThirst - Sbiten: - effects: - - !type:SatiateThirst - ScrewdriverCocktail: - effects: - - !type:SatiateThirst - Silencer: - effects: - - !type:SatiateThirst - Singulo: - effects: - - !type:SatiateThirst - SnowWhite: - effects: - - !type:SatiateThirst - Starkist: - effects: - - !type:SatiateThirst - SuiDream: - effects: - - !type:SatiateThirst - TequilaSunrise: - effects: - - !type:SatiateThirst - ThreeMileIsland: - effects: - - !type:SatiateThirst - ToxinsSpecial: - effects: - - !type:SatiateThirst - VodkaMartini: - effects: - - !type:SatiateThirst - VodkaTonic: - effects: - - !type:SatiateThirst - WhiskeyCola: - effects: - - !type:SatiateThirst - WhiskeySoda: - effects: - - !type:SatiateThirst - WhiteRussian: - effects: - - !type:SatiateThirst - FourteenLoko: - effects: - - !type:SatiateThirst - hydrationFactor: 2 - - !type:HealthChange - damage: - types: - Poison: 1 + metabolizerTypes: [Human] + groups: + - id: Alcohol + rateModifier: 0.1 # removes alcohol very slowly along with the stomach removing it as a drink - type: entity id: OrganHumanKidneys @@ -614,5 +184,3 @@ - type: Mechanism size: 1 compatibility: Biological - - diff --git a/Resources/Prototypes/Reagents/Consumable/Drink/alcohol.yml b/Resources/Prototypes/Reagents/Consumable/Drink/alcohol.yml index 3bf2847afb..25dfa28a0d 100644 --- a/Resources/Prototypes/Reagents/Consumable/Drink/alcohol.yml +++ b/Resources/Prototypes/Reagents/Consumable/Drink/alcohol.yml @@ -1,9 +1,12 @@ # Base Alcohol +# TODO MIRROR: drunkenness + - type: reagent id: Absinthe name: absinthe + parent: BaseAlcohol desc: A anise-flavoured spirit derived from botanicals. physicalDesc: strong-smelling color: "#33EE00" @@ -12,6 +15,7 @@ - type: reagent id: Ale name: ale + parent: BaseAlcohol desc: A dark alchoholic beverage made by malted barley and yeast. physicalDesc: bubbly color: "#663100" @@ -20,19 +24,16 @@ - type: reagent id: Beer name: beer + parent: BaseAlcohol desc: An alcoholic beverage made from malted grains, hops, yeast, and water. physicalDesc: bubbly color: "#cfa85f" spritePath: beerglass.rsi - plantMetabolism: - - !type:AdjustNutrition - amount: 0.25 - - !type:AdjustWater - amount: 0.7 - type: reagent id: BlueCuracao name: blue curacao + parent: BaseAlcohol desc: Exotically blue, fruity drink, distilled from oranges. physicalDesc: strong-smelling color: "#0000CD" @@ -41,6 +42,7 @@ - type: reagent id: Cognac name: cognac + parent: BaseAlcohol desc: A sweet and strongly alcoholic drink, twice distilled and left to mature for several years. Classy as fornication. physicalDesc: strong-smelling color: "#AB3C05" @@ -49,6 +51,7 @@ - type: reagent id: DeadRum name: deadrum + parent: BaseAlcohol desc: Distilled alcoholic drink made from saltwater. physicalDesc: strong-smelling color: "#664300" @@ -57,6 +60,7 @@ - type: reagent id: Gin name: gin + parent: BaseAlcohol desc: A distilled alcoholic drink that derives its predominant flavour from juniper berries. physicalDesc: strong-smelling color: "#664300" @@ -65,6 +69,7 @@ - type: reagent id: Kahlua name: kahlua + parent: BaseAlcohol desc: A widely known, Mexican coffee-flavoured liqueur. physicalDesc: cloudy color: "#664300" @@ -73,6 +78,7 @@ - type: reagent id: MelonLiquor name: melon liquor + parent: BaseAlcohol desc: A relatively sweet and fruity 46 proof liquor. physicalDesc: strong-smelling color: "#138808" @@ -81,6 +87,7 @@ - type: reagent id: NTCahors name: NeoTheology Cahors Wine + parent: BaseAlcohol desc: Fortified dessert wine made from cabernet sauvignon, saperavi and other grapes. physicalDesc: strong-smelling color: "#7E4043" @@ -89,14 +96,27 @@ - type: reagent id: PoisonWine name: poison wine + parent: BaseAlcohol desc: Is this even wine? Toxic! Hallucinogenic! Probably consumed in boatloads by your superiors! physicalDesc: strong-smelling color: "#000000" spritePath: pwineglass.rsi + metabolisms: + Drink: + effects: + - !type:SatiateThirst + factor: 2 + Poison: + effects: + - !type:HealthChange + damage: + types: + Poison: 1 - type: reagent id: Rum name: rum + parent: BaseAlcohol desc: Distilled alcoholic drink made from sugarcane byproducts. physicalDesc: strong-smelling color: "#664300" @@ -105,6 +125,7 @@ - type: reagent id: Sake name: sake + parent: BaseAlcohol desc: Alcoholic beverage made by fermenting rice that has been polished. physicalDesc: strong-smelling color: "#DDDDDD" @@ -112,6 +133,7 @@ - type: reagent id: Tequila name: tequila + parent: BaseAlcohol desc: A strong and mildly flavoured, mexican produced spirit. physicalDesc: strong-smelling color: "#d7d1d155" @@ -119,6 +141,7 @@ - type: reagent id: Vermouth name: vermouth + parent: BaseAlcohol desc: Aromatized, fortified white wine flavored with various botanicals. physicalDesc: strong-smelling color: "#91FF91" @@ -127,6 +150,7 @@ - type: reagent id: Vodka name: vodka + parent: BaseAlcohol desc: Clear distilled alcoholic beverage that originates from Poland and Russia. physicalDesc: strong-smelling color: "#d1d1d155" @@ -135,6 +159,7 @@ - type: reagent id: Whiskey name: whiskey + parent: BaseAlcohol desc: A type of distilled alcoholic beverage made from fermented grain mash. physicalDesc: strong-smelling color: "#664300" @@ -143,6 +168,7 @@ - type: reagent id: Wine name: wine + parent: BaseAlcohol desc: An premium alchoholic beverage made from distilled grape juice. physicalDesc: translucent color: "#7E4043" @@ -153,6 +179,7 @@ - type: reagent id: AcidSpit name: acidspit + parent: BaseAlcohol desc: A drink for the daring, can be deadly if incorrectly prepared! physicalDesc: strong-smelling color: "#365000" @@ -161,6 +188,7 @@ - type: reagent id: AlliesCocktail #haha, cock. that's hot name: allies cocktail + parent: BaseAlcohol desc: A drink made from your allies, not as sweet as when made from your enemies. physicalDesc: strong-smelling color: "#00664d" @@ -169,6 +197,7 @@ - type: reagent id: Aloe name: aloe + parent: BaseAlcohol desc: So very, very, very good. physicalDesc: strong-smelling color: "#192c00" @@ -177,6 +206,7 @@ - type: reagent id: Amasec name: amasec + parent: BaseAlcohol desc: Official drink of the Gun Club! physicalDesc: strong-smelling color: "#124da7" @@ -185,6 +215,7 @@ - type: reagent id: Andalusia name: andalusia + parent: BaseAlcohol desc: A nice, strangely named drink. physicalDesc: strong-smelling color: "#665700" @@ -193,6 +224,7 @@ - type: reagent id: Antifreeze name: antifreeze + parent: BaseAlcohol desc: Ultimate refreshment. physicalDesc: translucent color: "#ff7d63" @@ -201,6 +233,7 @@ - type: reagent id: AtomicBomb name: atomic bomb + parent: BaseAlcohol desc: Nuclear proliferation never tasted so good. physicalDesc: cloudy color: "#666300" @@ -209,6 +242,7 @@ - type: reagent id: B52 name: b-52 + parent: BaseAlcohol desc: Coffee, irish cream, and cognac. You will get bombed. physicalDesc: bubbly color: "#664300" @@ -217,6 +251,7 @@ - type: reagent id: BahamaMama name: bahama mama + parent: BaseAlcohol desc: Tropical cocktail. physicalDesc: strong-smelling color: "#FF7F3B" @@ -225,6 +260,7 @@ - type: reagent id: BananaHonk name: banana mama + parent: BaseAlcohol desc: A drink from Clown Heaven. physicalDesc: strong-smelling color: "#ffff91" @@ -233,6 +269,7 @@ - type: reagent id: Barefoot name: barefoot + parent: BaseAlcohol desc: Barefoot and pregnant. physicalDesc: strong-smelling color: "#664300" @@ -241,6 +278,7 @@ - type: reagent id: BeepskySmash name: beepsky smash + parent: BaseAlcohol desc: Deny drinking this and prepare for THE LAW. physicalDesc: strong-smelling color: "#664300" @@ -249,6 +287,7 @@ - type: reagent id: Bilk name: bilk + parent: BaseAlcohol desc: This appears to be beer mixed with milk. Disgusting. physicalDesc: bilky... color: "#895C4C" @@ -257,6 +296,7 @@ - type: reagent id: BlackRussian name: black russian + parent: BaseAlcohol desc: For the lactose-intolerant. Still as classy as a White Russian. physicalDesc: strong-smelling color: "#360000" @@ -265,6 +305,7 @@ - type: reagent id: BloodyMary name: bloody mary + parent: BaseAlcohol desc: A strange yet pleasurable mixture made of vodka, tomato, and lime juice. physicalDesc: strong-smelling color: "#660000" @@ -273,6 +314,7 @@ - type: reagent id: Booger name: booger + parent: BaseAlcohol desc: Ewww... physicalDesc: strong-smelling color: "#8CFF8C" @@ -281,6 +323,7 @@ - type: reagent id: BraveBull name: brave bull + parent: BaseAlcohol desc: It's just as effective as Dutch-Courage! physicalDesc: strong-smelling color: "#664300" @@ -289,6 +332,7 @@ - type: reagent id: CubaLibre name: cuba libre + parent: BaseAlcohol desc: Rum, mixed with cola. Viva la revolucion. physicalDesc: bubbly color: "#3E1B00" @@ -297,6 +341,7 @@ - type: reagent id: DemonsBlood name: demons blood + parent: BaseAlcohol desc: AHHHH!!!! physicalDesc: strong-smelling color: "#a70000" @@ -305,6 +350,7 @@ - type: reagent id: DevilsKiss name: devils kiss + parent: BaseAlcohol desc: Creepy time! physicalDesc: strong-smelling color: "#A68310" @@ -313,6 +359,7 @@ - type: reagent id: DoctorsDelight name: the doctor's delight + parent: BaseAlcohol desc: A gulp a day keeps the MediBot away. That's probably for the best. physicalDesc: strong-smelling color: "#FF8CFF" @@ -321,6 +368,7 @@ - type: reagent id: DriestMartini name: driest martini + parent: BaseAlcohol desc: Only for the experienced. You think you see sand floating in the glass. physicalDesc: strong-smelling color: "#2E6671" @@ -329,6 +377,7 @@ - type: reagent id: ErikaSuprise name: erika suprise + parent: BaseAlcohol desc: The surprise is, it's green! physicalDesc: strong-smelling color: "#2E6671" @@ -337,6 +386,7 @@ - type: reagent id: GargleBlaster name: Pan-Galactic Gargle Blaster + parent: BaseAlcohol desc: Whoah, this stuff looks volatile! physicalDesc: volatile color: "#9cc8b4" @@ -345,6 +395,7 @@ - type: reagent id: GinFizz name: gin fizz + parent: BaseAlcohol desc: Refreshingly lemony, deliciously dry. physicalDesc: strong-smelling color: "#664300" @@ -353,6 +404,7 @@ - type: reagent id: GinTonic name: gin and tonic + parent: BaseAlcohol desc: An all time classic, mild cocktail. physicalDesc: strong-smelling color: "#004166" @@ -361,6 +413,7 @@ - type: reagent id: Goldschlager name: Goldschlager + parent: BaseAlcohol desc: 100 proof cinnamon schnapps, made for alcoholic teen girls on spring break. physicalDesc: strong-smelling color: "#FFFF91" @@ -369,6 +422,7 @@ - type: reagent id: Grog name: grog + parent: BaseAlcohol desc: Watered-down rum, pirate approved! physicalDesc: strong-smelling color: "#664300" @@ -377,6 +431,7 @@ - type: reagent id: HippiesDelight name: hippies delight + parent: BaseAlcohol desc: You just don't get it maaaan. physicalDesc: strong-smelling color: "#6eaa0c" @@ -385,6 +440,7 @@ - type: reagent id: Hooch name: hooch + parent: BaseAlcohol desc: Either someone's failure at cocktail making or attempt in alchohol production. In any case, do you really want to drink that? physicalDesc: strong-smelling color: "#664e00" @@ -393,6 +449,7 @@ - type: reagent id: IcedBeer name: iced beer + parent: BaseAlcohol desc: A beer which is so cold the air around it freezes. physicalDesc: bubbly color: "#664300" @@ -401,6 +458,7 @@ - type: reagent id: IrishCarBomb name: irish car bomb + parent: BaseAlcohol desc: A troubling mixture of irish cream and ale. physicalDesc: bubbly color: "#2E6671" @@ -409,6 +467,7 @@ - type: reagent id: IrishCream name: irish cream + parent: BaseAlcohol desc: Whiskey-imbued cream. What else could you expect from the Irish. physicalDesc: creamy color: "#664300" @@ -417,6 +476,7 @@ - type: reagent id: IrishCoffee name: irish coffee + parent: BaseAlcohol desc: Coffee served with irish cream. Regular cream just isn't the same! physicalDesc: cloudy color: "#664300" @@ -425,6 +485,7 @@ - type: reagent id: KiraSpecial name: kira special + parent: BaseAlcohol desc: Long live the guy who everyone had mistaken for a girl. Baka! physicalDesc: strong-smelling color: "#CCCC99" @@ -433,6 +494,7 @@ - type: reagent id: Lean name: lean + parent: BaseAlcohol desc: Turn up for days. physicalDesc: bubbly color: "#9400D3" @@ -440,6 +502,7 @@ - type: reagent id: LeanShine name: leanshine + parent: BaseAlcohol desc: Lean mixed with moonshine. Turn up for months. physicalDesc: bubbly color: "#9d5fb8" @@ -447,6 +510,7 @@ - type: reagent id: LongIslandIcedTea name: long island iced tea + parent: BaseAlcohol desc: The liquor cabinet, brought together in a delicious mix. Intended for middle-aged alcoholic women only. physicalDesc: strong-smelling color: "#664300" @@ -455,6 +519,7 @@ - type: reagent id: Manhattan name: manhattan + parent: BaseAlcohol desc: The Detective's undercover drink of choice. He never could stomach gin... physicalDesc: strong-smelling color: "#664300" @@ -463,6 +528,7 @@ - type: reagent id: ManhattanProject name: manhattan project + parent: BaseAlcohol desc: A scientist's drink of choice, for pondering ways to blow up the ship. physicalDesc: strong-smelling color: "#664300" @@ -471,6 +537,7 @@ - type: reagent id: ManlyDorf name: manly dorf + parent: BaseAlcohol desc: Beer and Ale, brought together in a delicious mix. Intended for stout dwarves only. physicalDesc: bubbly color: "#664300" @@ -479,6 +546,7 @@ - type: reagent id: Margarita name: margarita + parent: BaseAlcohol desc: On the rocks with salt on the rim. Arriba~! physicalDesc: strong-smelling color: "#8CFF8C" @@ -487,6 +555,7 @@ - type: reagent id: Martini name: classic martini + parent: BaseAlcohol desc: Vermouth with Gin. Not quite how 007 enjoyed it, but still delicious. physicalDesc: strong-smelling color: "#664300" @@ -495,6 +564,7 @@ - type: reagent id: Mead name: mead + parent: BaseAlcohol desc: A Viking's drink, though a cheap one. physicalDesc: strong-smelling color: "#664300" @@ -503,6 +573,7 @@ - type: reagent id: Mojito name: mojito + parent: BaseAlcohol desc: If it's good enough for Spesscuba, it's good enough for you. physicalDesc: strong-smelling color: "#664300" @@ -511,6 +582,7 @@ - type: reagent id: Moonshine name: moonshine + parent: BaseAlcohol desc: Artisanal homemade liquor. What could go wrong? physicalDesc: strong-smelling color: "#d1d7d155" @@ -518,14 +590,26 @@ - type: reagent id: Neurotoxin name: neurotoxin + parent: BaseAlcohol desc: A strong neurotoxin that puts the subject into a death-like state. physicalDesc: strong-smelling color: "#2E2E61" spritePath: neurotoxinglass.rsi + metabolisms: + Drink: + effects: + - !type:SatiateThirst + Poison: + effects: + - !type:HealthChange + damage: + types: + Poison: 1 - type: reagent id: Patron name: patron + parent: BaseAlcohol desc: Tequila with silver in it, a favorite of alcoholic women in the club scene. physicalDesc: metallic color: "#585840" @@ -534,6 +618,7 @@ - type: reagent id: RedMead name: red mead + parent: BaseAlcohol desc: The true Viking's drink! Even though it has a strange red color. physicalDesc: strong-smelling color: "#C73C00" @@ -542,7 +627,8 @@ - type: reagent id: Rewriter name: rewriter - desc: The secret of the sanctuary of the Libarian... + parent: BaseAlcohol + desc: The secret of the sanctuary of the Librarian... physicalDesc: strong-smelling color: "#485000" spritePath: rewriter.rsi @@ -550,6 +636,7 @@ - type: reagent id: Sbiten name: sbiten + parent: BaseAlcohol desc: A spicy Vodka! Might be a little hot for the little guys! physicalDesc: strong-smelling color: "#004166" @@ -558,6 +645,7 @@ - type: reagent id: ScrewdriverCocktail name: screwdriver + parent: BaseAlcohol desc: Vodka, mixed with plain ol' orange juice. The result is surprisingly delicious. physicalDesc: strong-smelling color: "#A68310" @@ -566,6 +654,7 @@ - type: reagent id: Silencer name: silencer + parent: BaseAlcohol desc: A drink from Mime Heaven. physicalDesc: strong-smelling color: "#004666" @@ -574,6 +663,7 @@ - type: reagent id: Singulo name: singulo + parent: BaseAlcohol desc: A blue-space beverage! physicalDesc: strong-smelling color: "#3b0c0c" @@ -582,6 +672,7 @@ - type: reagent id: SnowWhite name: snow white + parent: BaseAlcohol desc: A cold refreshment. physicalDesc: bubbly color: "#FFFFFF" @@ -590,6 +681,7 @@ - type: reagent id: SuiDream name: sui dream + parent: BaseAlcohol desc: 'Comprised of: White soda, blue curacao, melon liquor.' physicalDesc: strong-smelling color: "#00A86B" @@ -598,6 +690,7 @@ - type: reagent id: SyndicateBomb name: syndicate bomb + parent: BaseAlcohol desc: Somebody set us up the bomb! physicalDesc: opaque color: "#2E6660" @@ -606,6 +699,7 @@ - type: reagent id: TequilaSunrise name: tequila sunrise + parent: BaseAlcohol desc: Tequila and orange juice. Much like a Screwdriver, only Mexican. physicalDesc: strong-smelling color: "#FFE48C" @@ -614,6 +708,7 @@ - type: reagent id: ThreeMileIsland name: three mile island iced tea + parent: BaseAlcohol desc: "Made for a woman, strong enough for a man." physicalDesc: strong-smelling color: "#666340" @@ -622,6 +717,7 @@ - type: reagent id: ToxinsSpecial name: toxins special + parent: BaseAlcohol desc: This thing is ON FIRE! CALL THE DAMN SHUTTLE! physicalDesc: strong-smelling color: "#665c00" @@ -630,6 +726,7 @@ - type: reagent id: VodkaMartini name: vodka martini + parent: BaseAlcohol desc: Vodka with Gin. Not quite how 007 enjoyed it, but still delicious. physicalDesc: strong-smelling color: "#004666" @@ -638,6 +735,7 @@ - type: reagent id: VodkaTonic name: vodka tonic + parent: BaseAlcohol desc: For when a gin and tonic isn't russian enough. physicalDesc: strong-smelling color: "#0064C8" @@ -646,6 +744,7 @@ - type: reagent id: WhiskeyCola name: whiskey cola + parent: BaseAlcohol desc: Whiskey, mixed with cola. Surprisingly refreshing. physicalDesc: bubbly color: "#3E1B00" @@ -654,6 +753,7 @@ - type: reagent id: WhiskeySoda name: whiskey soda + parent: BaseAlcohol desc: For the more refined griffon. physicalDesc: strong-smelling color: "#533600" @@ -662,6 +762,7 @@ - type: reagent id: WhiteRussian name: white russian + parent: BaseAlcohol desc: That's just, like, your opinion, man... physicalDesc: strong-smelling color: "#A68340" diff --git a/Resources/Prototypes/Reagents/Consumable/Drink/base_drink.yml b/Resources/Prototypes/Reagents/Consumable/Drink/base_drink.yml new file mode 100644 index 0000000000..123d9e6504 --- /dev/null +++ b/Resources/Prototypes/Reagents/Consumable/Drink/base_drink.yml @@ -0,0 +1,46 @@ +- type: reagent + id: BaseDrink + abstract: true + metabolisms: + Drink: + effects: + - !type:SatiateThirst + factor: 3 + plantMetabolism: + - !type:PlantAdjustNutrition + amount: 0.1 + - !type:PlantAdjustWater + amount: 1 + - !type:PlantAdjustHealth + amount: 0.1 + +- type: reagent + id: BaseSoda + parent: BaseDrink + abstract: true + metabolisms: + Drink: + effects: + - !type:SatiateThirst + factor: 2 + plantMetabolism: + - !type:PlantAdjustNutrition + amount: 0.1 + - !type:PlantAdjustWater + amount: 0.1 + - !type:PlantAdjustHealth + amount: -0.1 + +- type: reagent + id: BaseAlcohol + abstract: true + metabolisms: + Drink: + effects: + - !type:SatiateThirst + factor: 2 + plantMetabolism: + - !type:PlantAdjustNutrition + amount: 0.25 + - !type:PlantAdjustWater + amount: 0.7 diff --git a/Resources/Prototypes/Reagents/Consumable/Drink/drinks.yml b/Resources/Prototypes/Reagents/Consumable/Drink/drinks.yml index 61ce9b1f5b..37cdd50ce3 100644 --- a/Resources/Prototypes/Reagents/Consumable/Drink/drinks.yml +++ b/Resources/Prototypes/Reagents/Consumable/Drink/drinks.yml @@ -1,6 +1,7 @@ - type: reagent id: Coffee name: coffee + parent: BaseDrink desc: A drink made from brewed coffee beans. Contains a moderate amount of caffeine. physicalDesc: aromatic color: "#664300" @@ -11,10 +12,16 @@ desc: The fatty, still liquid part of milk. Why don't you mix this with sum scotch, eh? physicalDesc: creamy color: "#DFD7AF" + metabolisms: + Drink: + effects: + - !type:SatiateThirst + factor: 1 - type: reagent id: CafeLatte name: cafe latte + parent: BaseDrink desc: A nice, strong and tasty beverage while you are reading. physicalDesc: creamy color: "#664300" @@ -23,6 +30,7 @@ - type: reagent id: GreenTea name: green tea + parent: BaseDrink desc: Tasty green tea. physicalDesc: aromatic color: "#C33F00" @@ -31,6 +39,7 @@ - type: reagent id: Grenadine name: grenadine + parent: BaseDrink desc: Not cherry flavored! physicalDesc: dark-red color: "#EA1D26" @@ -39,6 +48,7 @@ - type: reagent id: IcedCoffee name: iced coffee + parent: BaseDrink desc: Coffee and ice, refreshing and cool. physicalDesc: aromatic color: "#102838" @@ -47,6 +57,7 @@ - type: reagent id: IcedGreenTea name: iced green tea + parent: BaseDrink desc: cold green tea. physicalDesc: aromatic color: "#CE4200" @@ -55,6 +66,7 @@ - type: reagent id: IcedTea name: iced tea + parent: BaseDrink desc: No relation to a certain rap artist/actor. physicalDesc: aromatic color: "#104038" @@ -67,6 +79,11 @@ physicalDesc: tart color: "#FFFF00" spritePath: lemonadeglass.rsi + metabolisms: + Drink: + effects: + - !type:SatiateThirst + factor: 2 - type: reagent id: Milk @@ -75,10 +92,15 @@ physicalDesc: opaque color: "#DFDFDF" plantMetabolism: - - !type:AdjustNutrition + - !type:PlantAdjustNutrition amount: 0.1 - - !type:AdjustWater + - !type:PlantAdjustWater amount: 0.9 + metabolisms: + Drink: + effects: + - !type:SatiateThirst + factor: 4 - type: reagent id: MilkOat @@ -86,6 +108,11 @@ desc: Surprisingly tasty. physicalDesc: refreshing color: "#302000" + metabolisms: + Drink: + effects: + - !type:SatiateThirst + factor: 4 - type: reagent id: MilkSoy @@ -93,6 +120,11 @@ desc: Surprisingly tasty. physicalDesc: refreshing color: "#302000" + metabolisms: + Drink: + effects: + - !type:SatiateThirst + factor: 5 # soyboys stay winning - type: reagent id: MilkSpoiled @@ -100,6 +132,11 @@ desc: This milk has gone rancid. physicalDesc: putrid color: "#faffba" + metabolisms: + Drink: + effects: + - !type:SatiateThirst + factor: -2 - type: reagent id: Nothing @@ -107,6 +144,12 @@ desc: Absolutely nothing. physicalDesc: nothing spritePath: nothing.rsi + metabolisms: + Drink: + effects: + - !type:SatiateThirst + factor: 2 + # TODO heal mimes - type: reagent id: NukaCola @@ -115,10 +158,22 @@ physicalDesc: fizzy color: "#100800" spritePath: nuka_colaglass.rsi + metabolisms: + Drink: + effects: + - !type:SatiateThirst + factor: 6 + Poison: + effects: + - !type:HealthChange + damage: + types: + Poison: 1 - type: reagent id: SodaWater name: soda water + parent: BaseDrink desc: A container of club soda. Why not make a scotch and soda? physicalDesc: fizzy color: "#619494" @@ -126,6 +181,7 @@ - type: reagent id: SoyLatte name: soy latte + parent: BaseDrink desc: A coffee drink made with espresso and steamed soy milk. physicalDesc: strong-smelling color: "#664300" @@ -134,6 +190,7 @@ - type: reagent id: Tea name: tea + parent: BaseDrink desc: A drink made by boiling leaves of the tea tree, Camellia sinensis. physicalDesc: aromatic color: "#8a5a3a" @@ -141,6 +198,7 @@ - type: reagent id: TonicWater name: tonic water + parent: BaseDrink desc: It tastes strange but at least the quinine keeps the Space Malaria at bay. physicalDesc: fizzy color: "#0064C8" diff --git a/Resources/Prototypes/Reagents/Consumable/Drink/juice.yml b/Resources/Prototypes/Reagents/Consumable/Drink/juice.yml index 24052a7e95..5ed8eccca2 100644 --- a/Resources/Prototypes/Reagents/Consumable/Drink/juice.yml +++ b/Resources/Prototypes/Reagents/Consumable/Drink/juice.yml @@ -1,6 +1,7 @@ - type: reagent id: JuiceApple name: apple juice + parent: BaseDrink desc: It's a little piece of Eden. physicalDesc: crisp color: "#FDAD01" @@ -8,6 +9,7 @@ - type: reagent id: JuiceBanana name: banana juice + parent: BaseDrink desc: The raw essence of a banana. HONK. physicalDesc: crisp color: "#FFE777" @@ -15,25 +17,29 @@ - type: reagent id: JuiceBerry name: berry juice + parent: BaseDrink desc: A delicious blend of several different kinds of berries. physicalDesc: sweet color: "#660099" -# /datum/reagent/drink/poisonberryjuice/on_mob_life(var/mob/living/M) - -# if(..()) -# return 1 - -# M.adjustToxLoss(1) - - type: reagent id: JuiceBerryPoison name: poison berry juice desc: A surprisingly tasty juice blended from various kinds of very deadly and toxic berries. - physicalDesc: aromatic #maybe should be 'sickly'? + physicalDesc: sickly color: "#6600CC" + metabolisms: + Drink: + effects: + - !type:SatiateThirst + Poison: + effects: + - !type:HealthChange + damage: + types: + Poison: 1 -#TODO: port on_mob_life: restore eyesight +#TODO: restore eyesight #if(..()) #return 1 # M.eye_blurry = max(M.eye_blurry - 1 , 0) @@ -47,6 +53,7 @@ - type: reagent id: JuiceCarrot name: carrot juice + parent: BaseDrink desc: It's like a carrot, but less crunchy. physicalDesc: crisp color: "#FF8820" @@ -54,6 +61,7 @@ - type: reagent id: JuiceGrape name: grape juice + parent: BaseDrink desc: Freshly squeezed juice from red grapes. Quite sweet. physicalDesc: crisp color: "#512284" @@ -61,6 +69,7 @@ - type: reagent id: JuiceLemon name: lemon juice + parent: BaseDrink desc: This juice is VERY sour. physicalDesc: citric color: "#fff690" @@ -68,6 +77,7 @@ - type: reagent id: JuiceLime name: lime juice + parent: BaseDrink desc: The sweet-sour juice of limes. physicalDesc: citric color: "#99bb43" @@ -83,6 +93,7 @@ - type: reagent id: JuiceOrange name: orange juice + parent: BaseDrink desc: Both delicious AND rich in Vitamin C. What more do you need? physicalDesc: citric color: "#E78108" @@ -90,6 +101,7 @@ - type: reagent id: JuicePineapple name: pineapple juice + parent: BaseDrink desc: The delicious juice of a pineapple. physicalDesc: tropical color: yellow @@ -97,6 +109,7 @@ - type: reagent id: JuicePotato name: potato juice + parent: BaseDrink desc: Juice of the potato. Bleh. physicalDesc: starchy color: "#302000" @@ -104,6 +117,7 @@ - type: reagent id: JuiceTomato name: tomato juice + parent: BaseDrink desc: Tomatoes made into juice. What a waste of good tomatoes, huh? physicalDesc: saucey color: "#731008" @@ -111,6 +125,7 @@ - type: reagent id: JuiceWatermelon name: water melon juice + parent: BaseDrink desc: The delicious juice of a watermelon. physicalDesc: sweet color: "#EF3520" diff --git a/Resources/Prototypes/Reagents/Consumable/Drink/soda.yml b/Resources/Prototypes/Reagents/Consumable/Drink/soda.yml index 13f2a90c5f..4b97e26413 100644 --- a/Resources/Prototypes/Reagents/Consumable/Drink/soda.yml +++ b/Resources/Prototypes/Reagents/Consumable/Drink/soda.yml @@ -1,154 +1,99 @@ - type: reagent id: Cola name: cola + parent: BaseSoda desc: A sweet, carbonated soft drink. Caffeine free. physicalDesc: fizzy color: "#422912" - plantMetabolism: - - !type:AdjustNutrition - amount: 0.1 - - !type:AdjustWater - amount: 1 - - !type:AdjustHealth - amount: 0.1 - type: reagent id: ChangelingSting name: changeling sting + parent: BaseSoda desc: You take a tiny sip and feel a burning sensation... physicalDesc: fizzy color: "#2E6671" - plantMetabolism: - - !type:AdjustNutrition - amount: 0.1 - - !type:AdjustWater - amount: 1 - - !type:AdjustHealth - amount: 0.1 - type: reagent id: DrGibb name: Dr. Gibb + parent: BaseSoda desc: A delicious blend of 42 different flavours. physicalDesc: fizzy color: "#102000" - plantMetabolism: - - !type:AdjustNutrition - amount: 0.1 - - !type:AdjustWater - amount: 1 - - !type:AdjustHealth - amount: 0.1 - type: reagent id: EnergyDrink name: Energy Drink + parent: BaseSoda desc: A dose of energy! Nanotrasen is not responsible if you grow avian appendages. physicalDesc: fizzy color: "#ffffbf" - plantMetabolism: - - !type:AdjustNutrition - amount: 0.1 - - !type:AdjustWater - amount: 1 - - !type:AdjustHealth - amount: 0.1 - type: reagent id: GrapeSoda name: grape soda + parent: BaseSoda desc: It's Graaaaaape! physicalDesc: fizzy color: "#ae94a6" - plantMetabolism: - - !type:AdjustNutrition - amount: 0.1 - - !type:AdjustWater - amount: 1 - - !type:AdjustHealth - amount: 0.1 - type: reagent id: LemonLime name: lemon-lime + parent: BaseSoda desc: tangy lime and lemon soda physicalDesc: fizzy color: "#878F00" spritePath: lemonlime.rsi - plantMetabolism: - - !type:AdjustNutrition - amount: 0.1 - - !type:AdjustWater - amount: 1 - - !type:AdjustHealth - amount: 0.1 - type: reagent id: PwrGame name: Pwr Game + parent: BaseSoda desc: The only drink with the PWR that true gamers crave. physicalDesc: fizzy color: "#9385bf" - plantMetabolism: - - !type:AdjustNutrition - amount: 0.1 - - !type:AdjustWater - amount: 1 - - !type:AdjustHealth - amount: 0.1 - type: reagent id: SpaceMountainWind name: Space Mountain Wind + parent: BaseSoda desc: Blows right through you like a space wind. physicalDesc: fizzy color: "#102000" - plantMetabolism: - - !type:AdjustNutrition - amount: 0.1 - - !type:AdjustWater - amount: 1 - - !type:AdjustHealth - amount: 0.1 - type: reagent id: SpaceUp name: Space-Up + parent: BaseSoda desc: Tastes like a hull breach in your mouth. physicalDesc: fizzy color: "#00FF00" - plantMetabolism: - - !type:AdjustNutrition - amount: 0.1 - - !type:AdjustWater - amount: 1 - - !type:AdjustHealth - amount: 0.1 - type: reagent id: Starkist name: starkist + parent: BaseSoda desc: A sweet, orange flavored soft drink. physicalDesc: fizzy color: "#9F3400" - plantMetabolism: - - !type:AdjustNutrition - amount: 0.1 - - !type:AdjustWater - amount: 1 - - !type:AdjustHealth - amount: 0.1 - type: reagent id: FourteenLoko name: Fourteen Loko - desc: A highly processed liquid substance barely-passing intergalatic health standarts for a soft drink. + parent: BaseSoda + desc: A highly processed liquid substance barely-passing intergalatic health standards for a soft drink. physicalDesc: fizzy color: "#deb928" - plantMetabolism: - - !type:AdjustNutrition - amount: 0.1 - - !type:AdjustWater - amount: 1 - - !type:AdjustHealth - amount: 0.1 + metabolisms: + Drink: + effects: + - !type:SatiateThirst + factor: 2 + Poison: + effects: + - !type:HealthChange + damage: + types: + Poison: 1 diff --git a/Resources/Prototypes/Reagents/Consumable/Food/ingredients.yml b/Resources/Prototypes/Reagents/Consumable/Food/ingredients.yml index 438bea61ef..798fe14964 100644 --- a/Resources/Prototypes/Reagents/Consumable/Food/ingredients.yml +++ b/Resources/Prototypes/Reagents/Consumable/Food/ingredients.yml @@ -4,6 +4,11 @@ desc: Used for baking. physicalDesc: powdery color: white + metabolisms: + Food: + effects: + - !type:SatiateHunger + factor: 1 - type: reagent id: Oats @@ -11,12 +16,22 @@ desc: Used for a variety of tasty purposes. physicalDesc: coarse color: tan + metabolisms: + Food: + effects: + - !type:SatiateHunger + factor: 1 - type: reagent id: Enzyme name: universal enzyme desc: Used in cooking various dishes. color: "#009900" + metabolisms: + Food: + effects: + - !type:SatiateHunger + nutritionFactor: 1 - type: reagent id: Egg @@ -24,6 +39,11 @@ desc: Used for baking. physicalDesc: mucus-like color: white + metabolisms: + Food: + effects: + - !type:SatiateHunger + factor: 1 - type: reagent id: Sugar @@ -31,6 +51,11 @@ desc: Tasty spacey sugar! physicalDesc: color: white + metabolisms: + Food: + effects: + - !type:SatiateHunger + factor: 1 - type: reagent id: Blackpepper @@ -38,21 +63,40 @@ desc: Often used to flavor food or make people sneeze. physicalDesc: Grainy. color: black + metabolisms: + Food: + effects: + - !type:SatiateHunger + factor: 1 - type: reagent id: Vinegar name: vinegar desc: Often used to flavor food. color: tan + metabolisms: + Food: + effects: + - !type:SatiateHunger + factor: 1 - type: reagent id: Rice name: rice desc: Hard, small white grains. color: white + metabolisms: + Food: + effects: + - !type:SatiateHunger - type: reagent id: OilOlive name: olive oil desc: Viscous and fragrant. color: olive + metabolisms: + Food: + effects: + - !type:SatiateHunger + factor: 1 diff --git a/Resources/Prototypes/Reagents/Metabolism/metabolism_groups.yml b/Resources/Prototypes/Reagents/Metabolism/metabolism_groups.yml new file mode 100644 index 0000000000..f311b8eb36 --- /dev/null +++ b/Resources/Prototypes/Reagents/Metabolism/metabolism_groups.yml @@ -0,0 +1,18 @@ +# Default human metabolism groups. +- type: metabolismGroup + id: Poison + +- type: metabolismGroup + id: Medicine + +- type: metabolismGroup + id: Narcotic + +- type: metabolismGroup + id: Alcohol + +- type: metabolismGroup + id: Food + +- type: metabolismGroup + id: Drink diff --git a/Resources/Prototypes/Reagents/Metabolism/metabolizer_types.yml b/Resources/Prototypes/Reagents/Metabolism/metabolizer_types.yml new file mode 100644 index 0000000000..c5f9c4a088 --- /dev/null +++ b/Resources/Prototypes/Reagents/Metabolism/metabolizer_types.yml @@ -0,0 +1,5 @@ +# If your species wants to metabolize stuff differently, +# you'll likely have to tag its metabolizers with something other than Human. + +- type: metabolizerType + id: Human diff --git a/Resources/Prototypes/Reagents/botany.yml b/Resources/Prototypes/Reagents/botany.yml index 43ab432f92..19181fb23f 100644 --- a/Resources/Prototypes/Reagents/botany.yml +++ b/Resources/Prototypes/Reagents/botany.yml @@ -5,7 +5,7 @@ color: "#664330" physicalDesc: thick plantMetabolism: - - !type:AdjustNutrition + - !type:PlantAdjustNutrition amount: 1 - type: reagent @@ -15,11 +15,11 @@ color: "#5b406c" physicalDesc: heterogeneous plantMetabolism: - - !type:AdjustNutrition + - !type:PlantAdjustNutrition amount: 1 - - !type:AdjustHealth + - !type:PlantAdjustHealth amount: -0.5 - - !type:AdjustMutationMod + - !type:PlantAdjustMutationMod prob: 0.3 amount: 0.2 @@ -30,9 +30,9 @@ color: "#9e9886" physicalDesc: bubbling plantMetabolism: - - !type:AdjustToxins + - !type:PlantAdjustToxins amount: 4 - - !type:AdjustPests + - !type:PlantAdjustPests amount: -6 - type: reagent @@ -42,13 +42,13 @@ color: "#49002E" physicalDesc: bubbling plantMetabolism: - - !type:AdjustToxins + - !type:PlantAdjustToxins amount: 6 - - !type:AdjustWeeds + - !type:PlantAdjustWeeds amount: -8 - - !type:AdjustHealth + - !type:PlantAdjustHealth amount: -20 - - !type:AdjustMutationMod + - !type:PlantAdjustMutationMod amount: 0.1 - type: reagent @@ -57,14 +57,13 @@ desc: Plant-enhancing hormones, good for increasing potency. color: "#3e901c" physicalDesc: robust - customPlantMetabolism: 0.1 plantMetabolism: - - !type:AdjustNutrition + - !type:PlantAdjustNutrition amount: 0.05 - - !type:AdjustWeeds + - !type:PlantAdjustWeeds prob: 0.025 amount: 1 - - !type:AdjustPests + - !type:PlantAdjustPests prob: 0.025 amount: 1 - !type:RobustHarvest {} @@ -76,9 +75,9 @@ color: "#968395" physicalDesc: bubbling plantMetabolism: - - !type:AdjustToxins + - !type:PlantAdjustToxins amount: 4 - - !type:AdjustWeeds + - !type:PlantAdjustWeeds amount: -6 - type: reagent @@ -88,9 +87,9 @@ color: "#808080" physicalDesc: crystalline plantMetabolism: - - !type:AdjustNutrition + - !type:PlantAdjustNutrition amount: -5 - - !type:AdjustHealth + - !type:PlantAdjustHealth amount: -1 - type: reagent @@ -100,5 +99,5 @@ color: "#C0C0C0" physicalDesc: strong smelling plantMetabolism: - - !type:AdjustHealth + - !type:PlantAdjustHealth amount: -5 diff --git a/Resources/Prototypes/Reagents/chemicals.yml b/Resources/Prototypes/Reagents/chemicals.yml index fb5be33970..1d611c6fbd 100644 --- a/Resources/Prototypes/Reagents/chemicals.yml +++ b/Resources/Prototypes/Reagents/chemicals.yml @@ -7,9 +7,9 @@ boilingPoint: -33.0 meltingPoint: -77.7 plantMetabolism: - - !type:AdjustNutrition + - !type:PlantAdjustNutrition amount: 1 - - !type:AdjustHealth + - !type:PlantAdjustHealth amount: 0.5 - type: reagent @@ -20,19 +20,18 @@ color: "#a1000b" boilingPoint: 55.5 meltingPoint: -50.0 - customPlantMetabolism: 0.1 plantMetabolism: - - !type:AdjustNutrition + - !type:PlantAdjustNutrition amount: 0.1 - - !type:AdjustPests + - !type:PlantAdjustPests prob: 0.1 amount: -1 - - !type:AdjustHealth + - !type:PlantAdjustHealth amount: 0.1 - - !type:AffectGrowth + - !type:PlantAffectGrowth prob: 0.2 amount: 1 - - !type:Diethylamine {} + - !type:PlantDiethylamine {} - type: reagent id: Ethanol @@ -64,11 +63,11 @@ boilingPoint: 340282300000000000000000000000000000000 #Fun fact: Glucose can't boil. So let's just set it to the maximum float value. meltingPoint: 146.0 plantMetabolism: - - !type:AdjustNutrition + - !type:PlantAdjustNutrition amount: 0.1 - - !type:AdjustWeeds + - !type:PlantAdjustWeeds amount: 2 - - !type:AdjustPests + - !type:PlantAdjustPests amount: 2 - type: reagent @@ -80,7 +79,7 @@ meltingPoint: 0.0 boilingPoint: 100.0 plantMetabolism: - - !type:AdjustWater + - !type:PlantAdjustWater amount: 1 - type: reagent @@ -89,10 +88,14 @@ desc: All the vitamins, minerals, and carbohydrates the body needs in pure form. physicalDesc: opaque color: "#664330" + metabolisms: + Food: + effects: + - !type:SatiateHunger plantMetabolism: - - !type:AdjustNutrition + - !type:PlantAdjustNutrition amount: 1 - - !type:AdjustHealth + - !type:PlantAdjustHealth amount: 0.5 - type: reagent @@ -116,11 +119,11 @@ boilingPoint: 78.2 # This isn't a real chemical... meltingPoint: -19.4 plantMetabolism: - - !type:AdjustToxins + - !type:PlantAdjustToxins amount: 20 - - !type:AdjustWeeds + - !type:PlantAdjustWeeds amount: -4 - - !type:AdjustHealth + - !type:PlantAdjustHealth amount: -8 - type: reagent @@ -141,17 +144,17 @@ boilingPoint: 1465.0 meltingPoint: 800.7 plantMetabolism: - - !type:AdjustWater + - !type:PlantAdjustWater amount: -3 - - !type:AdjustNutrition + - !type:PlantAdjustNutrition amount: -0.3 - - !type:AdjustToxins + - !type:PlantAdjustToxins amount: 8 - - !type:AdjustWeeds + - !type:PlantAdjustWeeds amount: -2 - - !type:AdjustPests + - !type:PlantAdjustPests amount: -1 - - !type:AdjustHealth + - !type:PlantAdjustHealth amount: -2 - type: reagent @@ -173,9 +176,9 @@ color: "#cf3600" physicalDesc: opaque plantMetabolism: - - !type:AdjustToxins + - !type:PlantAdjustToxins amount: 10 - - !type:AdjustHealth + - !type:PlantAdjustHealth amount: -5 - type: reagent @@ -187,11 +190,11 @@ boilingPoint: 337.0 meltingPoint: 10.31 plantMetabolism: - - !type:AdjustToxins + - !type:PlantAdjustToxins amount: 10 - - !type:AdjustWeeds + - !type:PlantAdjustWeeds amount: -2 - - !type:AdjustHealth + - !type:PlantAdjustHealth amount: -5 - type: reagent @@ -202,9 +205,8 @@ color: "#00ff5f" boilingPoint: 340282300000000000000000000000000000000 # Ethidium bromide, which doesn't boil. meltingPoint: 261.0 - customPlantMetabolism: 2 plantMetabolism: - - !type:AdjustMutationLevel + - !type:PlantAdjustMutationLevel amount: 1 - type: reagent @@ -215,11 +217,16 @@ color: "#c0e0ff20" boilingPoint: 100.0 meltingPoint: 0.0 + metabolisms: + Drink: + effects: + - !type:SatiateThirst + factor: 4 tileReactions: - !type:ExtinguishTileReaction {} - !type:SpillIfPuddlePresentTileReaction {} plantMetabolism: - - !type:AdjustWater + - !type:PlantAdjustWater amount: 1 - type: reagent @@ -230,6 +237,25 @@ color: "#FAFAFA" boilingPoint: 212.0 #Meth vape when? meltingPoint: 170.0 + metabolisms: + Poison: + effects: + - !type:HealthChange + damage: + types: + Poison: 2.5 + - !type:HealthChange + conditions: + - !type:ReagentThreshold + min: 10 + damage: + types: + Poison: 4 # this is added to the base damage of the meth. + Narcotic: + effects: + - !type:MovespeedModifier + walkSpeedModifier: 1.3 + sprintSpeedModifier: 1.3 - type: reagent id: Iodine @@ -248,6 +274,12 @@ color: "#D2FFFA" boilingPoint: 255.0 meltingPoint: 36.0 + metabolisms: + Narcotic: + effects: + - !type:MovespeedModifier + walkSpeedModifier: 1.2 + sprintSpeedModifier: 1.2 - type: reagent id: Oil diff --git a/Resources/Prototypes/Reagents/elements.yml b/Resources/Prototypes/Reagents/elements.yml index c2bc6011dd..745d719856 100644 --- a/Resources/Prototypes/Reagents/elements.yml +++ b/Resources/Prototypes/Reagents/elements.yml @@ -25,13 +25,13 @@ meltingPoint: -101.5 boilingPoint: -34.04 plantMetabolism: - - !type:AdjustWater + - !type:PlantAdjustWater amount: -0.5 - - !type:AdjustToxins + - !type:PlantAdjustToxins amount: 15 - - !type:AdjustWeeds + - !type:PlantAdjustWeeds amount: -3 - - !type:AdjustHealth + - !type:PlantAdjustHealth amount: -1 - type: reagent @@ -52,13 +52,13 @@ boilingPoint: -188.11 meltingPoint: -219.67 plantMetabolism: - - !type:AdjustWater + - !type:PlantAdjustWater amount: -0.5 - - !type:AdjustToxins + - !type:PlantAdjustToxins amount: 25 - - !type:AdjustWeeds + - !type:PlantAdjustWeeds amount: -4 - - !type:AdjustHealth + - !type:PlantAdjustHealth amount: -2 - type: reagent @@ -142,11 +142,11 @@ meltingPoint: 44.2 boilingPoint: 280.5 plantMetabolism: - - !type:AdjustNutrition + - !type:PlantAdjustNutrition amount: 0.1 - - !type:AdjustWater + - !type:PlantAdjustWater amount: -0.5 - - !type:AdjustWeeds + - !type:PlantAdjustWeeds amount: -2 - type: reagent @@ -157,15 +157,14 @@ color: "#00ff04" meltingPoint: 700.0 boilingPoint: 1737.0 - customPlantMetabolism: 2 plantMetabolism: - - !type:AdjustMutationLevel + - !type:PlantAdjustMutationLevel amount: 0.6 - - !type:AdjustToxins + - !type:PlantAdjustToxins amount: 4 - - !type:AdjustHealth + - !type:PlantAdjustHealth amount: -1.5 - - !type:AdjustMutationMod + - !type:PlantAdjustMutationMod prob: 0.2 amount: 0.1 diff --git a/Resources/Prototypes/Reagents/medicine.yml b/Resources/Prototypes/Reagents/medicine.yml index c49cc13300..d93d6b019d 100644 --- a/Resources/Prototypes/Reagents/medicine.yml +++ b/Resources/Prototypes/Reagents/medicine.yml @@ -18,10 +18,17 @@ desc: A broad-spectrum anti-toxin, which treats toxin damage in the blood stream. Overdosing will cause vomiting, dizzyness and pain. physicalDesc: translucent color: "#3a1d8a" + metabolisms: + Medicine: + effects: + - !type:HealthChange + damage: + types: + Poison: -1 plantMetabolism: - - !type:AdjustToxins + - !type:PlantAdjustToxins amount: -10 - - !type:AdjustHealth + - !type:PlantAdjustHealth amount: 1 - type: reagent @@ -30,6 +37,14 @@ desc: A slightly unstable medication used for the most extreme any serious case of radiation poisoning. Lowers radiation level at over twice the rate Hyronalin does and will heal toxin damage at the same time. Deals very minor brute damage to the patient over time, but the patient's body will typically out-regenerate it easily. physicalDesc: cloudy color: "#bd5902" + metabolisms: + Medicine: + effects: + - !type:HealthChange + damage: + groups: + Toxin: -1 + Brute: 0.5 - type: reagent id: Bicaridine @@ -37,6 +52,13 @@ desc: An analgesic which is highly effective at treating brute damage. It is useful for stabilizing people who have been severely beaten, as well as treating less life-threatening injuries. In the case of bleeding (internal or external), bicaridine will slow down the bleeding heavily. If the dosage exceeds the overdose limit, it'll stop it outright. physicalDesc: opaque color: "#ffaa00" + metabolisms: + Medicine: + effects: + - !type:HealthChange + damage: + groups: + Brute: -2 - type: reagent id: Cryoxadone @@ -45,9 +67,9 @@ physicalDesc: fizzy color: "#0091ff" plantMetabolism: - - !type:AdjustToxins + - !type:PlantAdjustToxins amount: -3 - - !type:AdjustHealth + - !type:PlantAdjustHealth amount: 3 - type: reagent @@ -57,9 +79,9 @@ physicalDesc: bubbly color: "#0666ff" plantMetabolism: - - !type:AdjustToxins + - !type:PlantAdjustToxins amount: -5 - - !type:AdjustHealth + - !type:PlantAdjustHealth amount: 5 - type: reagent @@ -75,6 +97,13 @@ desc: An advanced chemical that is more effective at treating burn damage than Kelotane. physicalDesc: translucent color: "#215263" + metabolisms: + Medicine: + effects: + - !type:HealthChange + damage: + groups: + Burn: -3 - type: reagent id: Dexalin @@ -82,6 +111,13 @@ desc: Used for treating oxygen deprivation. In most cases where it is likely to be needed, the strength of Dexalin Plus will probably be more useful (Results in 1 unit instead of 2). physicalDesc: opaque color: "#0041a8" + metabolisms: + Medicine: + effects: + - !type:HealthChange + damage: + types: + Asphyxiation: -1 - type: reagent id: DexalinPlus @@ -89,6 +125,13 @@ desc: Used in treatment of extreme cases of oxygen deprivation. Even a single unit immediately counters all oxygen loss, which is hugely useful in many circumstances. Any dose beyond this will continue to counter oxygen loss until it is metabolized, essentially removing the need to breathe. physicalDesc: cloudy color: "#4da0bd" + metabolisms: + Medicine: + effects: + - !type:HealthChange + damage: + types: + Asphyxiation: -3 - type: reagent id: Ethylredoxrazine @@ -138,6 +181,13 @@ desc: Treats burn damage and prevents infection. physicalDesc: strong-smelling color: "#bf3d19" + metabolisms: + Medicine: + effects: + - !type:HealthChange + damage: + groups: + Burn: -1 - type: reagent id: Leporazine @@ -194,6 +244,13 @@ desc: Toxic, but treats hallucinations, drowsiness & halves the duration of paralysis, stuns and knockdowns. It is metabolized very slowly. One unit is enough to treat hallucinations; two units is deadly. physicalDesc: pungent color: "#d49a2f" + metabolisms: + Poison: + effects: + - !type:HealthChange + damage: + types: + Poison: 0.5 - type: reagent id: Tramadol @@ -250,8 +307,15 @@ desc: A hallucinogenic compound that is illegal under space law. A synthetic drug derived from Mindbreaker toxin, it blocks some neurological signals to the respiratory system which causes choking. physicalDesc: strong-smelling color: "#5f959c" + metabolisms: + Poison: + effects: + - !type:HealthChange + damage: + types: + Asphyxiation: 4 plantMetabolism: - - !type:AdjustToxins + - !type:PlantAdjustToxins amount: 10 - type: reagent @@ -267,6 +331,13 @@ desc: Temporarily stops respiration and causes tissue damage. Large doses are fatal, and will cause people to pass out very quickly. Dexalin and Dexalin Plus will both remove it, however. physicalDesc: pungent color: "#6b0007" + metabolisms: + Poison: + effects: + - !type:HealthChange + damage: + groups: + Airloss: 7 - type: reagent id: Lipozine @@ -282,7 +353,7 @@ physicalDesc: opaque color: "#77b58e" plantMetabolism: - - !type:AdjustToxins + - !type:PlantAdjustToxins amount: 10 - type: reagent @@ -319,3 +390,13 @@ desc: A soothing milky liquid with an iridescent gleam. A well known conspiracy theory says that it's origins remain a mystery because knowing the secrets of its production would render most commercial pharmaceuticals obsolete. physicalDesc: soothing color: "#fcf7f9" + metabolisms: + Medicine: + effects: + - !type:HealthChange + damage: + groups: + Burn: -2 + Toxin: -2 + Airloss: -2 + Brute: -2