const layer = ecs.get(1).TileLayers.layer(1) const filtered = [] for (const position of projected) { const x0 = position.x * layer.tileSize.x; const y0 = position.y * layer.tileSize.y; const entities = Array.from(ecs.system('Colliders').within({ x0, x1: x0 + layer.tileSize.x - 1, y0, y1: y0 + layer.tileSize.y - 1, })); let hasPlant = false; for (const {Plant} of entities) { if (Plant) { hasPlant = true break; } } if (!hasPlant) { if ([7].includes(layer.tile(position))) { filtered.push(position) } } } return filtered