private void OnGetAir(EntityUid uid, BeingDisposedComponent component, ref AtmosExposedGetAirEvent args)
 {
     if (TryComp <DisposalHolderComponent>(component.Holder, out var holder))
     {
         args.Gas = holder.Air;
     }
 }
Пример #2
0
    public GasMixture?GetContainingMixture(EntityUid uid, bool ignoreExposed = false, bool excite = false, TransformComponent?transform = null)
    {
        if (!ignoreExposed)
        {
            // Used for things like disposals/cryo to change which air people are exposed to.
            var ev = new AtmosExposedGetAirEvent(uid, excite);

            // Give the entity itself a chance to handle this.
            RaiseLocalEvent(uid, ref ev, false);

            if (ev.Handled)
            {
                return(ev.Gas);
            }

            // We need to get the parent now, so we need the transform... If the parent is invalid, we can't do much else.
            if (!Resolve(uid, ref transform) || !transform.ParentUid.IsValid() || transform.MapUid == null)
            {
                return(GetTileMixture(null, null, Vector2i.Zero, excite));
            }

            // Give the parent entity a chance to handle the event...
            RaiseLocalEvent(transform.ParentUid, ref ev, false);

            if (ev.Handled)
            {
                return(ev.Gas);
            }
        }
        // Oops, we did a little bit of code duplication...
        else if (!Resolve(uid, ref transform))
        {
            return(GetTileMixture(null, null, Vector2i.Zero, excite));
        }


        var gridUid  = transform.GridUid;
        var mapUid   = transform.MapUid;
        var position = _transformSystem.GetGridOrMapTilePosition(uid, transform);

        return(GetTileMixture(gridUid, mapUid, position, excite));
    }