turf/Click()
if(usr.detonating)
if(usr.stamina<10) return
usr.stamina-=10;usr.staminaexp+=rand(0,2);usr.StaminaLevelUp();usr.detonating=0
var/obj/Nothing/N=new();N.loc=src;flick('Target.dmi',N)
spawn(10)
flick('Explode.dmi',N)
spawn(5)
del(N)
for(var/mob/M in view(N,1))
damage = round(usr.str*1.5);damage+=rand(1,damage/1.5);damage=round(damage*1.[usr.anger])
view(M)<<"[M] takes [damage] damage from the explosion!"
M.health-=damage;M.Death(usr)
Problem description:
I've looked the code over several times and found nothing wrong with it. It worked fine the last time I tested it which was a few days ago, but now it just displays the following runtime error and I didn't change any of the code.
runtime error: cannot read from list
proc name: Click (/turf/Click)
usr: Wrath (/mob)
src: (91,70,7) (/turf/dirt)
call stack:
(91,70,7) (/turf/dirt): Click( (91,70,7) (/turf/dirt), "mapwindow.map", "icon-x=10;icon-y=14;left=1")
I clicked the turf right next to me as the target of the explosion, but i can't figure out what's wrong. I've tried targeting the turf under me and near other mobs and I get the same error. Can anyone tell me what's wrong?
Even though you have a spawn statement there, it's possible N is being deleted before the loop finishes. Instead of calling view(N, 1), you could try view(src, 1) since they'll both always be in the same tile and the turf is never deleted.