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

@@ -12,7 +12,7 @@ using Content.Server.Inventory;
using Robust.Shared.Prototypes;
using Content.Server.Speech;
using Content.Server.Chat.Systems;
using Content.Shared.Movement.Systems;
using Content.Shared.Bed.Sleep;
using Content.Shared.Damage;
using Content.Shared.Weapons.Melee.Events;
using Content.Shared.Zombies;
@@ -37,9 +37,15 @@ namespace Content.Server.Zombies
SubscribeLocalEvent<ZombieComponent, MeleeHitEvent>(OnMeleeHit);
SubscribeLocalEvent<ZombieComponent, MobStateChangedEvent>(OnMobState);
SubscribeLocalEvent<ActiveZombieComponent, DamageChangedEvent>(OnDamage);
SubscribeLocalEvent<ActiveZombieComponent, TryingToSleepEvent>(OnSleepAttempt);
}
private void OnSleepAttempt(EntityUid uid, ActiveZombieComponent component, ref TryingToSleepEvent args)
{
args.Cancelled = true;
}
private void OnMobState(EntityUid uid, ZombieComponent component, MobStateChangedEvent args)
{
if (args.CurrentMobState == DamageState.Alive)