From e647f715d516b8904cea4677f1f6725091b89aa3 Mon Sep 17 00:00:00 2001 From: XavierSomething Date: Thu, 25 Jul 2024 01:21:02 -0400 Subject: [PATCH] Added Opporozidone and ReduceRotting effect --- .../Chemistry/ReagentEffects/ReduceRotting.cs | 30 +++++++++++++++++++ .../Atmos/Rotting/SharedRottingSystem.cs | 24 ++++++++++++++- .../en-US/guidebook/chemistry/effects.ftl | 8 ++++- .../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(+), 2 deletions(-) create mode 100644 Content.Server/Chemistry/ReagentEffects/ReduceRotting.cs diff --git a/Content.Server/Chemistry/ReagentEffects/ReduceRotting.cs b/Content.Server/Chemistry/ReagentEffects/ReduceRotting.cs new file mode 100644 index 00000000000..aed4a1b9a80 --- /dev/null +++ b/Content.Server/Chemistry/ReagentEffects/ReduceRotting.cs @@ -0,0 +1,30 @@ +using Content.Server.Stunnable; +using Content.Shared.Chemistry.Reagent; +using Robust.Shared.Prototypes; +using Content.Server.Atmos.Rotting; + +namespace Content.Server.Chemistry.ReagentEffects +{ + /// + /// Reduces the rotting accumulator on the patient, making them revivable. + /// + 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/Content.Shared/Atmos/Rotting/SharedRottingSystem.cs b/Content.Shared/Atmos/Rotting/SharedRottingSystem.cs index 5e1758203a8..242686e78bd 100644 --- a/Content.Shared/Atmos/Rotting/SharedRottingSystem.cs +++ b/Content.Shared/Atmos/Rotting/SharedRottingSystem.cs @@ -1,4 +1,4 @@ -using Content.Shared.Examine; +using Content.Shared.Examine; using Content.Shared.IdentityManagement; using Content.Shared.Mobs.Components; @@ -41,4 +41,26 @@ private void OnExamined(EntityUid uid, RottingComponent component, ExaminedEvent args.PushMarkup(Loc.GetString(description, ("target", Identity.Entity(uid, EntityManager)))); } + + 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; + } } diff --git a/Resources/Locale/en-US/guidebook/chemistry/effects.ftl b/Resources/Locale/en-US/guidebook/chemistry/effects.ftl index b6f45d23862..75670b2bf72 100644 --- a/Resources/Locale/en-US/guidebook/chemistry/effects.ftl +++ b/Resources/Locale/en-US/guidebook/chemistry/effects.ftl @@ -1,4 +1,4 @@ --create-3rd-person = +-create-3rd-person = { $chance -> [1] Creates *[other] create @@ -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 e02d428082f..5ebe0be134a 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 b3b5bcebb31..87b7156ff43 100644 --- a/Resources/Prototypes/Reagents/medicine.yml +++ b/Resources/Prototypes/Reagents/medicine.yml @@ -1121,6 +1121,27 @@ - !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 name: reagent-name-necrosol diff --git a/Resources/Prototypes/Recipes/Reactions/medicine.yml b/Resources/Prototypes/Recipes/Reactions/medicine.yml index a1ca3ea38e2..04fa98da128 100644 --- a/Resources/Prototypes/Recipes/Reactions/medicine.yml +++ b/Resources/Prototypes/Recipes/Reactions/medicine.yml @@ -548,6 +548,19 @@ Insuzine: 3 Ash: 1 +- 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