1
0

TargetingComponent.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // SPDX-FileCopyrightText: 2024 Piras314 <p1r4s@proton.me>
  2. // SPDX-FileCopyrightText: 2024 gluesniffler <159397573+gluesniffler@users.noreply.github.com>
  3. // SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
  4. //
  5. // SPDX-License-Identifier: AGPL-3.0-or-later
  6. using Robust.Shared.GameStates;
  7. namespace Content.Shared._Shitmed.Targeting;
  8. /// <summary>
  9. /// Controls entity limb targeting for actions.
  10. /// </summary>
  11. [RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
  12. public sealed partial class TargetingComponent : Component
  13. {
  14. [ViewVariables, AutoNetworkedField]
  15. public TargetBodyPart Target = TargetBodyPart.Torso;
  16. /// <summary>
  17. /// What odds does the entity have of targeting each body part?
  18. /// </summary>
  19. [DataField]
  20. public Dictionary<TargetBodyPart, float> TargetOdds = new()
  21. {
  22. { TargetBodyPart.Head, 0.1f },
  23. { TargetBodyPart.Torso, 0.3f },
  24. { TargetBodyPart.Groin, 0.1f },
  25. { TargetBodyPart.LeftArm, 0.1f },
  26. { TargetBodyPart.LeftHand, 0.05f },
  27. { TargetBodyPart.RightArm, 0.1f },
  28. { TargetBodyPart.RightHand, 0.05f },
  29. { TargetBodyPart.LeftLeg, 0.1f },
  30. { TargetBodyPart.LeftFoot, 0.05f },
  31. { TargetBodyPart.RightLeg, 0.1f },
  32. { TargetBodyPart.RightFoot, 0.05f }
  33. };
  34. /// <summary>
  35. /// What is the current integrity of each body part?
  36. /// </summary>
  37. [ViewVariables, AutoNetworkedField]
  38. public Dictionary<TargetBodyPart, TargetIntegrity> BodyStatus = new()
  39. {
  40. { TargetBodyPart.Head, TargetIntegrity.Healthy },
  41. { TargetBodyPart.Torso, TargetIntegrity.Healthy },
  42. { TargetBodyPart.Groin, TargetIntegrity.Healthy },
  43. { TargetBodyPart.LeftArm, TargetIntegrity.Healthy },
  44. { TargetBodyPart.LeftHand, TargetIntegrity.Healthy },
  45. { TargetBodyPart.RightArm, TargetIntegrity.Healthy },
  46. { TargetBodyPart.RightHand, TargetIntegrity.Healthy },
  47. { TargetBodyPart.LeftLeg, TargetIntegrity.Healthy },
  48. { TargetBodyPart.LeftFoot, TargetIntegrity.Healthy },
  49. { TargetBodyPart.RightLeg, TargetIntegrity.Healthy },
  50. { TargetBodyPart.RightFoot, TargetIntegrity.Healthy }
  51. };
  52. /// <summary>
  53. /// What noise does the entity play when swapping targets?
  54. /// </summary>
  55. [DataField]
  56. public string SwapSound = "/Audio/Effects/toggleoncombat.ogg";
  57. }