Even if I check for sight in both directions (and I do), there is the rare case when both attacker and victim may be able to see through the wall, and thus defy intended game physics by shooting through it.
The solution was to get the attacker's and victim's turfs, and find out if they are in view of each other:
proc
get_turf(atom/where) // very useful for other things as well
while(isloc(where))
if(isturf(where))
return where
where = where.loc
return null
weapon_view(mob/attacker, mob/target)
var
from_turf = get_turf(attacker)
to_turf = get_turf(target)
if(from_turf && to_turf)
return ((from_turf in (view(to_turf))) && (to_turf in (view(from_turf))))
In case you're wondering why I check view in both directions, I have found that BYOND's sighting routines are not 100% reciprocal between given points. That is, with the right configuration of walls, person A can see person B, while the opposite is not true.