1
0

LightCycleSystem.cs 605 B

12345678910111213141516171819202122
  1. using Content.Shared;
  2. using Content.Shared.Light.Components;
  3. using Content.Shared.Light.EntitySystems;
  4. using Robust.Shared.Random;
  5. namespace Content.Server.Light.EntitySystems;
  6. /// <inheritdoc/>
  7. public sealed class LightCycleSystem : SharedLightCycleSystem
  8. {
  9. [Dependency] private readonly IRobustRandom _random = default!;
  10. protected override void OnCycleMapInit(Entity<LightCycleComponent> ent, ref MapInitEvent args)
  11. {
  12. base.OnCycleMapInit(ent, ref args);
  13. if (ent.Comp.InitialOffset)
  14. {
  15. SetOffset(ent, _random.Next(ent.Comp.Duration));
  16. }
  17. }
  18. }