using Content.Shared.FixedPoint; using Robust.Shared.GameStates; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; namespace Content.Shared._Offbrand.Wounds; [RegisterComponent, NetworkedComponent, AutoGenerateComponentState, AutoGenerateComponentPause] [Access(typeof(PainSystem))] public sealed partial class PainComponent : Component { [DataField, AutoNetworkedField] public float UpdateIntervalMultiplier = 1f; [ViewVariables] public TimeSpan AdjustedUpdateInterval => UpdateInterval * UpdateIntervalMultiplier; /// /// How often the shock is recalculated /// [DataField] public TimeSpan UpdateInterval = TimeSpan.FromSeconds(1); /// /// The current amount of shock, which follows to times the amount of pain from the entity. /// [DataField, AutoNetworkedField] [Access(typeof(PainSystem), Other = AccessPermissions.None)] public FixedPoint2 Shock = FixedPoint2.Zero; /// /// If this entity can feel pain. /// [DataField, AutoNetworkedField] public bool Suppressed; /// /// Multiplier for far above the level of pain the shock will go to /// [DataField(required: true)] public FixedPoint2 PainMultiplier; /// /// How fast the shock can increase per second /// [DataField(required: true)] public double MaxShockIncreasePerSecond; /// /// How fast the shock can decrease per second /// [DataField(required: true)] public double MaxShockDecreasePerSecond; /// /// If the current pain is less than this number times the amount of shock, shock will decrease at double the rate /// [DataField(required: true)] public FixedPoint2 DoubleShockRecoveryThreshold; [DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoNetworkedField, AutoPausedField] public TimeSpan? LastUpdate; } [RegisterComponent] [Access(typeof(PainSystem))] public sealed partial class PainMetabolicRateComponent : Component { [DataField(required: true)] public float QuadraticFactor; [DataField(required: true)] public float LinearFactor; [DataField(required: true)] public float ConstantFactor; } /// /// Raised on an entity after its shock has changed /// [ByRefEvent] public record struct AfterShockChangeEvent; /// /// Raised on an entity to determine if its pain should be suppressed /// [ByRefEvent] public record struct PainSuppressionEvent(bool Suppressed);