Mobstate Refactor (#13389)

Refactors mobstate and moves mob health thresholds to their own component

Co-authored-by: DrSmugleaf <drsmugleaf@gmail.com>
This commit is contained in:
Jezithyr
2023-01-13 16:57:10 -08:00
committed by GitHub
parent 97e4c477bd
commit eeb5b17b34
148 changed files with 1517 additions and 1290 deletions

View File

@@ -2,7 +2,6 @@ using Content.Server.Actions;
using Content.Server.Bed.Components;
using Content.Server.Bed.Sleep;
using Content.Server.Body.Systems;
using Content.Server.MobState;
using Content.Server.Power.Components;
using Content.Server.Power.EntitySystems;
using Content.Shared.Actions.ActionTypes;
@@ -13,6 +12,7 @@ using Content.Shared.Buckle.Components;
using Content.Shared.Damage;
using Content.Shared.Emag.Systems;
using Content.Server.Construction;
using Content.Shared.Mobs.Systems;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;

View File

@@ -8,8 +8,8 @@ using Content.Shared.Damage;
using Content.Shared.Examine;
using Content.Shared.IdentityManagement;
using Content.Shared.Interaction;
using Content.Shared.MobState;
using Content.Shared.MobState.Components;
using Content.Shared.Mobs;
using Content.Shared.Mobs.Components;
using Content.Shared.Slippery;
using Content.Shared.Stunnable;
using Content.Shared.Verbs;
@@ -112,14 +112,14 @@ namespace Content.Server.Bed.Sleep
/// </summary>
private void OnMobStateChanged(EntityUid uid, SleepingComponent component, MobStateChangedEvent args)
{
if (args.CurrentMobState == DamageState.Dead)
if (args.NewMobState == MobState.Dead)
{
RemComp<SpamEmitSoundComponent>(uid);
RemComp<SleepingComponent>(uid);
return;
}
if (TryComp<SpamEmitSoundComponent>(uid, out var spam))
spam.Enabled = (args.CurrentMobState == DamageState.Alive) ? true : false;
spam.Enabled = (args.NewMobState == MobState.Alive) ? true : false;
}
private void AddWakeVerb(EntityUid uid, SleepingComponent component, GetVerbsEvent<AlternativeVerb> args)