mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 21:48:58 +03:00
Uses the following Cherry-Picks: https://github.com/space-wizards/space-station-14/pull/26994 https://github.com/space-wizards/space-station-14/pull/26518 https://github.com/space-wizards/space-station-14/pull/26279 https://github.com/space-wizards/space-station-14/pull/24946 https://github.com/space-wizards/space-station-14/pull/27188 Requires: https://github.com/Simple-Station/Einstein-Engines/pull/535 https://github.com/Simple-Station/Einstein-Engines/pull/534 --------- Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> Co-authored-by: Jake Huxell <JakeHuxell@pm.me> Co-authored-by: Tayrtahn <tayrtahn@gmail.com> Co-authored-by: 0x6273 <0x40@keemail.me> Co-authored-by: DEATHB4DEFEAT <zachcaffee@outlook.com>
80 lines
2.4 KiB
C#
80 lines
2.4 KiB
C#
using Content.Server.Body.Systems;
|
|
using Content.Shared.Damage;
|
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
|
|
|
|
namespace Content.Server.Body.Components
|
|
{
|
|
[RegisterComponent, Access(typeof(RespiratorSystem))]
|
|
public sealed partial class RespiratorComponent : Component
|
|
{
|
|
/// <summary>
|
|
/// The next time that this body will inhale or exhale.
|
|
/// </summary>
|
|
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
|
|
public TimeSpan NextUpdate;
|
|
|
|
/// <summary>
|
|
/// The interval between updates. Each update is either inhale or exhale,
|
|
/// so a full cycle takes twice as long.
|
|
/// </summary>
|
|
[DataField]
|
|
public TimeSpan UpdateInterval = TimeSpan.FromSeconds(2);
|
|
|
|
/// <summary>
|
|
/// Saturation level. Reduced by UpdateInterval each tick.
|
|
/// Can be thought of as 'how many seconds you have until you start suffocating' in this configuration.
|
|
/// </summary>
|
|
[DataField]
|
|
public float Saturation = 5.0f;
|
|
|
|
/// <summary>
|
|
/// At what level of saturation will you begin to suffocate?
|
|
/// </summary>
|
|
[DataField]
|
|
public float SuffocationThreshold;
|
|
|
|
[DataField]
|
|
public float MaxSaturation = 5.0f;
|
|
|
|
[DataField]
|
|
public float MinSaturation = -2.0f;
|
|
|
|
// TODO HYPEROXIA?
|
|
|
|
[DataField(required: true)]
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
public DamageSpecifier Damage = default!;
|
|
|
|
[DataField(required: true)]
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
public DamageSpecifier DamageRecovery = default!;
|
|
|
|
[DataField]
|
|
public TimeSpan GaspPopupCooldown = TimeSpan.FromSeconds(8);
|
|
|
|
[ViewVariables]
|
|
public TimeSpan LastGaspPopupTime;
|
|
|
|
/// <summary>
|
|
/// How many cycles in a row has the mob been under-saturated?
|
|
/// </summary>
|
|
[ViewVariables]
|
|
public int SuffocationCycles = 0;
|
|
|
|
/// <summary>
|
|
/// How many cycles in a row does it take for the suffocation alert to pop up?
|
|
/// </summary>
|
|
[ViewVariables]
|
|
public int SuffocationCycleThreshold = 3;
|
|
|
|
[ViewVariables]
|
|
public RespiratorStatus Status = RespiratorStatus.Inhaling;
|
|
}
|
|
}
|
|
|
|
public enum RespiratorStatus
|
|
{
|
|
Inhaling,
|
|
Exhaling
|
|
}
|