Skip to content

Commit

Permalink
Merge pull request #62 from XavierSomething/Opporozidone
Browse files Browse the repository at this point in the history
Added Opporozidone and ReduceRotting Effect
  • Loading branch information
Fansana authored Jul 26, 2024
2 parents bc9b48e + e647f71 commit 9d7719f
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 2 deletions.
30 changes: 30 additions & 0 deletions Content.Server/Chemistry/ReagentEffects/ReduceRotting.cs
Original file line number Diff line number Diff line change
@@ -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
{
/// <summary>
/// Reduces the rotting accumulator on the patient, making them revivable.
/// </summary>
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<RottingSystem>();

rottingSys.ReduceAccumulator(args.SolutionEntity, TimeSpan.FromSeconds(RottingAmount));
}
}
}
24 changes: 23 additions & 1 deletion Content.Shared/Atmos/Rotting/SharedRottingSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Content.Shared.Examine;
using Content.Shared.Examine;
using Content.Shared.IdentityManagement;
using Content.Shared.Mobs.Components;

Expand Down Expand Up @@ -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<PerishableComponent>(uid, out var perishable))
return;

if (!TryComp<RottingComponent>(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;
}
}
8 changes: 7 additions & 1 deletion Resources/Locale/en-US/guidebook/chemistry/effects.ftl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-create-3rd-person =
-create-3rd-person =
{ $chance ->
[1] Creates
*[other] create
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions Resources/Locale/en-US/reagents/meta/medicine.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
21 changes: 21 additions & 0 deletions Resources/Prototypes/Reagents/medicine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions Resources/Prototypes/Recipes/Reactions/medicine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9d7719f

Please sign in to comment.