ID:264334
 
Code:
obj
Battle
icon = 'Blasts.dmi'
density = 1
Bump(atom/A)
if(isobj(A)||isarea(A))
del(src)
for(A in oview(A,src.splash_radius))
new/obj/Battle/Explosions/Fire(A.loc,A)
Explosions//Spawning it
Fire
icon_state = "Explode"
density = 0
layer = MOB_LAYER+3
mouse_opacity = 0
New(location,atom/O,icon/I = icon(src.icon,src.icon_state))
..()
if(isarea(O)) return
//var/icon/I = icon(src.icon,src.icon_state)
world<<"\icon[I] added"
O.overlays += I
spawn(5) if(O) O.overlays -= I
world<<"\icon[I] removed"
if(istype(O,/turf/Different_Grasses/grass))
O.overlays += 'Destruction.dmi'
spawn(600) if(O) O.overlays -= 'Destruction.dmi'
del(src)
return ..()


Problem description: Well, the problem with this is everything works but the only problem is the overlays removing from the turfs, they, however stick and are never removed. Anyone know a quick fix for this snippet?

Yeah. In their New() procs, put in a spawn() delay before deleting itself. And put it at the beginning, right after the ..()

obj/Object/Whatever
New()
..()
spawn(100) //10 second delay before...
del(src) //deleting itself
In response to Mizukouken Ketsu
I've already done that...Doesn't seem to make any difference.
In response to Yash 69
You're setting overlays and not objects >_>

http://www.byond.com/developer/Theodis/Explosions

I'd recommend Theodis's explosions demo :)
In response to Mizukouken Ketsu
That is not the demo I need, I need an explosion system that works on turfs as well. As you have tried that demo, you will notice it stops after it hits a dense wall, therefore rendering it useless for me.
In response to Yash 69
Ah... well then instead of using del() in the spawn(), use overlays-="icon" :3
What they are trying to say here is this...

What you are doing to remove the overlays there is just fine, the reason it isn't being done is because the object is being deleted before the spawn() timer is up. When you delete the object it halts any procs that are running 'on' the object if you will. New() belongs to that object, kill the object, you kill any procs inside of it. You will have to either wait to delete the object or handle the overlay removal with a standalone proc.
In response to Yash 69
That is not the demo I need, I need an explosion system that works on turfs as well. As you have tried that demo, you will notice it stops after it hits a dense wall, therefore rendering it useless for me.

In defense of my library how the explosion behaves is entirely up to the explosion effect you program for it. The demo demonstrates with an explosion effect that does stop with a wall but it's easy to change and have it completely ignore obstacles or pass through weak ones, stop at strong ones, increase in power on other ones, etc.