diff --git a/code/game/objects/effects/effect_system/effects_smoke.dm b/code/game/objects/effects/effect_system/effects_smoke.dm index 005b4459a60..cc0259c6c6f 100644 --- a/code/game/objects/effects/effect_system/effects_smoke.dm +++ b/code/game/objects/effects/effect_system/effects_smoke.dm @@ -1,6 +1,6 @@ ///////////////////////////////////////////// //// SMOKE SYSTEMS -// direct can be optinally added when set_up, to make the smoke always travel in one direction +// direct can be optionally added when set_up, to make the smoke always travel in one direction // in case you wanted a vent to always smoke north for example ///////////////////////////////////////////// @@ -13,7 +13,9 @@ opacity = 1 anchored = 0 mouse_opacity = 0 - var/time_to_live = 100 + var/steps = 0 + var/lifetime = 5 + var/direction /obj/effect/effect/smoke/proc/fade_out(frames = 16) if(alpha == 0) //Handle already transparent case @@ -29,8 +31,27 @@ /obj/effect/effect/smoke/New() ..() - QDEL_IN(src, time_to_live) - return + processing_objects |= src + lifetime += rand(-1,1) + +/obj/effect/effect/smoke/Destroy() + processing_objects.Remove(src) + return ..() + +/obj/effect/effect/smoke/proc/kill_smoke() + processing_objects.Remove(src) + addtimer(src, "fade_out", 0) + QDEL_IN(src, 10) + +/obj/effect/effect/smoke/process() + lifetime-- + if(lifetime < 1) + kill_smoke() + return 0 + if(steps >= 1) + step(src,direction) + steps-- + return 1 /obj/effect/effect/smoke/Crossed(mob/living/M) if(!istype(M)) @@ -40,12 +61,21 @@ /obj/effect/effect/smoke/proc/smoke_mob(mob/living/carbon/C) if(!istype(C)) return FALSE + if(lifetime<1) + return FALSE if(!C.can_breathe_gas()) return FALSE + if(C.smoke_delay) + return FALSE + C.smoke_delay++ + addtimer(src, "remove_smoke_delay", 10, FALSE, C) return TRUE +/obj/effect/effect/smoke/proc/remove_smoke_delay(mob/living/carbon/C) + if(C) + C.smoke_delay = 0 + /datum/effect/system/smoke_spread - var/total_smoke = 0 // To stop it being spammed and lagging! var/direction var/smoke_type = /obj/effect/effect/smoke @@ -63,39 +93,37 @@ /datum/effect/system/smoke_spread/start() for(var/i=0, i 20) - return - spawn(0) - if(holder) - location = get_turf(holder) - var/obj/effect/effect/smoke/S = new smoke_type(location) - total_smoke++ - var/direction = src.direction - if(!direction) - if(cardinals) - direction = pick(cardinal) - else - direction = pick(alldirs) - for(i=0, i 20) - return - spawn(0) - if(holder) - location = get_turf(holder) - var/obj/effect/effect/smoke/chem/smoke = new smoke_type(location) - total_smoke++ - var/direction = src.direction - if(!direction) - if(cardinals) - direction = pick(cardinal) - else - direction = pick(alldirs) - - if(color) - smoke.icon += color // give the smoke color, if it has any to begin with + if(holder) + location = get_turf(holder) + var/obj/effect/effect/smoke/chem/S = new smoke_type(location) + if(!direction) + if(cardinals) + S.direction = pick(cardinal) else - // if no color, just use the old smoke icon - smoke.icon = 'icons/effects/96x96.dmi' - smoke.icon_state = "smoke" - for(i=0, i