Files
tbd-station-14/Content.Shared/Damage/Components/DamageOnHighSpeedImpactComponent.cs
Leon Friedrich 35ba42af9c Add some tests and fix some miscellaneous bugs (#22836)
* Add some tests and fix some bugs

* Add more helper methods

* remove submodule

* fix merge

* also fix DirtyAll()

* poke
2023-12-28 10:05:20 +11:00

40 lines
1.5 KiB
C#

using Content.Shared.Damage.Systems;
using Robust.Shared.Audio;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Shared.Damage.Components;
/// <summary>
/// Should the entity take damage / be stunned if colliding at a speed above MinimumSpeed?
/// </summary>
[RegisterComponent, Access(typeof(DamageOnHighSpeedImpactSystem))]
public sealed partial class DamageOnHighSpeedImpactComponent : Component
{
[DataField("minimumSpeed"), ViewVariables(VVAccess.ReadWrite)]
public float MinimumSpeed = 20f;
[DataField("speedDamageFactor"), ViewVariables(VVAccess.ReadWrite)]
public float SpeedDamageFactor = 0.5f;
[DataField("soundHit", required: true), ViewVariables(VVAccess.ReadWrite)]
public SoundSpecifier SoundHit = default!;
[DataField("stunChance"), ViewVariables(VVAccess.ReadWrite)]
public float StunChance = 0.25f;
[DataField("stunMinimumDamage"), ViewVariables(VVAccess.ReadWrite)]
public int StunMinimumDamage = 10;
[DataField("stunSeconds"), ViewVariables(VVAccess.ReadWrite)]
public float StunSeconds = 1f;
[DataField("damageCooldown"), ViewVariables(VVAccess.ReadWrite)]
public float DamageCooldown = 2f;
[DataField("lastHit", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)]
public TimeSpan? LastHit;
[DataField("damage", required: true), ViewVariables(VVAccess.ReadWrite)]
public DamageSpecifier Damage = default!;
}