1
0

MobStateComponent.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. using Content.Shared.Damage;
  2. using Content.Shared.Mobs.Systems;
  3. using Robust.Shared.GameStates;
  4. using Robust.Shared.Serialization;
  5. namespace Content.Shared.Mobs.Components
  6. {
  7. /// <summary>
  8. /// When attached to an <see cref="DamageableComponent"/>,
  9. /// this component will handle critical and death behaviors for mobs.
  10. /// Additionally, it handles sending effects to clients
  11. /// (such as blur effect for unconsciousness) and managing the health HUD.
  12. /// </summary>
  13. [RegisterComponent]
  14. [NetworkedComponent]
  15. [AutoGenerateComponentState]
  16. [Access(typeof(MobStateSystem), typeof(MobThresholdSystem))]
  17. public sealed partial class MobStateComponent : Component
  18. {
  19. //default mobstate is always the lowest state level
  20. [AutoNetworkedField, ViewVariables]
  21. public MobState CurrentState { get; set; } = MobState.Alive;
  22. [DataField]
  23. [AutoNetworkedField]
  24. public HashSet<MobState> AllowedStates = new()
  25. {
  26. MobState.Alive,
  27. MobState.Critical,
  28. MobState.Dead
  29. };
  30. }
  31. }