ID:262686
 
Code:
mob/boom
grenade
icon = 'Weapons.dmi'
icon_state = "Grenade"
atk = 4
matk = 9
New()
spawn(3)
GO(src)
proc/GO(obj/m)
step(m,m.dir)
step(m,m.dir)
step(m,m.dir)
step(m,m.dir)
step(m,m.dir)
for(var/atom/a in oview(1,m))
if(isarea(a)){continue}
var/effect = new/obj/effect()
a.overlays += effect
if(istype(a,/mob/) || (istype(a,/obj/)))
if(a:arm>=1)
a:arm-=rand(src.atk,src.matk)
if(a:arm<0)a:arm=0
if(a.damage==1)Baracade(a)
else if(a:hp>=1)
a:hp-=rand(src.atk,src.matk)
if(istype(a,/mob))Health(a)
if(a:hp<=0)
a:hp=0
if(istype(a,/mob))a:Death(m)
else if(istype(a,/obj))
a.density=0
a.icon=null
for(var/mob/M in world)
if(a.owner == M)
M.built -= 1
M << "One of your turrents was destoryed!"
spawn(25)del(a)
del(m)


Problem description:
the grenade doesnt move before exploding

I can think of two things which might be a problem here.

First, you might have defined your grenade to have null or 0 as a dir value. Calling step() with m.dir as the direction will step the grenade in the direction it is facing. Because I don't see you setting the grenade's dir anywhere in your call to New(), this jumps out as a potential problem. Even if you havn't redefined dir anywhere else (under /mob, maybe?) this means that your grenade will always walk SOUTH five steps; I'm guessing this is not what you want. I'd suggest you pass the thrower as a parameter to grenade/New() (I'd also suggest that you pass a proper location, and that you call the default behavior before doing anything else: .=..() ), if you do that, then you can step the grenade in the direction of thrower.dir.

Second, the grenade could be moving, but you don't notice it. step() doesn't take any time to execute. Calling it five times and then exploding, will just look like it explodes immediatly. You might consider calling sleep(1) (or another small time) between your calls to step, as this will cause you to see the grenade actually moving.
In response to IainPeregrine
1. it sets the dir when you throw the gernade
2. nope, it explodes right under me