ID:118306
 
Redundant
Applies to:DM Language
Status: Redundant

This feature has already been implemented, or is already achievable with existing methods.
Well I didn't see this listed and as far as I know there isn't a proc for this. Essentially this is a simple proc to check if the given atom is in the sight of a client(visible on their map).

returns: 1 if it's in sight of player. False otherwise.
view(usr)         //objects that usr can see
view(usr.loc) //objects visible from usr's position
view(usr.client) //objects visible to player

#define in_sight(atom, player) (atom in view(player))


It might be faster to not need to call view() all the time, considering how many atoms can be on your screen at any given time (due to a large view size or a horde of zombies). Consider this:
var view[] = view(src)
for(var/obj/tree/t in view)
src << "You see a tree!"
for(var/obj/rock/r in view)
src << "You see a rock!"

// is probably better than
for(var/obj/tree/t in view(src))
//...
for(var/obj/rock/r in view(src))
//...

// and I'm not sure about
for(var/obj/o in view(src))
if(istype(o, /obj/tree)) // ...
else if(istype(o, /obj/rock)) // ...
If opacity isn't an issue, you can just use get_dist()
Ter13 resolved issue (Redundant)