StationAiSystem.Light.cs 1021 B

1234567891011121314151617181920212223242526272829303132
  1. using Content.Shared.Item.ItemToggle.Components;
  2. using Content.Shared.Light.Components;
  3. using Content.Shared.Silicons.StationAi;
  4. using Robust.Shared.Utility;
  5. namespace Content.Client.Silicons.StationAi;
  6. public sealed partial class StationAiSystem
  7. {
  8. // Used for surveillance camera lights
  9. private void InitializePowerToggle()
  10. {
  11. SubscribeLocalEvent<ItemTogglePointLightComponent, GetStationAiRadialEvent>(OnLightGetRadial);
  12. }
  13. private void OnLightGetRadial(Entity<ItemTogglePointLightComponent> ent, ref GetStationAiRadialEvent args)
  14. {
  15. if (!TryComp(ent.Owner, out ItemToggleComponent? toggle))
  16. return;
  17. args.Actions.Add(new StationAiRadial()
  18. {
  19. Tooltip = Loc.GetString("toggle-light"),
  20. Sprite = new SpriteSpecifier.Texture(new ResPath("/Textures/Interface/VerbIcons/light.svg.192dpi.png")),
  21. Event = new StationAiLightEvent()
  22. {
  23. Enabled = !toggle.Activated
  24. }
  25. });
  26. }
  27. }