Fix dead mobs sneezing and coughing (#12919)

* Fix dead mobs sneezing and coughing

* SneezeCough update

* Streamlined Event code, moved dead-check

* cleanup

* I can has merge?

* Shared event for SharedMobStateSystem
This commit is contained in:
Errant
2022-12-16 17:33:34 +00:00
committed by GitHub
parent 23ee8ecaaa
commit 656ce251e4
6 changed files with 59 additions and 27 deletions

View File

@@ -1,21 +1,24 @@
using System.Linq;
using Robust.Shared.Random;
using Content.Server.Body.Systems;
using Content.Server.Chat.Systems;
using Content.Server.Disease;
using Content.Server.Disease.Components;
using Content.Server.Drone.Components;
using Content.Shared.Chemistry.Components;
using Content.Shared.MobState.Components;
using Content.Server.Disease;
using Content.Shared.Inventory;
using Content.Shared.MobState;
using Content.Server.Inventory;
using Robust.Shared.Prototypes;
using Content.Server.Speech;
using Content.Shared.Bed.Sleep;
using Content.Shared.Chemistry.Components;
using Content.Server.Chat.Systems;
using Content.Shared.Bed.Sleep;
using Content.Shared.Damage;
using Content.Shared.Disease.Events;
using Content.Shared.Inventory;
using Content.Shared.MobState;
using Content.Shared.MobState.Components;
using Content.Shared.Weapons.Melee.Events;
using Content.Shared.Zombies;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
namespace Content.Server.Zombies
{
@@ -37,6 +40,7 @@ namespace Content.Server.Zombies
SubscribeLocalEvent<ZombieComponent, MeleeHitEvent>(OnMeleeHit);
SubscribeLocalEvent<ZombieComponent, MobStateChangedEvent>(OnMobState);
SubscribeLocalEvent<ActiveZombieComponent, DamageChangedEvent>(OnDamage);
SubscribeLocalEvent<ActiveZombieComponent, AttemptSneezeCoughEvent>(OnSneeze);
SubscribeLocalEvent<ActiveZombieComponent, TryingToSleepEvent>(OnSleepAttempt);
}
@@ -60,6 +64,11 @@ namespace Content.Server.Zombies
DoGroan(uid, component);
}
private void OnSneeze(EntityUid uid, ActiveZombieComponent component, ref AttemptSneezeCoughEvent args)
{
args.Cancelled = true;
}
private float GetZombieInfectionChance(EntityUid uid, ZombieComponent component)
{
var baseChance = component.MaxZombieInfectionChance;