Revert "Revert "epic Respiration Rework"" (#6527)
This commit is contained in:
@@ -11,7 +11,7 @@ using Robust.Shared.ViewVariables;
|
||||
namespace Content.Server.Body.Components
|
||||
{
|
||||
[RegisterComponent, Friend(typeof(BloodstreamSystem))]
|
||||
public class BloodstreamComponent : Component, IGasMixtureHolder
|
||||
public class BloodstreamComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// Max volume of internal solution storage
|
||||
@@ -24,9 +24,5 @@ namespace Content.Server.Body.Components
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public Solution Solution = default!;
|
||||
|
||||
[ViewVariables]
|
||||
public GasMixture Air { get; set; } = new(6)
|
||||
{ Temperature = Atmospherics.NormalBodyTemperature };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.Atmos;
|
||||
using Content.Server.Body.Systems;
|
||||
using Content.Shared.Atmos;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Robust.Shared.Analyzers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
@@ -12,11 +13,6 @@ namespace Content.Server.Body.Components;
|
||||
[RegisterComponent, Friend(typeof(LungSystem))]
|
||||
public class LungComponent : Component
|
||||
{
|
||||
public float AccumulatedFrametime;
|
||||
|
||||
[ViewVariables]
|
||||
public TimeSpan LastGaspPopupTime;
|
||||
|
||||
[DataField("air")]
|
||||
public GasMixture Air { get; set; } = new()
|
||||
{
|
||||
@@ -24,19 +20,9 @@ public class LungComponent : Component
|
||||
Temperature = Atmospherics.NormalBodyTemperature
|
||||
};
|
||||
|
||||
[DataField("gaspPopupCooldown")]
|
||||
public TimeSpan GaspPopupCooldown { get; private set; } = TimeSpan.FromSeconds(8);
|
||||
[DataField("validReagentGases", required: true)]
|
||||
public HashSet<Gas> ValidGases = default!;
|
||||
|
||||
[ViewVariables]
|
||||
public LungStatus Status { get; set; }
|
||||
|
||||
[DataField("cycleDelay")]
|
||||
public float CycleDelay { get; set; } = 2;
|
||||
}
|
||||
|
||||
public enum LungStatus
|
||||
{
|
||||
None = 0,
|
||||
Inhaling,
|
||||
Exhaling
|
||||
public Solution LungSolution = default!;
|
||||
}
|
||||
|
||||
@@ -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