From eb41f1da5fd6cf5aec3e596dd1b6f381e037836c Mon Sep 17 00:00:00 2001 From: Gotimanga <127038462+Gotimanga@users.noreply.github.com> Date: Mon, 29 Apr 2024 05:13:14 +0100 Subject: [PATCH] Adding new Cryogenics Reagent - Opporozidone (Attempt 2) (#24074) * Fixing mistakes * How did I make the same mistake twice --------- Co-authored-by: Kara --- Content.Server/Atmos/Rotting/RottingSystem.cs | 23 ++++++++++++++ .../Chemistry/ReagentEffects/ReduceRotting.cs | 31 +++++++++++++++++++ .../en-US/guidebook/chemistry/effects.ftl | 6 ++++ .../Locale/en-US/reagents/meta/medicine.ftl | 3 ++ Resources/Prototypes/Reagents/medicine.yml | 21 +++++++++++++ .../Prototypes/Recipes/Reactions/medicine.yml | 13 ++++++++ 6 files changed, 97 insertions(+) create mode 100644 Content.Server/Chemistry/ReagentEffects/ReduceRotting.cs diff --git a/Content.Server/Atmos/Rotting/RottingSystem.cs b/Content.Server/Atmos/Rotting/RottingSystem.cs index 47bac84e0c..dd6387ff44 100644 --- a/Content.Server/Atmos/Rotting/RottingSystem.cs +++ b/Content.Server/Atmos/Rotting/RottingSystem.cs @@ -149,6 +149,29 @@ public sealed class RottingSystem : SharedRottingSystem args.Handled = component.CurrentTemperature < Atmospherics.T0C + 0.85f; } + + public void ReduceAccumulator(EntityUid uid, TimeSpan time) + { + if (!TryComp(uid, out var perishable)) + return; + + if (!TryComp(uid, out var rotting)) + { + perishable.RotAccumulator -= time; + return; + } + var total = (rotting.TotalRotTime + perishable.RotAccumulator) - time; + + if (total < perishable.RotAfter) + { + RemCompDeferred(uid, rotting); + perishable.RotAccumulator = total; + } + + else + rotting.TotalRotTime = total - perishable.RotAfter; + } + /// /// Is anything speeding up the decay? /// e.g. buried in a grave diff --git a/Content.Server/Chemistry/ReagentEffects/ReduceRotting.cs b/Content.Server/Chemistry/ReagentEffects/ReduceRotting.cs new file mode 100644 index 0000000000..cea4f85332 --- /dev/null +++ b/Content.Server/Chemistry/ReagentEffects/ReduceRotting.cs @@ -0,0 +1,31 @@ +using Content.Shared.Chemistry.Reagent; +using JetBrains.Annotations; +using Robust.Shared.Prototypes; +using Content.Server.Atmos.Rotting; + +namespace Content.Server.Chemistry.ReagentEffects +{ + /// + /// Reduces the rotting accumulator on the patient, making them revivable. + /// + [UsedImplicitly] + public sealed partial class ReduceRotting : ReagentEffect + { + [DataField("seconds")] + public double RottingAmount = 10; + + protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) + => Loc.GetString("reagent-effect-guidebook-reduce-rotting", + ("chance", Probability), + ("time", RottingAmount)); + public override void Effect(ReagentEffectArgs args) + { + if (args.Scale != 1f) + return; + + var rottingSys = args.EntityManager.EntitySysManager.GetEntitySystem(); + + rottingSys.ReduceAccumulator(args.SolutionEntity, TimeSpan.FromSeconds(RottingAmount)); + } + } +} diff --git a/Resources/Locale/en-US/guidebook/chemistry/effects.ftl b/Resources/Locale/en-US/guidebook/chemistry/effects.ftl index 94c1376083..5b449cd520 100644 --- a/Resources/Locale/en-US/guidebook/chemistry/effects.ftl +++ b/Resources/Locale/en-US/guidebook/chemistry/effects.ftl @@ -339,6 +339,12 @@ reagent-effect-guidebook-innoculate-zombie-infection = *[other] cure } an ongoing zombie infection, and provides immunity to future infections +reagent-effect-guidebook-reduce-rotting = + { $chance -> + [1] Regenerates + *[other] regenerate + } {NATURALFIXED($time, 3)} {MANY("second", $time)} of rotting + reagent-effect-guidebook-missing = { $chance -> [1] Causes diff --git a/Resources/Locale/en-US/reagents/meta/medicine.ftl b/Resources/Locale/en-US/reagents/meta/medicine.ftl index a0b557e28f..a84e8315fd 100644 --- a/Resources/Locale/en-US/reagents/meta/medicine.ftl +++ b/Resources/Locale/en-US/reagents/meta/medicine.ftl @@ -127,6 +127,9 @@ reagent-desc-pyrazine = Efficiently heals burns from the hottest of fires. Cause reagent-name-insuzine = insuzine reagent-desc-insuzine = Rapidly repairs dead tissue caused by electrocution, but cools you slightly. Completely freezes the patient when overdosed. +reagent-name-opporozidone = opporozidone +reagent-desc-opporozidone= A difficult to synthesize cryogenic drug used to regenerate rotting tissue and brain matter. + reagent-name-necrosol = necrosol reagent-desc-necrosol = A necrotic substance that seems to be able to heal frozen corpses. It can treat and rejuvenate plants when applied in small doses. diff --git a/Resources/Prototypes/Reagents/medicine.yml b/Resources/Prototypes/Reagents/medicine.yml index aae367d9eb..ad0d39a134 100644 --- a/Resources/Prototypes/Reagents/medicine.yml +++ b/Resources/Prototypes/Reagents/medicine.yml @@ -1148,6 +1148,27 @@ conditions: - !type:ReagentThreshold min: 12 + +- type: reagent + id: Opporozidone #Name based of an altered version of the startreck chem "Opporozine" + name: reagent-name-opporozidone + group: Medicine + desc: reagent-desc-opporozidone + physicalDesc: reagent-physical-desc-sickly + flavor: acid + color: "#b5e36d" + worksOnTheDead: true + metabolisms: + Medicine: + effects: + - !type:ReduceRotting + seconds: 20 + conditions: + #Patient must be dead and in a cryo tube (or something cold) + - !type:Temperature + max: 150.0 + - !type:MobStateCondition + mobstate: Dead - type: reagent id: Necrosol diff --git a/Resources/Prototypes/Recipes/Reactions/medicine.yml b/Resources/Prototypes/Recipes/Reactions/medicine.yml index 0a36f869b3..2e9b1d4f85 100644 --- a/Resources/Prototypes/Recipes/Reactions/medicine.yml +++ b/Resources/Prototypes/Recipes/Reactions/medicine.yml @@ -557,6 +557,19 @@ products: Insuzine: 3 +- type: reaction + id: Opporozidone + minTemp: 400 #Maybe if a method of reducing reagent temp exists one day, this could be -50 + reactants: + Cognizine: + amount: 1 + Plasma: + amount: 2 + Doxarubixadone: + amount: 1 + products: + Opporozidone: 3 + - type: reaction id: Necrosol impact: Medium