private Dictionary <EntityUid, HashSet <Vector2i> > GetChunksForViewers(
        HashSet <EntityUid> viewers,
        int chunkSize,
        ObjectPool <HashSet <Vector2i> > indexPool,
        ObjectPool <Dictionary <EntityUid, HashSet <Vector2i> > > viewerPool,
        float viewEnlargement,
        EntityQuery <TransformComponent> xformQuery)
    {
        Dictionary <EntityUid, HashSet <Vector2i> > chunks = viewerPool.Get();

        DebugTools.Assert(chunks.Count == 0);

        foreach (var viewerUid in viewers)
        {
            var xform  = xformQuery.GetComponent(viewerUid);
            var pos    = _transform.GetWorldPosition(xform, xformQuery);
            var bounds = _baseViewBounds.Translated(pos).Enlarged(viewEnlargement);

            foreach (var grid in _mapManager.FindGridsIntersecting(xform.MapID, bounds, true))
            {
                if (!chunks.TryGetValue(grid.GridEntityId, out var set))
                {
                    chunks[grid.GridEntityId] = set = indexPool.Get();
                    DebugTools.Assert(set.Count == 0);
                }

                var enumerator = new ChunkIndicesEnumerator(_transform.GetInvWorldMatrix(grid.GridEntityId, xformQuery).TransformBox(bounds), chunkSize);

                while (enumerator.MoveNext(out var indices))
                {
                    set.Add(indices.Value);
                }
            }
        }

        return(chunks);
    }