1
0

PoweredLightComponent.cs 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. using Content.Server.Light.EntitySystems;
  2. using Content.Shared.Damage;
  3. using Content.Shared.DeviceLinking;
  4. using Content.Shared.Light.Components;
  5. using Robust.Shared.Audio;
  6. using Robust.Shared.Containers;
  7. using Robust.Shared.Prototypes;
  8. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
  9. namespace Content.Server.Light.Components
  10. {
  11. /// <summary>
  12. /// Component that represents a wall light. It has a light bulb that can be replaced when broken.
  13. /// </summary>
  14. [RegisterComponent, Access(typeof(PoweredLightSystem))]
  15. public sealed partial class PoweredLightComponent : Component
  16. {
  17. [DataField("burnHandSound")]
  18. public SoundSpecifier BurnHandSound = new SoundPathSpecifier("/Audio/Effects/lightburn.ogg");
  19. [DataField("turnOnSound")]
  20. public SoundSpecifier TurnOnSound = new SoundPathSpecifier("/Audio/Machines/light_tube_on.ogg");
  21. [DataField("hasLampOnSpawn", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
  22. public string? HasLampOnSpawn = null;
  23. [DataField("bulb")]
  24. public LightBulbType BulbType;
  25. [DataField("on")]
  26. public bool On = true;
  27. [DataField("ignoreGhostsBoo")]
  28. public bool IgnoreGhostsBoo;
  29. [DataField("ghostBlinkingTime")]
  30. public TimeSpan GhostBlinkingTime = TimeSpan.FromSeconds(10);
  31. [DataField("ghostBlinkingCooldown")]
  32. public TimeSpan GhostBlinkingCooldown = TimeSpan.FromSeconds(60);
  33. [ViewVariables]
  34. public ContainerSlot LightBulbContainer = default!;
  35. [ViewVariables]
  36. public bool CurrentLit;
  37. [ViewVariables]
  38. public bool IsBlinking;
  39. [ViewVariables]
  40. public TimeSpan LastThunk;
  41. [ViewVariables]
  42. public TimeSpan? LastGhostBlink;
  43. [DataField("onPort", customTypeSerializer: typeof(PrototypeIdSerializer<SinkPortPrototype>))]
  44. public string OnPort = "On";
  45. [DataField("offPort", customTypeSerializer: typeof(PrototypeIdSerializer<SinkPortPrototype>))]
  46. public string OffPort = "Off";
  47. [DataField("togglePort", customTypeSerializer: typeof(PrototypeIdSerializer<SinkPortPrototype>))]
  48. public string TogglePort = "Toggle";
  49. /// <summary>
  50. /// How long it takes to eject a bulb from this
  51. /// </summary>
  52. [DataField("ejectBulbDelay")]
  53. public float EjectBulbDelay = 2;
  54. /// <summary>
  55. /// Shock damage done to a mob that hits the light with an unarmed attack
  56. /// </summary>
  57. [DataField("unarmedHitShock")]
  58. public int UnarmedHitShock = 20;
  59. /// <summary>
  60. /// Stun duration applied to a mob that hits the light with an unarmed attack
  61. /// </summary>
  62. [DataField("unarmedHitStun")]
  63. public TimeSpan UnarmedHitStun = TimeSpan.FromSeconds(5);
  64. }
  65. }