Nerf gasping and reenable metabolism (#2261)

This commit is contained in:
DrSmugleaf
2020-10-14 22:32:06 +02:00
committed by GitHub
parent bd6697b9bb
commit 6bd29b4ed0
5 changed files with 42 additions and 14 deletions

View File

@@ -7,6 +7,8 @@ using Content.Server.Utility;
using Content.Shared.Atmos;
using Content.Shared.GameObjects.Components.Body.Behavior;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.Timing;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
@@ -17,14 +19,20 @@ namespace Content.Server.GameObjects.Components.Body.Behavior
[ComponentReference(typeof(SharedLungBehaviorComponent))]
public class LungBehaviorComponent : SharedLungBehaviorComponent
{
[Dependency] private readonly IGameTiming _gameTiming = default!;
private float _accumulatedFrameTime;
[ViewVariables] private TimeSpan _lastGaspPopupTime;
[ViewVariables] public GasMixture Air { get; set; } = default!;
[ViewVariables] public override float Temperature => Air.Temperature;
[ViewVariables] public override float Volume => Air.Volume;
[ViewVariables] public TimeSpan GaspPopupCooldown { get; private set; }
public override void ExposeData(ObjectSerializer serializer)
{
base.ExposeData(serializer);
@@ -42,11 +50,22 @@ namespace Content.Server.GameObjects.Components.Body.Behavior
Atmospherics.NormalBodyTemperature,
temp => Air.Temperature = temp,
() => Air.Temperature);
serializer.DataReadWriteFunction(
"gaspPopupCooldown",
8f,
delay => GaspPopupCooldown = TimeSpan.FromSeconds(delay),
() => GaspPopupCooldown.TotalSeconds);
}
public override void Gasp()
{
Owner.PopupMessageEveryone(Loc.GetString("Gasp"));
if (_gameTiming.CurTime >= _lastGaspPopupTime + GaspPopupCooldown)
{
_lastGaspPopupTime = _gameTiming.CurTime;
Owner.PopupMessageEveryone(Loc.GetString("Gasp"));
}
Inhale(CycleDelay);
}