BeingDisposedSystem.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using Content.Server.Atmos.EntitySystems;
  2. using Content.Server.Body.Systems;
  3. using Content.Server.Disposal.Unit.Components;
  4. namespace Content.Server.Disposal.Unit.EntitySystems;
  5. public sealed class BeingDisposedSystem : EntitySystem
  6. {
  7. public override void Initialize()
  8. {
  9. base.Initialize();
  10. SubscribeLocalEvent<BeingDisposedComponent, InhaleLocationEvent>(OnInhaleLocation);
  11. SubscribeLocalEvent<BeingDisposedComponent, ExhaleLocationEvent>(OnExhaleLocation);
  12. SubscribeLocalEvent<BeingDisposedComponent, AtmosExposedGetAirEvent>(OnGetAir);
  13. }
  14. private void OnGetAir(EntityUid uid, BeingDisposedComponent component, ref AtmosExposedGetAirEvent args)
  15. {
  16. if (TryComp<DisposalHolderComponent>(component.Holder, out var holder))
  17. {
  18. args.Gas = holder.Air;
  19. args.Handled = true;
  20. }
  21. }
  22. private void OnInhaleLocation(EntityUid uid, BeingDisposedComponent component, InhaleLocationEvent args)
  23. {
  24. if (TryComp<DisposalHolderComponent>(component.Holder, out var holder))
  25. {
  26. args.Gas = holder.Air;
  27. }
  28. }
  29. private void OnExhaleLocation(EntityUid uid, BeingDisposedComponent component, ExhaleLocationEvent args)
  30. {
  31. if (TryComp<DisposalHolderComponent>(component.Holder, out var holder))
  32. {
  33. args.Gas = holder.Air;
  34. }
  35. }
  36. }