2023-11-09 01:43:27 +00:00
|
|
|
using Content.Shared.Damage.Systems;
|
2022-07-29 14:13:12 +12:00
|
|
|
using Robust.Shared.Audio;
|
2024-01-10 22:38:24 +01:00
|
|
|
using Robust.Shared.GameStates;
|
2023-08-02 12:32:44 +03:00
|
|
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
|
2020-08-07 16:22:32 +02:00
|
|
|
|
2023-11-09 01:43:27 +00:00
|
|
|
namespace Content.Shared.Damage.Components;
|
2023-08-02 12:32:44 +03:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Should the entity take damage / be stunned if colliding at a speed above MinimumSpeed?
|
|
|
|
|
/// </summary>
|
2024-01-10 22:38:24 +01:00
|
|
|
[RegisterComponent, NetworkedComponent, Access(typeof(DamageOnHighSpeedImpactSystem))]
|
2023-08-22 18:14:33 -07:00
|
|
|
public sealed partial class DamageOnHighSpeedImpactComponent : Component
|
2020-08-07 16:22:32 +02:00
|
|
|
{
|
2023-08-02 12:32:44 +03:00
|
|
|
[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)]
|
2023-12-27 18:05:20 -05:00
|
|
|
public TimeSpan? LastHit;
|
2023-08-02 12:32:44 +03:00
|
|
|
|
|
|
|
|
[DataField("damage", required: true), ViewVariables(VVAccess.ReadWrite)]
|
|
|
|
|
public DamageSpecifier Damage = default!;
|
2020-08-07 16:22:32 +02:00
|
|
|
}
|