obj/shotgun
icon = 'shotgun.dmi'
verb
Fire() //also a verb for Shoot
shoot()
obj
proc
shoot()
if(!src.fired)
src.fired = 1
spawn(15)
src.fired = 0
var/obj/H = new/obj/bullet
H.dir = src.dir
H.loc = src.loc
while(H)
var nextLocation = get_step(H,H.dir)
var/turf/T = nextLocation
for(var/mob/M as mob in T)
if(M == src)
var/damage = rand(1,5)
if(prob(70)
src<<"You shot [M] for [damage] damage!"
M<<"[src] shot you for [damage] damage!"
M.hp -= damage
if(M.hp <= 0)
M.Deathcheck(usr)
del(H)
if(T.density == 1)
del(H)
if(H)
step(H,H.dir)
sleep(1)
obj/var
fired = 0
Problem description:
Whenever I use the Fire verb, the bullet just goes straight down... I can be facing up but the bullet still goes down..
Then, use M instead of src when you have to deal with directions and locations and whatnot.