using Content.Shared.ActionBlocker;
using Content.Shared.Damage;
using Content.Shared.Hands.Components;
-using Content.Shared.Mobs;
using Content.Shared.Tag;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
base.Initialize();
SubscribeLocalEvent<DoAfterComponent, DamageChangedEvent>(OnDamage);
SubscribeLocalEvent<DoAfterComponent, EntityUnpausedEvent>(OnUnpaused);
- SubscribeLocalEvent<DoAfterComponent, MobStateChangedEvent>(OnStateChanged);
SubscribeLocalEvent<DoAfterComponent, ComponentGetState>(OnDoAfterGetState);
SubscribeLocalEvent<DoAfterComponent, ComponentHandleState>(OnDoAfterHandleState);
}
Dirty(uid, component);
}
- private void OnStateChanged(EntityUid uid, DoAfterComponent component, MobStateChangedEvent args)
- {
- if (args.NewMobState != MobState.Dead || args.NewMobState != MobState.Critical)
- return;
-
- foreach (var doAfter in component.DoAfters.Values)
- {
- InternalCancel(doAfter, component);
- }
- Dirty(uid, component);
- }
-
/// <summary>
/// Cancels DoAfter if it breaks on damage and it meets the threshold
/// </summary>