Exemplo n.º 1
0
        public void Exhale(EntityUid uid, SharedBodyComponent?body = null)
        {
            if (!Resolve(uid, ref body, false))
            {
                return;
            }

            var organs = _bodySystem.GetComponentsOnMechanisms <LungComponent>(uid, body).ToArray();

            // exhale gas

            var ev = new ExhaleLocationEvent();

            RaiseLocalEvent(uid, ev, false);

            if (ev.Gas == null)
            {
                ev.Gas = _atmosSys.GetContainingMixture(uid, false, true);

                // Walls and grids without atmos comp return null. I guess it makes sense to not be able to exhale in walls,
                // but this also means you cannot exhale on some grids.
                ev.Gas ??= GasMixture.SpaceGas;
            }

            var outGas = new GasMixture(ev.Gas.Volume);

            foreach (var(lung, _) in organs)
            {
                _atmosSys.Merge(outGas, lung.Air);
                lung.Air.Clear();
                lung.LungSolution.RemoveAllSolution();
            }

            _atmosSys.Merge(ev.Gas, outGas);
        }
 private void OnExhaleLocation(EntityUid uid, BeingDisposedComponent component, ExhaleLocationEvent args)
 {
     if (TryComp <DisposalHolderComponent>(component.Holder, out var holder))
     {
         args.Gas = holder.Air;
     }
 }