Files
tbd-station-14/Content.Shared/Mobs/Components/MobStateComponent.cs
Alfred Baumann 5b8468c9d8 Mobs auto state handlers (#26957)
* Autogenerate MobStateComponentState

* changed CurrentState to DataField, updated DataField attribute for AllowedStates

* Update Content.Shared/Mobs/Components/MobStateComponent.cs

* Update Content.Shared/Mobs/Components/MobStateComponent.cs

---------

Co-authored-by: BuildTools <unconfigured@null.spigotmc.org>
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
2024-04-17 20:00:05 +10:00

34 lines
1.1 KiB
C#

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]
[AutoGenerateComponentState]
[Access(typeof(MobStateSystem), typeof(MobThresholdSystem))]
public sealed partial class MobStateComponent : Component
{
//default mobstate is always the lowest state level
[AutoNetworkedField, ViewVariables]
public MobState CurrentState { get; set; } = MobState.Alive;
[DataField]
[AutoNetworkedField]
public HashSet<MobState> AllowedStates = new()
{
MobState.Alive,
MobState.Critical,
MobState.Dead
};
}
}