TemperatureComponent.cs 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. using Content.Shared.Alert;
  2. using Content.Shared.Atmos;
  3. using Content.Shared.Damage;
  4. using Content.Shared.FixedPoint;
  5. using Robust.Shared.Prototypes;
  6. namespace Content.Server.Temperature.Components;
  7. /// <summary>
  8. /// Handles changing temperature,
  9. /// informing others of the current temperature,
  10. /// and taking fire damage from high temperature.
  11. /// </summary>
  12. [RegisterComponent]
  13. public sealed partial class TemperatureComponent : Component
  14. {
  15. /// <summary>
  16. /// Surface temperature which is modified by the environment.
  17. /// </summary>
  18. [DataField, ViewVariables(VVAccess.ReadWrite)]
  19. public float CurrentTemperature = Atmospherics.T20C;
  20. [DataField, ViewVariables(VVAccess.ReadWrite)]
  21. public float HeatDamageThreshold = 360f;
  22. [DataField, ViewVariables(VVAccess.ReadWrite)]
  23. public float ColdDamageThreshold = 260f;
  24. /// <summary>
  25. /// Overrides HeatDamageThreshold if the entity's within a parent with the TemperatureDamageThresholdsComponent component.
  26. /// </summary>
  27. [DataField, ViewVariables(VVAccess.ReadWrite)]
  28. public float? ParentHeatDamageThreshold;
  29. /// <summary>
  30. /// Overrides ColdDamageThreshold if the entity's within a parent with the TemperatureDamageThresholdsComponent component.
  31. /// </summary>
  32. [DataField, ViewVariables(VVAccess.ReadWrite)]
  33. public float? ParentColdDamageThreshold;
  34. /// <summary>
  35. /// Heat capacity per kg of mass.
  36. /// </summary>
  37. [DataField, ViewVariables(VVAccess.ReadWrite)]
  38. public float SpecificHeat = 50f;
  39. /// <summary>
  40. /// How well does the air surrounding you merge into your body temperature?
  41. /// </summary>
  42. [DataField, ViewVariables(VVAccess.ReadWrite)]
  43. public float AtmosTemperatureTransferEfficiency = 0.1f;
  44. [DataField, ViewVariables(VVAccess.ReadWrite)]
  45. public DamageSpecifier ColdDamage = new();
  46. [DataField, ViewVariables(VVAccess.ReadWrite)]
  47. public DamageSpecifier HeatDamage = new();
  48. /// <summary>
  49. /// Temperature won't do more than this amount of damage per second.
  50. /// </summary>
  51. /// <remarks>
  52. /// Okay it genuinely reaches this basically immediately for a plasma fire.
  53. /// </remarks>
  54. [DataField, ViewVariables(VVAccess.ReadWrite)]
  55. public FixedPoint2 DamageCap = FixedPoint2.New(8);
  56. /// <summary>
  57. /// Used to keep track of when damage starts/stops. Useful for logs.
  58. /// </summary>
  59. [DataField]
  60. public bool TakingDamage;
  61. [DataField]
  62. public ProtoId<AlertPrototype> HotAlert = "Hot";
  63. [DataField]
  64. public ProtoId<AlertPrototype> ColdAlert = "Cold";
  65. }