/* This is an attempt to make some easily reusable "particle" type effects, to stop the code constantly having to be rewritten. An item like the jetpack that uses the ion_trail_follow system, just has one defined, then set up when it is created with New(). Then this same system can just be reused each time it needs to create more trails.A beaker could have a steam_trail_follow system set up, then the steam would spawn and follow the beaker, even if it is carried or thrown. */ /obj/effects name = "effects" icon = 'effects.dmi' mouse_opacity = 0 unacidable = 1//So effects are not targeted by alien acid. flags = TABLEPASS /obj/effects/water name = "water" icon = 'effects.dmi' icon_state = "extinguish" var/life = 15.0 flags = 2.0 mouse_opacity = 0 /obj/effects/smoke name = "smoke" icon = 'water.dmi' icon_state = "smoke" opacity = 1 anchored = 0.0 mouse_opacity = 0 var/amount = 8.0 /obj/effects/water/New() ..() //var/turf/T = src.loc //if (istype(T, /turf)) // T.firelevel = 0 //TODO: FIX spawn( 70 ) del(src) return return /obj/effects/water/Del() //var/turf/T = src.loc //if (istype(T, /turf)) // T.firelevel = 0 //TODO: FIX ..() return /obj/effects/water/Move(turf/newloc) //var/turf/T = src.loc //if (istype(T, /turf)) // T.firelevel = 0 //TODO: FIX if (--src.life < 1) //SN src = null del(src) if(newloc.density) return 0 .=..() ///////////////////////////////////////////// // GENERIC STEAM SPREAD SYSTEM //Usage: set_up(number of bits of steam, use North/South/East/West only, spawn location) // The attach(atom/atom) proc is optional, and can be called to attach the effect // to something, like a smoking beaker, so then you can just call start() and the steam // will always spawn at the items location, even if it's moved. /* Example: var/datum/effects/system/steam_spread/steam = new /datum/effects/system/steam_spread() -- creates new system steam.set_up(5, 0, mob.loc) -- sets up variables OPTIONAL: steam.attach(mob) steam.start() -- spawns the effect */ ///////////////////////////////////////////// /obj/effects/steam name = "steam" icon = 'effects.dmi' icon_state = "extinguish" density = 0 /datum/effects/system/steam_spread var/number = 3 var/cardinals = 0 var/turf/location var/atom/holder /datum/effects/system/steam_spread/proc/set_up(n = 3, c = 0, turf/loc) if(n > 10) n = 10 number = n cardinals = c location = loc /datum/effects/system/steam_spread/proc/attach(atom/atom) holder = atom /datum/effects/system/steam_spread/proc/start() var/i = 0 for(i=0, i 10) n = 10 number = n cardinals = c if(istype(loca, /turf/)) location = loca else location = get_turf(loca) /datum/effects/system/spark_spread/proc/attach(atom/atom) holder = atom /datum/effects/system/spark_spread/proc/start() var/i = 0 for(i=0, i 20) return spawn(0) if(holder) src.location = get_turf(holder) var/obj/effects/sparks/sparks = new /obj/effects/sparks(src.location) src.total_sparks++ var/direction if(src.cardinals) direction = pick(cardinal) else direction = pick(alldirs) for(i=0, i 10) n = 10 number = n cardinals = c if(istype(loca, /turf/)) location = loca else location = get_turf(loca) if(direct) direction = direct /datum/effects/system/harmless_smoke_spread/proc/attach(atom/atom) holder = atom /datum/effects/system/harmless_smoke_spread/proc/start() var/i = 0 for(i=0, i 20) return spawn(0) if(holder) src.location = get_turf(holder) var/obj/effects/harmless_smoke/smoke = new /obj/effects/harmless_smoke(src.location) src.total_smoke++ var/direction = src.direction if(!direction) if(src.cardinals) direction = pick(cardinal) else direction = pick(alldirs) for(i=0, i 20) n = 20 number = n cardinals = c if(istype(loca, /turf/)) location = loca else location = get_turf(loca) if(direct) direction = direct /datum/effects/system/bad_smoke_spread/proc/attach(atom/atom) holder = atom /datum/effects/system/bad_smoke_spread/proc/start() var/i = 0 for(i=0, i 20) return spawn(0) if(holder) src.location = get_turf(holder) var/obj/effects/bad_smoke/smoke = new /obj/effects/bad_smoke(src.location) src.total_smoke++ var/direction = src.direction if(!direction) if(src.cardinals) direction = pick(cardinal) else direction = pick(alldirs) for(i=0, i 20) n = 20 number = n cardinals = c carry.copy_to(chemholder, carry.total_volume) if(istype(loca, /turf/)) location = loca else location = get_turf(loca) if(direct) direction = direct /datum/effects/system/chem_smoke_spread/proc/attach(atom/atom) holder = atom /datum/effects/system/chem_smoke_spread/proc/start() var/i = 0 // Calculate the smokes' color var/list/rgbcolor = list(0,0,0) var/finalcolor for(var/datum/reagent/re in chemholder.reagents.reagent_list) if(!finalcolor) rgbcolor = GetColors(re.color) finalcolor = re.color else var/newcolor[3] var/prergbcolor[3] prergbcolor = rgbcolor newcolor = GetColors(re.color) rgbcolor[1] = (prergbcolor[1]+newcolor[1])/2 rgbcolor[2] = (prergbcolor[2]+newcolor[2])/2 rgbcolor[3] = (prergbcolor[3]+newcolor[3])/2 finalcolor = rgb(rgbcolor[1], rgbcolor[2], rgbcolor[3]) if(finalcolor) finalcolor = rgb(rgbcolor[1], rgbcolor[2], rgbcolor[3]) // slightly darker color for(i=0, i 20) return spawn(0) if(holder) src.location = get_turf(holder) var/obj/effects/chem_smoke/smoke = new /obj/effects/chem_smoke(src.location) src.total_smoke++ var/direction = src.direction if(!direction) if(src.cardinals) direction = pick(cardinal) else direction = pick(alldirs) if(chemholder.reagents.total_volume != 1) // can't split 1 very well chemholder.reagents.copy_to(smoke, chemholder.reagents.total_volume / number) // copy reagents to each smoke, divide evenly if(finalcolor) smoke.icon += finalcolor // give the smoke color, if it has any to begin with else // if no color, just use the old smoke icon smoke.icon = '96x96.dmi' smoke.icon_state = "smoke" for(i=0, i 20) n = 20 number = n cardinals = c if(istype(loca, /turf/)) location = loca else location = get_turf(loca) if(direct) direction = direct /datum/effects/system/sleep_smoke_spread/proc/attach(atom/atom) holder = atom /datum/effects/system/sleep_smoke_spread/proc/start() var/i = 0 for(i=0, i 20) return spawn(0) if(holder) src.location = get_turf(holder) var/obj/effects/sleep_smoke/smoke = new /obj/effects/sleep_smoke(src.location) src.total_smoke++ var/direction = src.direction if(!direction) if(src.cardinals) direction = pick(cardinal) else direction = pick(alldirs) for(i=0, i 20) n = 20 number = n cardinals = c if(istype(loca, /turf/)) location = loca else location = get_turf(loca) if(direct) direction = direct /datum/effects/system/mustard_gas_spread/proc/attach(atom/atom) holder = atom /datum/effects/system/mustard_gas_spread/proc/start() var/i = 0 for(i=0, i 20) return spawn(0) if(holder) src.location = get_turf(holder) var/obj/effects/mustard_gas/smoke = new /obj/effects/mustard_gas(src.location) src.total_smoke++ var/direction = src.direction if(!direction) if(src.cardinals) direction = pick(cardinal) else direction = pick(alldirs) for(i=0, i 0) devastation = min (MAX_EXPLOSION_RANGE, devastation + round(amount/12)) if (round(amount/6) > 0) heavy = min (MAX_EXPLOSION_RANGE, heavy + round(amount/6)) if (round(amount/3) > 0) light = min (MAX_EXPLOSION_RANGE, light + round(amount/3)) if (flash && flashing_factor) flash += (round(amount/4) * flashing_factor) for(var/mob/M in viewers(8, location)) M << "\red The solution violently explodes." explosion(location, devastation, heavy, light, flash)