1
0

LightBulbComponent.cs 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. using Robust.Shared.Audio;
  2. using Robust.Shared.GameStates;
  3. using Robust.Shared.Serialization;
  4. namespace Content.Shared.Light.Components;
  5. /// <summary>
  6. /// Component that represents a light bulb. Can be broken, or burned, which turns them mostly useless.
  7. /// TODO: Breaking and burning should probably be moved to another component eventually.
  8. /// </summary>
  9. [RegisterComponent, NetworkedComponent]
  10. public sealed partial class LightBulbComponent : Component
  11. {
  12. /// <summary>
  13. /// The color of the lightbulb and the light it produces.
  14. /// </summary>
  15. [DataField("color")]
  16. [ViewVariables(VVAccess.ReadWrite)]
  17. public Color Color = Color.White;
  18. /// <summary>
  19. /// The type of lightbulb. Tube/bulb/etc...
  20. /// </summary>
  21. [DataField("bulb")]
  22. [ViewVariables(VVAccess.ReadWrite)]
  23. public LightBulbType Type = LightBulbType.Tube;
  24. /// <summary>
  25. /// The initial state of the lightbulb.
  26. /// </summary>
  27. [DataField("startingState")]
  28. public LightBulbState State = LightBulbState.Normal;
  29. /// <summary>
  30. /// The temperature the air around the lightbulb is exposed to when the lightbulb burns out.
  31. /// </summary>
  32. [DataField("BurningTemperature")]
  33. [ViewVariables(VVAccess.ReadWrite)]
  34. public int BurningTemperature = 1400;
  35. /// <summary>
  36. /// Relates to how bright the light produced by the lightbulb is.
  37. /// </summary>
  38. [DataField("lightEnergy")]
  39. [ViewVariables(VVAccess.ReadWrite)]
  40. public float LightEnergy = 0.8f;
  41. /// <summary>
  42. /// The maximum radius of the point light source this light produces.
  43. /// </summary>
  44. [DataField("lightRadius")]
  45. [ViewVariables(VVAccess.ReadWrite)]
  46. public float LightRadius = 10;
  47. /// <summary>
  48. /// Relates to the falloff constant of the light produced by the lightbulb.
  49. /// </summary>
  50. [DataField("lightSoftness")]
  51. [ViewVariables(VVAccess.ReadWrite)]
  52. public float LightSoftness = 1;
  53. /// <summary>
  54. /// The amount of power used by the lightbulb when it's active.
  55. /// </summary>
  56. [DataField("PowerUse")]
  57. [ViewVariables(VVAccess.ReadWrite)]
  58. public int PowerUse = 60;
  59. /// <summary>
  60. /// The sound produced when the lightbulb breaks.
  61. /// </summary>
  62. [DataField("breakSound")]
  63. [ViewVariables(VVAccess.ReadWrite)]
  64. public SoundSpecifier BreakSound = new SoundCollectionSpecifier("GlassBreak", AudioParams.Default.WithVolume(-6f));
  65. #region Appearance
  66. /// <summary>
  67. /// The sprite state used when the lightbulb is intact.
  68. /// </summary>
  69. [DataField("normalSpriteState")]
  70. [ViewVariables(VVAccess.ReadWrite)]
  71. public string NormalSpriteState = "normal";
  72. /// <summary>
  73. /// The sprite state used when the lightbulb is broken.
  74. /// </summary>
  75. [DataField("brokenSpriteState")]
  76. [ViewVariables(VVAccess.ReadWrite)]
  77. public string BrokenSpriteState = "broken";
  78. /// <summary>
  79. /// The sprite state used when the lightbulb is burned.
  80. /// </summary>
  81. [DataField("burnedSpriteState")]
  82. [ViewVariables(VVAccess.ReadWrite)]
  83. public string BurnedSpriteState = "burned";
  84. #endregion Appearance
  85. }
  86. [Serializable, NetSerializable]
  87. public enum LightBulbState : byte
  88. {
  89. Normal,
  90. Broken,
  91. Burned,
  92. }
  93. [Serializable, NetSerializable]
  94. public enum LightBulbVisuals : byte
  95. {
  96. State,
  97. Color
  98. }
  99. [Serializable, NetSerializable]
  100. public enum LightBulbType : byte
  101. {
  102. Bulb,
  103. Tube,
  104. }
  105. [Serializable, NetSerializable]
  106. public enum LightBulbVisualLayers : byte
  107. {
  108. Base,
  109. }