You just want to get built-in tilemap data like tile index ?
All You need to do is to translate entity position to worldtomap ( which You already did since entity is aligned ti tilemap ) and do something like this :
var pos = #translated position here
var neighbours = []
for x in range(-1,1):
for y in range(-1,1):
var tile = pos + Vector2(x,y)
if not neighbours.has(tile) and tile != pos :
neighbours.append(tile)
return neighbours
number in range() can be replaced by any number and it will indicate size of a square within You want to get neighbouring tiles. This actually checks for neighbours in 8 directions. IF You don't want diagonals You can replace whole double for loop with :
for x in [Vector2(1,0), Vector2(-1,0),Vector2(0,1),Vector2(0,-1)]
neighbours will contain array of all tiles surrounding entity. You can iterate thrrough this array to ask tilemap for any data regarding these tiles, like :
for tile in neighbours:
if get_cell(tile) == -1:
print("empty")