ID:2010294
 
(See the best response by Ter13.)
Code:
var/mob/T
for(T in block(locate(1,1,1),locate(3,3,1)))
world << "[T.x] and [T.y]"


Problem description: Trying to print the (x, y) of all mobs in a block, from (1,1) to (3,3) let's say but this keeps printing... nothing even know I do place mobs (directly from the map). What could be wrong? Thanks

Best response
block() only returns turfs.

You will want to use bounds() instead.

proc
mobBlock(x,y,w,h,z)
var/list/l = list()
for(var/mob/m in bounds((x-1)*TILE_WIDTH+1,(y-1)*TILE_HEIGHT+1,w*TILE_WIDTH,h*TILE_HEIGHT,z))
l += m
return l


Adjust that to your needs. bounds() uses pixel coordinates, though, hence the need for TILE_WIDTH and TILE_HEIGHT.
Thanks for your answer. So, instead of TILE_WIDTH and HEIGHT I should use the int 32?
You could do that. Or you could include a top-level macro in case you want to change the tile size later:

#define TILE_WIDTH 32
#define TILE_HEIGHT 32


defines boil down to constants during compilation, so it's faster than using a variable.