BaseSolutionInjectOnEventComponent.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using Content.Shared.FixedPoint;
  2. using Content.Shared.Inventory;
  3. namespace Content.Server.Chemistry.Components;
  4. /// <summary>
  5. /// Base class for components that inject a solution into a target's bloodstream in response to an event.
  6. /// </summary>
  7. public abstract partial class BaseSolutionInjectOnEventComponent : Component
  8. {
  9. /// <summary>
  10. /// How much solution to remove from this entity per target when transferring.
  11. /// </summary>
  12. /// <remarks>
  13. /// Note that this amount is per target, so the total amount removed will be
  14. /// multiplied by the number of targets hit.
  15. /// </remarks>
  16. [DataField]
  17. public FixedPoint2 TransferAmount = FixedPoint2.New(1);
  18. [ViewVariables(VVAccess.ReadWrite)]
  19. public float TransferEfficiency { get => _transferEfficiency; set => _transferEfficiency = Math.Clamp(value, 0, 1); }
  20. /// <summary>
  21. /// Proportion of the <see cref="TransferAmount"/> that will actually be injected
  22. /// into the target's bloodstream. The rest is lost.
  23. /// 0 means none of the transferred solution will enter the bloodstream.
  24. /// 1 means the entire amount will enter the bloodstream.
  25. /// </summary>
  26. [DataField("transferEfficiency")]
  27. private float _transferEfficiency = 1f;
  28. /// <summary>
  29. /// Solution to inject from.
  30. /// </summary>
  31. [DataField]
  32. public string Solution = "default";
  33. /// <summary>
  34. /// Whether this will inject through hardsuits or not.
  35. /// </summary>
  36. [DataField]
  37. public bool PierceArmor = true;
  38. /// <summary>
  39. /// Contents of popup message to display to the attacker when injection
  40. /// fails due to the target wearing a hardsuit.
  41. /// </summary>
  42. /// <remarks>
  43. /// Passed values: $weapon and $target
  44. /// </remarks>
  45. [DataField]
  46. public LocId BlockedByHardsuitPopupMessage = "melee-inject-failed-hardsuit";
  47. /// <summary>
  48. /// If anything covers any of these slots then the injection fails.
  49. /// </summary>
  50. [DataField]
  51. public SlotFlags BlockSlots = SlotFlags.NONE;
  52. }