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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user