var/cview=6
if(target in view(cview,src)
or
var/cview=6
if(get_dist(src,target)<=cview)
My logic is telling me get_dist is more efficient since its a pure calculations while the 'in view' does some sort of looping thru view(). But I would like some verification on this.
But if you're okay with that, it might actually be most efficient to compare coordinates one at a time:
Even more efficient would be to not perform the check too frequently. In the case of AI checking for targets, it shouldn't happen every tick.