ID:141734
 
Code:
obj/proc/TowerAI()
spawn(src.delay) src.TowerAI()
for(var/obj/Enemy/E in oview(src.range))
var/obj/Bullet/B = new(src.loc)
B.Move(locate(src.loc))
B.dmg = src.damage
B.icon_state = "[src.icon_state]"
walk(B,get_dir(src,E))


Problem description:
The enemies come right within their range(5) and they sit there inactive. Why?
Doesn't seem like the problem is in this code.

Maybe moving B to locate(src.loc) isn't good, because:
loc is the location of src.
locate() is returning the location of the location of src.
src's location is most likely a turf, and you're getting the area of which the turf is located.
Try B.loc=src.loc instead.

Also, for infinite loops I prefer using spawn while(1). But it doesn't matter.
Your oview() call abuses usr, so it won't function properly.
Also, you should ditch the Move() call. You're using locate() wrong, with an invalid argument, and it doesn't seem like you grasp the concept of locations very well (so I suggest looking all those up, loc, locate(), Move()...), or quite know what your code is doing there... your new() call already places the created bullet in src.loc by using new()'s location argument.
You should also remove the text string and embedding the icon_state var in it, it's completely extraneous and doesn't do anything.
In response to Kaioken
Actually when I used new(src.loc) it didn't move the bullet to the loc at all.
In response to Kaiochao
I found the problem. Within the oview() proc I forgot to define the center of the oview(). Which would be src. It was probably centering to the newly defined instance var/obj/Enemy.
In response to Choka
It centered around the default value for the Center argument (which is usr), since you didn't provide any other one. This was already pointed out, pretty much.