Fixes sleepwalking (#12522)

closes https://github.com/space-wizards/space-station-14/issues/12404
This commit is contained in:
keronshb
2022-11-12 22:36:32 -05:00
committed by GitHub
parent 35015795a4
commit 71b2cf221f

View File

@@ -10,6 +10,7 @@ using Content.Shared.IdentityManagement;
using Content.Shared.Interaction;
using Content.Shared.MobState;
using Content.Shared.MobState.Components;
using Content.Shared.Slippery;
using Content.Shared.Stunnable;
using Content.Shared.Verbs;
using Robust.Shared.Audio;
@@ -39,6 +40,7 @@ namespace Content.Server.Bed.Sleep
SubscribeLocalEvent<SleepingComponent, GetVerbsEvent<AlternativeVerb>>(AddWakeVerb);
SubscribeLocalEvent<SleepingComponent, InteractHandEvent>(OnInteractHand);
SubscribeLocalEvent<SleepingComponent, ExaminedEvent>(OnExamined);
SubscribeLocalEvent<SleepingComponent, SlipAttemptEvent>(OnSlip);
SubscribeLocalEvent<ForcedSleepingComponent, ComponentInit>(OnInit);
}
@@ -157,6 +159,12 @@ namespace Content.Server.Bed.Sleep
args.PushMarkup(Loc.GetString("sleep-examined", ("target", Identity.Entity(uid, EntityManager))));
}
}
private void OnSlip(EntityUid uid, SleepingComponent component, SlipAttemptEvent args)
{
args.Cancel();
}
private void OnInit(EntityUid uid, ForcedSleepingComponent component, ComponentInit args)
{
TrySleeping(uid);