StationAiSystem.Airlock.cs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. using Content.Shared.Doors.Components;
  2. using Content.Shared.Electrocution;
  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. private readonly ResPath _aiActionsRsi = new ResPath("/Textures/Interface/Actions/actions_ai.rsi");
  9. private void InitializeAirlock()
  10. {
  11. SubscribeLocalEvent<DoorBoltComponent, GetStationAiRadialEvent>(OnDoorBoltGetRadial);
  12. SubscribeLocalEvent<AirlockComponent, GetStationAiRadialEvent>(OnEmergencyAccessGetRadial);
  13. SubscribeLocalEvent<ElectrifiedComponent, GetStationAiRadialEvent>(OnDoorElectrifiedGetRadial);
  14. }
  15. private void OnDoorBoltGetRadial(Entity<DoorBoltComponent> ent, ref GetStationAiRadialEvent args)
  16. {
  17. args.Actions.Add(
  18. new StationAiRadial
  19. {
  20. Sprite = ent.Comp.BoltsDown
  21. ? new SpriteSpecifier.Rsi(_aiActionsRsi, "unbolt_door")
  22. : new SpriteSpecifier.Rsi(_aiActionsRsi, "bolt_door"),
  23. Tooltip = ent.Comp.BoltsDown
  24. ? Loc.GetString("bolt-open")
  25. : Loc.GetString("bolt-close"),
  26. Event = new StationAiBoltEvent
  27. {
  28. Bolted = !ent.Comp.BoltsDown,
  29. }
  30. }
  31. );
  32. }
  33. private void OnEmergencyAccessGetRadial(Entity<AirlockComponent> ent, ref GetStationAiRadialEvent args)
  34. {
  35. args.Actions.Add(
  36. new StationAiRadial
  37. {
  38. Sprite = ent.Comp.EmergencyAccess
  39. ? new SpriteSpecifier.Rsi(_aiActionsRsi, "emergency_off")
  40. : new SpriteSpecifier.Rsi(_aiActionsRsi, "emergency_on"),
  41. Tooltip = ent.Comp.EmergencyAccess
  42. ? Loc.GetString("emergency-access-off")
  43. : Loc.GetString("emergency-access-on"),
  44. Event = new StationAiEmergencyAccessEvent
  45. {
  46. EmergencyAccess = !ent.Comp.EmergencyAccess,
  47. }
  48. }
  49. );
  50. }
  51. private void OnDoorElectrifiedGetRadial(Entity<ElectrifiedComponent> ent, ref GetStationAiRadialEvent args)
  52. {
  53. args.Actions.Add(
  54. new StationAiRadial
  55. {
  56. Sprite = ent.Comp.Enabled
  57. ? new SpriteSpecifier.Rsi(_aiActionsRsi, "door_overcharge_off")
  58. : new SpriteSpecifier.Rsi(_aiActionsRsi, "door_overcharge_on"),
  59. Tooltip = ent.Comp.Enabled
  60. ? Loc.GetString("electrify-door-off")
  61. : Loc.GetString("electrify-door-on"),
  62. Event = new StationAiElectrifiedEvent
  63. {
  64. Electrified = !ent.Comp.Enabled,
  65. }
  66. }
  67. );
  68. }
  69. }