Give player species slight passive regen (#20638)

* Implementation

* Reviews
This commit is contained in:
LankLTE
2023-10-07 12:34:32 -07:00
committed by GitHub
parent 99a4ee9da5
commit d691ddae64
3 changed files with 104 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
using Content.Shared.Mobs;
using Content.Shared.FixedPoint;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
using Robust.Shared.GameStates;
namespace Content.Shared.Damage.Components;
/// <summary>
/// Passively damages the entity on a specified interval.
/// </summary>
[RegisterComponent, NetworkedComponent]
public sealed partial class PassiveDamageComponent : Component
{
/// <summary>
/// The entitys' states that passive damage will apply in
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public List<MobState> AllowedStates = new();
/// <summary>
/// Damage / Healing per interval dealt to the entity every interval
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public DamageSpecifier Damage = new();
/// <summary>
/// Delay between damage events in seconds
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public float Interval = 1f;
/// <summary>
/// The maximum HP the damage will be given to. If 0, disabled.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public FixedPoint2 DamageCap = 0;
[DataField("nextDamage", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)]
public TimeSpan NextDamage = TimeSpan.Zero;
}