InsideCryoPodSystem.cs 1.6 KB

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