2023-01-13 16:57:10 -08:00
|
|
|
using Content.Shared.Damage;
|
|
|
|
|
using Content.Shared.Mobs.Systems;
|
|
|
|
|
using Robust.Shared.GameStates;
|
|
|
|
|
using Robust.Shared.Serialization;
|
|
|
|
|
|
|
|
|
|
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]
|
2024-04-17 12:00:05 +02:00
|
|
|
[AutoGenerateComponentState]
|
2023-01-13 16:57:10 -08:00
|
|
|
[Access(typeof(MobStateSystem), typeof(MobThresholdSystem))]
|
2023-08-22 18:14:33 -07:00
|
|
|
public sealed partial class MobStateComponent : Component
|
2023-01-13 16:57:10 -08:00
|
|
|
{
|
|
|
|
|
//default mobstate is always the lowest state level
|
2024-04-17 12:00:05 +02:00
|
|
|
[AutoNetworkedField, ViewVariables]
|
|
|
|
|
public MobState CurrentState { get; set; } = MobState.Alive;
|
2023-01-13 16:57:10 -08:00
|
|
|
|
2024-04-17 12:00:05 +02:00
|
|
|
[DataField]
|
|
|
|
|
[AutoNetworkedField]
|
|
|
|
|
public HashSet<MobState> AllowedStates = new()
|
2023-01-13 16:57:10 -08:00
|
|
|
{
|
|
|
|
|
MobState.Alive,
|
|
|
|
|
MobState.Critical,
|
|
|
|
|
MobState.Dead
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|