using Content.Shared.Alert; using Robust.Shared.GameStates; using Robust.Shared.Prototypes; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; namespace Content.Shared.Damage.Components; /// /// Add to an entity to paralyze it whenever it reaches critical amounts of Stamina DamageType. /// [RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true), AutoGenerateComponentPause] public sealed partial class StaminaComponent : Component { /// /// Have we reached peak stamina damage and been paralyzed? /// [ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField] public bool Critical; /// /// How much stamina reduces per second. /// [ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField] public float Decay = 3f; /// /// How much time after receiving damage until stamina starts decreasing. /// [ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField] public float Cooldown = 3f; /// /// How much stamina damage this entity has taken. /// [ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField] public float StaminaDamage; /// /// How much stamina damage is required to entire stam crit. /// [ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField] public float CritThreshold = 100f; /// /// A dictionary of active stamina drains, with the key being the source of the drain, /// DrainRate how much it changes per tick, and ModifiesSpeed if it should slow down the user. /// [DataField, AutoNetworkedField] public Dictionary ActiveDrains = new(); /// /// How long will this mob be stunned for? /// [ViewVariables(VVAccess.ReadWrite), DataField] public TimeSpan StunTime = TimeSpan.FromSeconds(6); /// /// To avoid continuously updating our data we track the last time we updated so we can extrapolate our current stamina. /// [DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoNetworkedField] [AutoPausedField] public TimeSpan NextUpdate = TimeSpan.Zero; /// /// Minimum factor of the crit threshold that the mob must receive in stamina damage in order to start slowing down. /// [DataField, AutoNetworkedField] public float SlowdownThresholdFactor = 0.5f; /// /// Speed multiplier for entities that are slowed down due to low stamina. Multiplied by how close the mob is to stamcrit. /// [DataField, AutoNetworkedField] public float SlowdownMultiplier = 0.75f; [DataField] public ProtoId StaminaAlert = "Stamina"; }