Adding new Cryogenics Reagent - Opporozidone (Attempt 2) (#24074)
* Fixing mistakes * How did I make the same mistake twice --------- Co-authored-by: Kara <lunarautomaton6@gmail.com>
This commit is contained in:
@@ -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<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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Is anything speeding up the decay?
|
||||
/// e.g. buried in a grave
|
||||
|
||||
31
Content.Server/Chemistry/ReagentEffects/ReduceRotting.cs
Normal file
31
Content.Server/Chemistry/ReagentEffects/ReduceRotting.cs
Normal file
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Reduces the rotting accumulator on the patient, making them revivable.
|
||||
/// </summary>
|
||||
[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<RottingSystem>();
|
||||
|
||||
rottingSys.ReduceAccumulator(args.SolutionEntity, TimeSpan.FromSeconds(RottingAmount));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user