1
0

NPCRangedCombatComponent.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. using Content.Server.NPC.Systems;
  2. using Robust.Shared.Audio;
  3. namespace Content.Server.NPC.Components;
  4. /// <summary>
  5. /// Added to an NPC doing ranged combat.
  6. /// </summary>
  7. [RegisterComponent]
  8. public sealed partial class NPCRangedCombatComponent : Component
  9. {
  10. [ViewVariables]
  11. public EntityUid Target;
  12. [ViewVariables]
  13. public CombatStatus Status = CombatStatus.Normal;
  14. // Most of the below is to deal with turrets.
  15. /// <summary>
  16. /// If null it will instantly turn.
  17. /// </summary>
  18. [ViewVariables(VVAccess.ReadWrite)] public Angle? RotationSpeed;
  19. /// <summary>
  20. /// Maximum distance, between our rotation and the target's, to consider shooting it.
  21. /// </summary>
  22. [ViewVariables(VVAccess.ReadWrite)]
  23. public Angle AccuracyThreshold = Angle.FromDegrees(30);
  24. /// <summary>
  25. /// How long until the last line of sight check.
  26. /// </summary>
  27. [ViewVariables(VVAccess.ReadWrite)]
  28. public float LOSAccumulator = 0f;
  29. /// <summary>
  30. /// Is the target still considered in LOS since the last check.
  31. /// </summary>
  32. [ViewVariables(VVAccess.ReadWrite)]
  33. public bool TargetInLOS = false;
  34. /// <summary>
  35. /// If true, only opaque objects will block line of sight.
  36. /// </summary>
  37. [ViewVariables(VVAccess.ReadWrite)]
  38. // ReSharper disable once InconsistentNaming
  39. public bool UseOpaqueForLOSChecks = false;
  40. /// <summary>
  41. /// Delay after target is in LOS before we start shooting.
  42. /// </summary>
  43. [ViewVariables(VVAccess.ReadWrite)]
  44. public float ShootDelay = 0.2f;
  45. [ViewVariables(VVAccess.ReadWrite)]
  46. public float ShootAccumulator;
  47. /// <summary>
  48. /// Sound to play if the target enters line of sight.
  49. /// </summary>
  50. [ViewVariables(VVAccess.ReadWrite)]
  51. public SoundSpecifier? SoundTargetInLOS;
  52. }