/* This is an attempt to make some easily reusable "particle" type effect, 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/effect/effect name = "effect" icon = 'icons/effects/effects.dmi' mouse_opacity = 0 unacidable = 1//So effect are not targeted by alien acid. /obj/effect/effect/water name = "water" icon = 'icons/effects/effects.dmi' icon_state = "extinguish" var/life = 15.0 mouse_opacity = 0 /obj/effect/effect/smoke name = "smoke" icon = 'icons/effects/water.dmi' icon_state = "smoke" opacity = 1 anchored = 0.0 mouse_opacity = 0 var/amount = 8.0 /obj/effect/proc/delete() loc = null if(reagents) reagents.delete() return /datum/effect/effect/proc/fadeOut(var/atom/A, var/frames = 16) if(A.alpha == 0) //Handle already transparent case return if(frames == 0) frames = 1 //We will just assume that by 0 frames, the coder meant "during one frame". var/step = A.alpha / frames for(var/i = 0, i < frames, i++) A.alpha -= step sleep(world.tick_lag) return /obj/effect/effect/water/New() ..() //var/turf/T = src.loc //if (istype(T, /turf)) // T.firelevel = 0 //TODO: FIX spawn( 70 ) delete() return return /obj/effect/effect/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 delete() if(newloc.density) return 0 .=..() /obj/effect/effect/water/Bump(atom/A) if(reagents) reagents.reaction(A) return ..() /datum/effect/effect/system var/number = 3 var/cardinals = 0 var/turf/location var/atom/holder var/setup = 0 /datum/effect/effect/system/proc/set_up(n = 3, c = 0, turf/loc) if(n > 10) n = 10 number = n cardinals = c location = loc setup = 1 /datum/effect/effect/system/proc/attach(atom/atom) holder = atom /datum/effect/effect/system/proc/start() ///////////////////////////////////////////// // 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/effect/system/steam_spread/steam = new /datum/effect/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/effect/effect/steam name = "steam" icon = 'icons/effects/effects.dmi' icon_state = "extinguish" density = 0 /datum/effect/effect/system/steam_spread /datum/effect/effect/system/steam_spread/set_up(n = 3, c = 0, turf/loc) if(n > 10) n = 10 number = n cardinals = c location = loc /datum/effect/effect/system/steam_spread/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/effect/effect/system/spark_spread/start() var/i = 0 for(i=0, i 20) return spawn(0) if(holder) src.location = get_turf(holder) var/obj/effect/effect/sparks/sparks = new /obj/effect/effect/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) /datum/effect/effect/system/lightning_spread/start() var/i = 0 for(i=0, i 20) return spawn(0) if(holder) src.location = get_turf(holder) var/obj/effect/effect/sparks/electricity/sparks = new /obj/effect/effect/sparks/electricity(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/effect/effect/system/harmless_smoke_spread/start() var/i = 0 for(i=0, i 20) return spawn(0) if(holder) src.location = get_turf(holder) var/obj/effect/effect/harmless_smoke/smoke = new /obj/effect/effect/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/effect/effect/system/bad_smoke_spread/start() var/i = 0 for(i=0, i 20) return spawn(0) if(holder) src.location = get_turf(holder) var/obj/effect/effect/bad_smoke/smoke = new /obj/effect/effect/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 if(!silent) var/contained = "" for(var/reagent in carry.reagent_list) contained += " [reagent] " if(contained) contained = "\[[contained]\]" var/area/A = get_area(location) var/where = "[A.name] | [location.x], [location.y]" var/whereLink = "[where]" if(carry.my_atom.fingerprintslast) var/mob/M = get_mob_by_key(carry.my_atom.fingerprintslast) var/more = "" if(M) more = "(?)" message_admins("A chemical smoke reaction has taken place in ([whereLink])[contained]. Last associated key is [carry.my_atom.fingerprintslast][more].", 0, 1) log_game("A chemical smoke reaction has taken place in ([where])[contained]. Last associated key is [carry.my_atom.fingerprintslast].") else message_admins("A chemical smoke reaction has taken place in ([whereLink]). No associated key.", 0, 1) log_game("A chemical smoke reaction has taken place in ([where])[contained]. No associated key.") /datum/effect/effect/system/chem_smoke_spread/start() var/i = 0 var/color = mix_color_from_reagents(chemholder.reagents.reagent_list) for(i=0, i 20) return spawn(0) if(holder) src.location = get_turf(holder) var/obj/effect/effect/chem_smoke/smoke = new /obj/effect/effect/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(color) smoke.color = color // give the smoke color, if it has any to begin with else // if no color, just use the old smoke icon smoke.icon = 'icons/effects/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/effect/effect/system/sleep_smoke_spread/start() var/i = 0 for(i=0, i 20) return spawn(0) if(holder) src.location = get_turf(holder) var/obj/effect/effect/sleep_smoke/smoke = new /obj/effect/effect/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= 1) M << "You smash apart the foam wall." qdel(src) return /obj/structure/foamedmetal/attack_hand(var/mob/user) if ((HULK in user.mutations) || (prob(75 - metal*25))) user << "You smash through the metal foam wall." for(var/mob/O in oviewers(user)) if ((O.client && !( O.blinded ))) O << "[user] smashes through the foamed metal." qdel(src) else user << "You hit the metal foam but bounce off it." return /obj/structure/foamedmetal/attackby(var/obj/item/I, var/mob/user) if (istype(I, /obj/item/weapon/grab)) var/obj/item/weapon/grab/G = I G.affecting.loc = src.loc for(var/mob/O in viewers(src)) if (O.client) O << "[G.assailant] smashes [G.affecting] through the foamed metal wall." qdel(I) qdel(src) return if(prob(I.force*20 - metal*25)) user << "You smash through the foamed metal with \the [I]." for(var/mob/O in oviewers(user)) if ((O.client && !( O.blinded ))) O << "[user] smashes through the foamed metal." qdel(src) else user << "You hit the metal foam to no effect." /obj/structure/foamedmetal/CanPass(atom/movable/mover, turf/target, height=1.5, air_group = 0) if(air_group) return 0 return !density /obj/structure/foamedmetal/CanAtmosPass() return !density /datum/effect/effect/system/reagents_explosion var/amount // TNT equivalent var/flashing = 0 // does explosion creates flash effect? var/flashing_factor = 0 // factor of how powerful the flash effect relatively to the explosion /datum/effect/effect/system/reagents_explosion/set_up (amt, loc, flash = 0, flash_fact = 0) amount = amt if(istype(loc, /turf/)) location = loc else location = get_turf(loc) flashing = flash flashing_factor = flash_fact return /datum/effect/effect/system/reagents_explosion/start() if (amount <= 2) var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread s.set_up(2, 1, location) s.start() for(var/mob/M in viewers(5, location)) M << "The solution violently explodes." for(var/mob/M in viewers(1, location)) if (prob (50 * amount)) M << "The explosion knocks you down." M.Weaken(rand(1,5)) return else var/devastation = -1 var/heavy = -1 var/light = -1 var/flash = -1 // Clamp all values to MAX_EXPLOSION_RANGE if (round(amount/12) > 0) devastation = min (MAX_EX_DEVESTATION_RANGE, devastation + round(amount/12)) if (round(amount/6) > 0) heavy = min (MAX_EX_HEAVY_RANGE, heavy + round(amount/6)) if (round(amount/3) > 0) light = min (MAX_EX_LIGHT_RANGE, light + round(amount/3)) if (flash && flashing_factor) flash += (round(amount/4) * flashing_factor) for(var/mob/M in viewers(8, location)) M << "The solution violently explodes." explosion(location, devastation, heavy, light, flash)