Nerf gasping and reenable metabolism (#2261)
This commit is contained in:
@@ -7,6 +7,8 @@ using Content.Server.Utility;
|
|||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos;
|
||||||
using Content.Shared.GameObjects.Components.Body.Behavior;
|
using Content.Shared.GameObjects.Components.Body.Behavior;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.Interfaces.Timing;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
@@ -17,14 +19,20 @@ namespace Content.Server.GameObjects.Components.Body.Behavior
|
|||||||
[ComponentReference(typeof(SharedLungBehaviorComponent))]
|
[ComponentReference(typeof(SharedLungBehaviorComponent))]
|
||||||
public class LungBehaviorComponent : SharedLungBehaviorComponent
|
public class LungBehaviorComponent : SharedLungBehaviorComponent
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||||
|
|
||||||
private float _accumulatedFrameTime;
|
private float _accumulatedFrameTime;
|
||||||
|
|
||||||
|
[ViewVariables] private TimeSpan _lastGaspPopupTime;
|
||||||
|
|
||||||
[ViewVariables] public GasMixture Air { get; set; } = default!;
|
[ViewVariables] public GasMixture Air { get; set; } = default!;
|
||||||
|
|
||||||
[ViewVariables] public override float Temperature => Air.Temperature;
|
[ViewVariables] public override float Temperature => Air.Temperature;
|
||||||
|
|
||||||
[ViewVariables] public override float Volume => Air.Volume;
|
[ViewVariables] public override float Volume => Air.Volume;
|
||||||
|
|
||||||
|
[ViewVariables] public TimeSpan GaspPopupCooldown { get; private set; }
|
||||||
|
|
||||||
public override void ExposeData(ObjectSerializer serializer)
|
public override void ExposeData(ObjectSerializer serializer)
|
||||||
{
|
{
|
||||||
base.ExposeData(serializer);
|
base.ExposeData(serializer);
|
||||||
@@ -42,11 +50,22 @@ namespace Content.Server.GameObjects.Components.Body.Behavior
|
|||||||
Atmospherics.NormalBodyTemperature,
|
Atmospherics.NormalBodyTemperature,
|
||||||
temp => Air.Temperature = temp,
|
temp => Air.Temperature = temp,
|
||||||
() => Air.Temperature);
|
() => Air.Temperature);
|
||||||
|
|
||||||
|
serializer.DataReadWriteFunction(
|
||||||
|
"gaspPopupCooldown",
|
||||||
|
8f,
|
||||||
|
delay => GaspPopupCooldown = TimeSpan.FromSeconds(delay),
|
||||||
|
() => GaspPopupCooldown.TotalSeconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Gasp()
|
public override void Gasp()
|
||||||
{
|
{
|
||||||
Owner.PopupMessageEveryone(Loc.GetString("Gasp"));
|
if (_gameTiming.CurTime >= _lastGaspPopupTime + GaspPopupCooldown)
|
||||||
|
{
|
||||||
|
_lastGaspPopupTime = _gameTiming.CurTime;
|
||||||
|
Owner.PopupMessageEveryone(Loc.GetString("Gasp"));
|
||||||
|
}
|
||||||
|
|
||||||
Inhale(CycleDelay);
|
Inhale(CycleDelay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
UpdatesBefore.Add(typeof(SharedMetabolismSystem));
|
UpdatesBefore.Add(typeof(MetabolismSystem));
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update(float frameTime)
|
public override void Update(float frameTime)
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
UpdatesBefore.Add(typeof(SharedMetabolismSystem));
|
UpdatesBefore.Add(typeof(MetabolismSystem));
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update(float frameTime)
|
public override void Update(float frameTime)
|
||||||
|
|||||||
20
Content.Server/GameObjects/EntitySystems/MetabolismSystem.cs
Normal file
20
Content.Server/GameObjects/EntitySystems/MetabolismSystem.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
using Content.Server.GameObjects.Components.Metabolism;
|
||||||
|
using JetBrains.Annotations;
|
||||||
|
using Robust.Shared.GameObjects.Systems;
|
||||||
|
|
||||||
|
namespace Content.Server.GameObjects.EntitySystems
|
||||||
|
{
|
||||||
|
[UsedImplicitly]
|
||||||
|
public class MetabolismSystem : EntitySystem
|
||||||
|
{
|
||||||
|
public override void Update(float frameTime)
|
||||||
|
{
|
||||||
|
base.Update(frameTime);
|
||||||
|
|
||||||
|
foreach (var metabolism in ComponentManager.EntityQuery<MetabolismComponent>())
|
||||||
|
{
|
||||||
|
metabolism.Update(frameTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
using JetBrains.Annotations;
|
|
||||||
using Robust.Shared.GameObjects.Systems;
|
|
||||||
|
|
||||||
namespace Content.Shared.GameObjects.EntitySystems
|
|
||||||
{
|
|
||||||
[UsedImplicitly]
|
|
||||||
public class SharedMetabolismSystem : EntitySystem
|
|
||||||
{
|
|
||||||
// TODO move metabolism updates here from body entity system
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user