epic Respiration Rework (#6022)
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using Content.Server.Body.Systems;
|
||||
using Content.Shared.Atmos;
|
||||
using Content.Shared.Damage;
|
||||
using Robust.Shared.Analyzers;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -12,19 +11,26 @@ namespace Content.Server.Body.Components
|
||||
[RegisterComponent, Friend(typeof(RespiratorSystem))]
|
||||
public class RespiratorComponent : Component
|
||||
{
|
||||
[ViewVariables]
|
||||
[DataField("needsGases")]
|
||||
public Dictionary<Gas, float> NeedsGases { get; set; } = new();
|
||||
/// <summary>
|
||||
/// Saturation level. Reduced by CycleDelay each tick.
|
||||
/// Can be thought of as 'how many seconds you have until you start suffocating' in this configuration.
|
||||
/// </summary>
|
||||
[DataField("saturation")]
|
||||
public float Saturation = 5.0f;
|
||||
|
||||
[ViewVariables]
|
||||
[DataField("producesGases")]
|
||||
public Dictionary<Gas, float> ProducesGases { get; set; } = new();
|
||||
/// <summary>
|
||||
/// At what level of saturation will you begin to suffocate?
|
||||
/// </summary>
|
||||
[DataField("suffocationThreshold")]
|
||||
public float SuffocationThreshold;
|
||||
|
||||
[ViewVariables]
|
||||
[DataField("deficitGases")]
|
||||
public Dictionary<Gas, float> DeficitGases { get; set; } = new();
|
||||
[DataField("maxSaturation")]
|
||||
public float MaxSaturation = 5.0f;
|
||||
|
||||
[ViewVariables] public bool Suffocating { get; set; }
|
||||
[DataField("minSaturation")]
|
||||
public float MinSaturation = -5.0f;
|
||||
|
||||
// TODO HYPEROXIA?
|
||||
|
||||
[DataField("damage", required: true)]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
@@ -34,6 +40,36 @@ namespace Content.Server.Body.Components
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public DamageSpecifier DamageRecovery = default!;
|
||||
|
||||
[DataField("gaspPopupCooldown")]
|
||||
public TimeSpan GaspPopupCooldown { get; private set; } = 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;
|
||||
|
||||
[DataField("cycleDelay")]
|
||||
public float CycleDelay = 2.0f;
|
||||
|
||||
public float AccumulatedFrametime;
|
||||
}
|
||||
}
|
||||
|
||||
public enum RespiratorStatus
|
||||
{
|
||||
Inhaling,
|
||||
Exhaling
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user