SharedStationAiSystem.Light.cs 743 B

12345678910111213141516171819202122232425262728
  1. using Content.Shared.Light.Components;
  2. using Robust.Shared.Serialization;
  3. namespace Content.Shared.Silicons.StationAi;
  4. public abstract partial class SharedStationAiSystem
  5. {
  6. // Handles light toggling.
  7. private void InitializeLight()
  8. {
  9. SubscribeLocalEvent<ItemTogglePointLightComponent, StationAiLightEvent>(OnLight);
  10. }
  11. private void OnLight(EntityUid ent, ItemTogglePointLightComponent component, StationAiLightEvent args)
  12. {
  13. if (args.Enabled)
  14. _toggles.TryActivate(ent, user: args.User);
  15. else
  16. _toggles.TryDeactivate(ent, user: args.User);
  17. }
  18. }
  19. [Serializable, NetSerializable]
  20. public sealed class StationAiLightEvent : BaseStationAiAction
  21. {
  22. public bool Enabled;
  23. }