CatStation/Content.Shared/Mobs/Components/MobStateComponent.cs
ScarKy0 1951b00875
Always raise MobStateChanged on client (#45103)
* lets try this

* sub attribute
2026-08-03 01:44:01 +00:00

38 lines
1.2 KiB
C#

using Content.Shared.Damage.Components;
using Content.Shared.Mobs.Systems;
using Robust.Shared.GameStates;
namespace Content.Shared.Mobs.Components;
/// <summary>
/// When attached to an <see cref="DamageableComponent"/>,
/// this component will handle critical and death behaviors for mobs.
/// Additionally, it handles sending effects to clients
/// (such as blur effect for unconsciousness) and managing the health HUD.
/// </summary>
[RegisterComponent, NetworkedComponent]
[AutoGenerateComponentState(true)]
[Access(typeof(MobStateSystem), typeof(MobThresholdSystem))]
public sealed partial class MobStateComponent : Component
{
/// <summary>
/// The current mob state the entity is in.
/// </summary>
[DataField, AutoNetworkedField]
public MobState CurrentState = MobState.Alive; //default mobstate is always the lowest state level
/// <summary>
/// The last state that was received by the client
/// </summary>
[ViewVariables]
public MobState LastReceivedState = MobState.Alive;
[DataField]
[AutoNetworkedField]
public HashSet<MobState> AllowedStates = new()
{
MobState.Alive,
MobState.Critical,
MobState.Dead
};
}