CatStation/Content.Shared/EntityEffects/Effects/Body/ReduceRottingEntityEffectSystem.cs
Pieter-Jan Briers 5168b5f3d4
IoC source gen compatibility (#43863)
* IoC source gen compatibility

Can be merged before or after https://github.com/space-wizards/RobustToolbox/pull/6549 doesn't really matter.

* Missed a spot
2026-05-09 03:29:58 +00:00

36 lines
1.3 KiB
C#

using Content.Shared.Atmos.Rotting;
using Robust.Shared.Prototypes;
namespace Content.Shared.EntityEffects.Effects.Body;
/// <summary>
/// Reduces the rotting timer on an entity by a number of seconds, modified by scale.
/// This cannot increase the amount of seconds a body has rotted.
/// </summary>
/// <inheritdoc cref="EntityEffectSystem{T,TEffect}"/>
public sealed partial class ReduceRottingEntityEffectSystem : EntityEffectSystem<PerishableComponent, ReduceRotting>
{
[Dependency] private SharedRottingSystem _rotting = default!;
protected override void Effect(Entity<PerishableComponent> entity, ref EntityEffectEvent<ReduceRotting> args)
{
var amount = args.Effect.Seconds * args.Scale;
_rotting.ReduceAccumulator(entity, amount);
}
}
/// <inheritdoc cref="EntityEffect"/>
public sealed partial class ReduceRotting : EntityEffectBase<ReduceRotting>
{
/// <summary>
/// Number of seconds removed from the rotting timer.
/// </summary>
[DataField]
public TimeSpan Seconds = TimeSpan.FromSeconds(10);
public override string? EntityEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
=> Loc.GetString("entity-effect-guidebook-reduce-rotting",
("chance", Probability),
("time", Seconds.TotalSeconds));
}