示例#1
0
    public GasMixture?GetTileMixture(EntityUid?gridUid, EntityUid?mapUid, Vector2i tile, bool excite = false)
    {
        var ev = new GetTileMixtureMethodEvent(gridUid, mapUid, tile, excite);

        // If we've been passed a grid, try to let it handle it.
        if (gridUid.HasValue)
        {
            RaiseLocalEvent(gridUid.Value, ref ev, false);
        }

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

        // We either don't have a grid, or the event wasn't handled.
        // Let the map handle it instead, and also broadcast the event.
        if (mapUid.HasValue)
        {
            RaiseLocalEvent(mapUid.Value, ref ev, true);
        }
        else
        {
            RaiseLocalEvent(ref ev);
        }

        // Default to a space mixture... This is a space game, after all!
        return(ev.Mixture ?? GasMixture.SpaceGas);
    }
    private void MapGetTileMixture(EntityUid uid, MapAtmosphereComponent component, ref GetTileMixtureMethodEvent args)
    {
        if (args.Handled)
        {
            return;
        }

        // Clone the mixture, if possible.
        args.Mixture = component.Mixture?.Clone();
        args.Handled = true;
    }