ID:157098
 
Alright, I'm needing help with figuring out a way to make it so that the mob can tell if there is something in the way between it and an enemy mob therefore it won't fire. So how I can I tell if there is something inbetween two mobs?
Can't anybody help? Please...
In response to CodeWeasel22 (#1)
Not sure how to do help you with this. I was going to reply earlier with maybe get_step but that wouldn't work either. :/ Sorry
In response to Leur (#2)
Alright, then is there a way to make it work with view() as if the mob were able to see it, it could shoot, but not for the usr? Or something like that?
In response to CodeWeasel22 (#3)
Try ohearers or hearers.

Edit: Honestly your question confused me, ohearers hearers is if they cannot see it, it is not listed. and in result cannot be fired at.
If you are using oview() or ohearers() or most such procs except for orange(), then the player won't be in the list if there is an opaque object in the way.

If you want a dense object to block things, you'll need to use get_step_towards() consecutively to get a list of turfs between the two locations, and check for density in each of them. Getting the list of turfs is straightforward:

proc/get_line(var/turf/start, var/turf/end)
var/list/path = list()
for(var/turf/T = start, T != end, T = get_step_towards(T, end))
path += T
return path


Then, just iterate through that looking for blockages.