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:
Gotimanga
2024-04-29 05:13:14 +01:00
committed by GitHub
parent 5f216ef1ee
commit eb41f1da5f
6 changed files with 97 additions and 0 deletions

View File

@@ -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