NPCMeleeCombatComponent.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. namespace Content.Server.NPC.Components;
  2. /// <summary>
  3. /// Added to NPCs whenever they're in melee combat so they can be handled by the dedicated system.
  4. /// </summary>
  5. [RegisterComponent]
  6. public sealed partial class NPCMeleeCombatComponent : Component
  7. {
  8. /// <summary>
  9. /// If the target is moving what is the chance for this NPC to miss.
  10. /// </summary>
  11. [ViewVariables(VVAccess.ReadWrite)]
  12. public float MissChance;
  13. [ViewVariables]
  14. public EntityUid Target;
  15. [ViewVariables]
  16. public CombatStatus Status = CombatStatus.Normal;
  17. }
  18. public enum CombatStatus : byte
  19. {
  20. /// <summary>
  21. /// The target isn't in LOS anymore.
  22. /// </summary>
  23. NotInSight,
  24. /// <summary>
  25. /// Due to some generic reason we are unable to attack the target.
  26. /// </summary>
  27. Unspecified,
  28. /// <summary>
  29. /// Set if we can't reach the target for whatever reason.
  30. /// </summary>
  31. TargetUnreachable,
  32. /// <summary>
  33. /// If the target is outside of our melee range.
  34. /// </summary>
  35. TargetOutOfRange,
  36. /// <summary>
  37. /// Set if the weapon we were assigned is no longer valid.
  38. /// </summary>
  39. NoWeapon,
  40. /// <summary>
  41. /// No dramas.
  42. /// </summary>
  43. Normal,
  44. }