-
Notifications
You must be signed in to change notification settings - Fork 3.8k
/
Copy pathStaminaComponent.cs
59 lines (50 loc) · 2.05 KB
/
StaminaComponent.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
using Content.Shared.Alert;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Shared.Damage.Components;
/// <summary>
/// Add to an entity to paralyze it whenever it reaches critical amounts of Stamina DamageType.
/// </summary>
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true), AutoGenerateComponentPause]
public sealed partial class StaminaComponent : Component
{
/// <summary>
/// Have we reached peak stamina damage and been paralyzed?
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField]
public bool Critical;
/// <summary>
/// How much stamina reduces per second.
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField]
public float Decay = 3f;
/// <summary>
/// How much time after receiving damage until stamina starts decreasing.
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField]
public float Cooldown = 3f;
/// <summary>
/// How much stamina damage this entity has taken.
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField]
public float StaminaDamage;
/// <summary>
/// How much stamina damage is required to entire stam crit.
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField]
public float CritThreshold = 100f;
/// <summary>
/// How long will this mob be stunned for?
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField]
public TimeSpan StunTime = TimeSpan.FromSeconds(6);
/// <summary>
/// To avoid continuously updating our data we track the last time we updated so we can extrapolate our current stamina.
/// </summary>
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoNetworkedField]
[AutoPausedField]
public TimeSpan NextUpdate = TimeSpan.Zero;
[DataField]
public ProtoId<AlertPrototype> StaminaAlert = "Stamina";
}