InsideCryoPodSystem.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. using Content.Server.Actions;
  2. using Content.Server.Atmos.EntitySystems;
  3. using Content.Server.Body.Systems;
  4. using Content.Server.Medical.Components;
  5. using Content.Shared.Bed.Sleep;
  6. using Content.Shared.Actions;
  7. using Content.Shared.Medical.Cryogenics;
  8. namespace Content.Server.Medical
  9. {
  10. public sealed partial class CryoPodSystem
  11. {
  12. public override void InitializeInsideCryoPod()
  13. {
  14. base.InitializeInsideCryoPod();
  15. // Atmos overrides
  16. SubscribeLocalEvent<InsideCryoPodComponent, InhaleLocationEvent>(OnInhaleLocation);
  17. SubscribeLocalEvent<InsideCryoPodComponent, ExhaleLocationEvent>(OnExhaleLocation);
  18. SubscribeLocalEvent<InsideCryoPodComponent, AtmosExposedGetAirEvent>(OnGetAir);
  19. }
  20. #region Atmos handlers
  21. private void OnGetAir(EntityUid uid, InsideCryoPodComponent component, ref AtmosExposedGetAirEvent args)
  22. {
  23. if (TryComp<CryoPodAirComponent>(Transform(uid).ParentUid, out var cryoPodAir))
  24. {
  25. args.Gas = cryoPodAir.Air;
  26. args.Handled = true;
  27. }
  28. }
  29. private void OnInhaleLocation(EntityUid uid, InsideCryoPodComponent component, InhaleLocationEvent args)
  30. {
  31. if (TryComp<CryoPodAirComponent>(Transform(uid).ParentUid, out var cryoPodAir))
  32. {
  33. args.Gas = cryoPodAir.Air;
  34. }
  35. }
  36. private void OnExhaleLocation(EntityUid uid, InsideCryoPodComponent component, ExhaleLocationEvent args)
  37. {
  38. if (TryComp<CryoPodAirComponent>(Transform(uid).ParentUid, out var cryoPodAir))
  39. {
  40. args.Gas = cryoPodAir.Air;
  41. }
  42. }
  43. #endregion
  44. }
  45. }