BarotraumaComponent.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using Content.Shared.Alert;
  2. using Content.Shared.Damage;
  3. using Content.Shared.FixedPoint;
  4. using Robust.Shared.Prototypes;
  5. namespace Content.Server.Atmos.Components
  6. {
  7. /// <summary>
  8. /// Barotrauma: injury because of changes in air pressure.
  9. /// </summary>
  10. [RegisterComponent]
  11. public sealed partial class BarotraumaComponent : Component
  12. {
  13. [DataField("damage", required: true)]
  14. [ViewVariables(VVAccess.ReadWrite)]
  15. public DamageSpecifier Damage = default!;
  16. [DataField("maxDamage")]
  17. [ViewVariables(VVAccess.ReadWrite)]
  18. public FixedPoint2 MaxDamage = 200;
  19. /// <summary>
  20. /// Used to keep track of when damage starts/stops. Useful for logs.
  21. /// </summary>
  22. public bool TakingDamage = false;
  23. /// <summary>
  24. /// These are the inventory slots that are checked for pressure protection. If a slot is missing protection, no protection is applied.
  25. /// </summary>
  26. [DataField("protectionSlots")]
  27. public List<string> ProtectionSlots = new() { "head", "outerClothing" };
  28. /// <summary>
  29. /// Cached pressure protection values
  30. /// </summary>
  31. [ViewVariables]
  32. public float HighPressureMultiplier = 1f;
  33. [ViewVariables]
  34. public float HighPressureModifier = 0f;
  35. [ViewVariables]
  36. public float LowPressureMultiplier = 1f;
  37. [ViewVariables]
  38. public float LowPressureModifier = 0f;
  39. /// <summary>
  40. /// Whether the entity is immuned to pressure (i.e possess the PressureImmunity component)
  41. /// </summary>
  42. [ViewVariables(VVAccess.ReadWrite)]
  43. public bool HasImmunity = false;
  44. [DataField]
  45. public ProtoId<AlertPrototype> HighPressureAlert = "HighPressure";
  46. [DataField]
  47. public ProtoId<AlertPrototype> LowPressureAlert = "LowPressure";
  48. [DataField]
  49. public ProtoId<AlertCategoryPrototype> PressureAlertCategory = "Pressure";
  50. }
  51. }