ID:145577
 
Code:
mob
proc
shoot()
if(src.key == "Xkirby2")
var/obj/H = new/obj/bullet
else if(src.key == "KirbyRules")
var/obj/H = new/obj/Bullet
if(src.fired == 0)
src.fired = 1
spawn(15)
src.fired = 0
H.dir = src.dir
H.loc = src.loc
while(H)
step(H,H.dir)
var/turf/T = H.loc
if(T.density == 1)
del(H)
break
for(var/mob/M as mob in T)
if(M == src)
continue
del(H)
sleep(1)


Problem description:
I didn't make this, I found it in a library. I was trying to change it to fit my needs but I mess it up....I think I indented wrong... Can someone fix this code for me please? I don't know how...
I would help fix it but I was the one who messed it up in the first place. >_<'
In response to KirbyRules
i fixed it so dont worry about it... i think...
1.) For boolean vars, do not use ==. If it must equal 0, at least use the ! operator for it. Example:

var/SomeVar = 0
if( !SomeVar ) // Good
if( SomeVar == 0 ) // Bad, could somehow evaluate to false.
////////////////////////////////////
if( SomeVar == 1 )
else if( SomeVar == 2 ) // This is ok right here, but...

if( SomeVar == 1 )
else if( SomeVar == 0 ) // Wrong wrong wrong! ! operator is needed, and this is correct way:

if( SomeVar ) // If true, inequal to 0, or is not a 0-length string ( "" )
else if( !SomeVar ) // If false, 0, or is a 0-length string( "" )


2.) Your for loop never gets executed, as it's located inside an if statement-execution block after a break statement. I think you wanted to move it to the left 2 tabs so that it's executed right after the while statement, or once to go right after the if statement.
In response to Audeuro
Nevermimnd, we just refound the verb in the library and re-edited it. It works now.