ID:149423
 
Can obj call a proc? i put src in front of the proc i get a error snd when its not there the usr blows up

heres the proc

proc//Begining the proc...
Explosion()//Naming the Proc...
for (var/turf/X in range(src,1)) X.overlays+=/obj/explode//Overlay the Explosion icon
spawn(5)//Wait a little bit
X.overlays.Cut()//

heres the obj

obj/weapons/TNT
icon='tnt.dmi'

verb/get()//global verb for all object under the /obj/weapons
set src in oview(1)

src.Move(usr)//You picked it up
verb/light()


src.loc = locate(usr.x,usr.y-1,usr.z)
src.icon_state="fuse"
sleep(50)
src.Explosion()//calls the explosion proc
src.UnderExplosion()//calls the big under explosion proc
Health()//calls the big under explosion proc
del(src)
Is the proc global or part of the object?

It looks like Explosion() is global. If so, you are using src in a place where it doesn't exist and then calling the proc wrong.

You could send the object into the proc as an argument. You could define it as proc/Explosion(atom/Bomb) and use Bomb within the proc instead of src. You would then probably call it with Explosion(src) within the example you gave.

Another option is to make the proc part of the object so src has an actual meaning (EX: atom/proc/Explosion()). This seems to make more sense. You probably don't need a global proc for something like this.

Mind you, I just checked the proc calls because you asked about them. I did not check what the rest of the code actually does. It could launch pink fluffy bunnies into the mouths of purple frogs while green antelopes dance on their heads singing the anthem of wallowing turtles and turkeys with gingivitis.