Grave digging and decomposition (#23646)

* Grave digging and decomposition

* fix

* update based on review comments

* code review

* remove unused field
This commit is contained in:
themias
2024-01-14 11:47:31 -05:00
committed by GitHub
parent 83f96a6766
commit fd7ff690b1
15 changed files with 315 additions and 9 deletions

View File

@@ -185,6 +185,23 @@ public sealed class RottingSystem : EntitySystem
args.Handled = component.CurrentTemperature < Atmospherics.T0C + 0.85f;
}
/// <summary>
/// Is anything speeding up the decay?
/// e.g. buried in a grave
/// TODO: hot temperatures increase rot?
/// </summary>
/// <returns></returns>
private float GetRotRate(EntityUid uid)
{
if (_container.TryGetContainingContainer(uid, out var container) &&
TryComp<ProRottingContainerComponent>(container.Owner, out var rotContainer))
{
return rotContainer.DecayModifier;
}
return 1f;
}
public override void Update(float frameTime)
{
base.Update(frameTime);
@@ -199,7 +216,7 @@ public sealed class RottingSystem : EntitySystem
if (IsRotten(uid) || !IsRotProgressing(uid, perishable))
continue;
perishable.RotAccumulator += perishable.PerishUpdateRate;
perishable.RotAccumulator += perishable.PerishUpdateRate * GetRotRate(uid);
if (perishable.RotAccumulator >= perishable.RotAfter)
{
var rot = AddComp<RottingComponent>(uid);
@@ -216,7 +233,7 @@ public sealed class RottingSystem : EntitySystem
if (!IsRotProgressing(uid, perishable))
continue;
rotting.TotalRotTime += rotting.RotUpdateRate;
rotting.TotalRotTime += rotting.RotUpdateRate * GetRotRate(uid);
if (rotting.DealDamage)
{