Fix sleep wake spam (#13047)

This commit is contained in:
metalgearsloth
2023-01-10 22:46:58 +11:00
committed by GitHub
parent a4725ef58e
commit e79d822206
4 changed files with 66 additions and 23 deletions

View File

@@ -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)