1
0

PoweredLightVisualsComponent.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using Content.Shared.Light;
  2. using Robust.Shared.Audio;
  3. namespace Content.Client.Light.Visualizers;
  4. [RegisterComponent]
  5. [Access(typeof(PoweredLightVisualizerSystem))]
  6. public sealed partial class PoweredLightVisualsComponent : Component
  7. {
  8. /// <summary>
  9. /// A map of the sprite states used by this visualizer indexed by the light state they correspond to.
  10. /// </summary>
  11. [DataField("spriteStateMap")]
  12. [ViewVariables(VVAccess.ReadOnly)]
  13. public Dictionary<PoweredLightState, string> SpriteStateMap = new()
  14. {
  15. [PoweredLightState.Empty] = "empty",
  16. [PoweredLightState.Off] = "off",
  17. [PoweredLightState.On] = "on",
  18. [PoweredLightState.Broken] = "broken",
  19. [PoweredLightState.Burned] = "burn",
  20. };
  21. #region Blinking
  22. /// <summary>
  23. /// The id used to track the blinking animation for lights.
  24. /// </summary>
  25. [ViewVariables(VVAccess.ReadOnly)]
  26. public const string BlinkingAnimationKey = "poweredlight_blinking";
  27. /// <summary>
  28. /// The minimum length of the base blinking animation (one on-off-on cycle) in seconds.
  29. /// </summary>
  30. [DataField("minBlinkingTime")]
  31. [ViewVariables(VVAccess.ReadWrite)]
  32. public float MinBlinkingAnimationCycleTime = 0.5f;
  33. /// <summary>
  34. /// The maximum length of the base blinking animation (one on-off-on cycle) in seconds.
  35. /// </summary>
  36. [DataField("maxBlinkingTime")]
  37. [ViewVariables(VVAccess.ReadWrite)]
  38. public float MaxBlinkingAnimationCycleTime = 2;
  39. /// <summary>
  40. /// The sound that plays when the blinking animation cycles.
  41. /// </summary>
  42. [DataField("blinkingSound")]
  43. [ViewVariables(VVAccess.ReadWrite)]
  44. public SoundSpecifier? BlinkingSound = default;
  45. /// <summary>
  46. /// Whether or not this light is currently blinking.
  47. /// </summary>
  48. [ViewVariables(VVAccess.ReadWrite)]
  49. public bool IsBlinking;
  50. #endregion Blinking
  51. }