- Edited
xRegnarokx Oh, just realized you wanted all occupied cells that have space above them. Well that's even simpler. Iterate through all used cells and just check if the cell above is occupied:
func _get_platform_cells() -> Array:
var platform_cells = []
for c in get_used_cells():
if get_cell_item(Vector3i(c.x, c.y + 1, c.z)) == -1:
platform_cells.push_back(c)
return platform_cells
Those could also easily be grouped in a dictionary with xz as a key. It's 2 additional lines of code.
EDIT: Why do all of this though? In a 2.5D game like this there should be no holes in stacks. So simply throw an exception if a hole is found. And display a message that the map is not designed according to rules