/* 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. pass_flags = PASSTABLE | PASSGRILLE /datum/effect/effect/system var/number = 3 var/cardinals = 0 var/turf/location var/atom/holder var/setup = 0 proc/set_up(n = 3, c = 0, turf/loc) if(n > 10) n = 10 number = n cardinals = c location = loc setup = 1 proc/attach(atom/atom) holder = atom proc/start() Destroy() holder = null return ..() ///////////////////////////////////////////// // 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 set_up(n = 3, c = 0, turf/loc) if(n > 10) n = 10 number = n cardinals = c location = loc 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) 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) if(direct) direction = direct /datum/effect/effect/system/smoke_spread/start(var/I) var/i = 0 for(i=0, i 20) return spawn(0) if(holder) src.location = get_turf(holder) var/obj/effect/effect/smoke/smoke = new smoke_type(src.location) src.total_smoke++ if(I) smoke.color = I var/direction = src.direction if(!direction) if(src.cardinals) direction = pick(cardinal) else direction = pick(alldirs) for(i=0, iThe solution violently explodes.") for(var/mob/M in viewers(1, location)) if (prob (50 * amount)) to_chat(M, "The explosion knocks you down.") M.Weaken(rand(1,5)) return else var/devst = -1 var/heavy = -1 var/light = -1 var/flash = -1 // Clamp all values to fractions of max_explosion_range, following the same pattern as for tank transfer bombs if (round(amount/12) > 0) devst = devst + amount/12 if (round(amount/6) > 0) heavy = heavy + amount/6 if (round(amount/3) > 0) light = light + amount/3 if (flashing && flashing_factor) flash = (amount/4) * flashing_factor for(var/mob/M in viewers(8, location)) to_chat(M, "The solution violently explodes.") explosion( location, round(min(devst, BOMBCAP_DVSTN_RADIUS)), round(min(heavy, BOMBCAP_HEAVY_RADIUS)), round(min(light, BOMBCAP_LIGHT_RADIUS)), round(min(flash, BOMBCAP_FLASH_RADIUS)) )