ID:178337
 
How would you create a procedure that returns a list that contains all the atomss in the direction specified as far as the range. Here is what the call would be like
range = usr.client.view
direction = SOUTH //or NORTH,EAST,orWEST
for(var/obj/x in atomsindirection(range,direction))
Exadv1 wrote:
How would you create a procedure that returns a list that contains all the atomss in the direction specified as far as the range. Here is what the call would be like
range = usr.client.view
direction = SOUTH //or NORTH,EAST,orWEST
for(var/obj/x in atomsindirection(range,direction))

All you need to do is check for atoms in your view, and use the get_dir proc to check to see if they are in the correct dirction. For example:
proc/atomsindirection(mob/center,range,direction)  //center is the player
var/list/L = list()
for(var/atom/A in view(range,center))
if(get_dir(center,A) == direction))
L += A
return L

That should work fine.