Fix dead mobs falling asleep (#12917)

* Dead or zombie mobs can no longer sleep

* Removed zombie fix

* Moved dead-checks to OnEvent

* Cleanup
This commit is contained in:
Errant
2022-12-15 21:34:43 +00:00
committed by GitHub
parent 2af8ada799
commit e9e6255684
4 changed files with 27 additions and 1 deletions

View File

@@ -178,6 +178,10 @@ namespace Content.Server.Bed.Sleep
if (!HasComp<MobStateComponent>(uid))
return false;
var tryingToSleepEvent = new TryingToSleepEvent(uid);
RaiseLocalEvent(uid, ref tryingToSleepEvent);
if (tryingToSleepEvent.Cancelled) return false;
if (_prototypeManager.TryIndex<InstantActionPrototype>("Sleep", out var sleepAction))
_actionsSystem.RemoveAction(uid, sleepAction);