예제 #1
0
    public bool IsTileSpace(EntityUid?gridUid, EntityUid?mapUid, Vector2i tile, IMapGridComponent?mapGridComp = null)
    {
        var ev = new IsTileSpaceMethodEvent(gridUid, mapUid, tile, mapGridComp);

        // Try to let the grid (if any) handle it...
        if (gridUid.HasValue)
        {
            RaiseLocalEvent(gridUid.Value, ref ev, false);
        }

        // If we didn't have a grid or the event wasn't handled
        // we let the map know, and also broadcast the event while at it!
        if (mapUid.HasValue && !ev.Handled)
        {
            RaiseLocalEvent(mapUid.Value, ref ev, true);
        }

        // We didn't have a map, and the event isn't handled, therefore broadcast the event.
        else if (!mapUid.HasValue && !ev.Handled)
        {
            RaiseLocalEvent(ref ev);
        }

        // If nothing handled the event, it'll default to true.
        // Oh well, this is a space game after all, deal with it!
        return(ev.Result);
    }
    private void MapIsTileSpace(EntityUid uid, MapAtmosphereComponent component, ref IsTileSpaceMethodEvent args)
    {
        if (args.Handled)
        {
            return;
        }

        args.Result  = component.Space;
        args.Handled = true;
    }