Fix sleep wake spam (#13047)
This commit is contained in:
@@ -5,15 +5,23 @@ using Content.Shared.Bed.Sleep;
|
||||
|
||||
namespace Content.Server.Bed.Sleep
|
||||
{
|
||||
public sealed class SharedSleepingSystem : EntitySystem
|
||||
public abstract class SharedSleepingSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly SharedBlindingSystem _blindingSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<SleepingComponent, ComponentInit>(OnInit);
|
||||
SubscribeLocalEvent<SleepingComponent, ComponentShutdown>(OnShutdown);
|
||||
SubscribeLocalEvent<SleepingComponent, SpeakAttemptEvent>(OnSpeakAttempt);
|
||||
SubscribeLocalEvent<SleepingComponent, EntityUnpausedEvent>(OnSleepUnpaused);
|
||||
}
|
||||
|
||||
private void OnSleepUnpaused(EntityUid uid, SleepingComponent component, ref EntityUnpausedEvent args)
|
||||
{
|
||||
component.CoolDownEnd += args.PausedTime;
|
||||
Dirty(component);
|
||||
}
|
||||
|
||||
private void OnInit(EntityUid uid, SleepingComponent component, ComponentInit args)
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using Content.Shared.FixedPoint;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
|
||||
|
||||
namespace Content.Shared.Bed.Sleep;
|
||||
|
||||
@@ -8,9 +10,11 @@ namespace Content.Shared.Bed.Sleep;
|
||||
[NetworkedComponent, RegisterComponent]
|
||||
public sealed class SleepingComponent : Component
|
||||
{
|
||||
// How much damage of any type it takes to wake this entity.
|
||||
/// <summary>
|
||||
/// How much damage of any type it takes to wake this entity.
|
||||
/// </summary>
|
||||
[DataField("wakeThreshold")]
|
||||
public float WakeThreshold = 2;
|
||||
public FixedPoint2 WakeThreshold = FixedPoint2.New(2);
|
||||
|
||||
/// <summary>
|
||||
/// Cooldown time between users hand interaction.
|
||||
@@ -19,5 +23,6 @@ public sealed class SleepingComponent : Component
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public TimeSpan Cooldown = TimeSpan.FromSeconds(1f);
|
||||
|
||||
[DataField("cooldownEnd", customTypeSerializer:typeof(TimeOffsetSerializer))]
|
||||
public TimeSpan CoolDownEnd;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user