diff --git a/code/game/objects/effects/effect_system/effect_system.dm b/code/game/objects/effects/effect_system/effect_system.dm index 9c601bec2c7..eddf740c9af 100644 --- a/code/game/objects/effects/effect_system/effect_system.dm +++ b/code/game/objects/effects/effect_system/effect_system.dm @@ -5,7 +5,6 @@ it needs to create more trails.A beaker could have a steam_trail_follow system s would spawn and follow the beaker, even if it is carried or thrown. */ - /obj/effect/effect name = "effect" icon = 'icons/effects/effects.dmi' @@ -25,7 +24,7 @@ would spawn and follow the beaker, even if it is carried or thrown. /obj/effect/proc/delete() qdel(src) -/datum/effect/proc/fadeOut(var/atom/A, var/frames = 16) +/datum/effect/proc/fadeOut(atom/A, frames = 16) if(A.alpha == 0) //Handle already transparent case return if(frames == 0) @@ -43,20 +42,20 @@ would spawn and follow the beaker, even if it is carried or thrown. var/atom/holder var/setup = 0 - Destroy() - holder = null - location = null - return ..() +/datum/effect/system/Destroy() + holder = null + location = null + return ..() - proc/set_up(n = 3, c = 0, turf/loc) - if(n > 10) - n = 10 - number = n - cardinals = c - location = loc - setup = 1 +/datum/effect/system/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 +/datum/effect/system/proc/attach(atom/atom) + holder = atom - proc/start() +/datum/effect/system/proc/start() diff --git a/code/game/objects/effects/effect_system/effects_foam.dm b/code/game/objects/effects/effect_system/effects_foam.dm index 20eb653c185..06546ab9e86 100644 --- a/code/game/objects/effects/effect_system/effects_foam.dm +++ b/code/game/objects/effects/effect_system/effects_foam.dm @@ -16,8 +16,7 @@ var/expand = 1 var/metal = 0 - -/obj/structure/foam/New(loc, var/ismetal=0) +/obj/structure/foam/New(loc, ismetal=0) ..(loc) icon_state = "[ismetal ? "m":""]foam" if(!ismetal && reagents) @@ -63,10 +62,8 @@ if(--amount < 0) return - for(var/direction in cardinal) - var/turf/T = get_step(src,direction) if(!T) continue @@ -96,12 +93,11 @@ spawn(5) qdel(src) - -/obj/structure/foam/Crossed(var/atom/movable/AM) +/obj/structure/foam/Crossed(atom/movable/AM) if(metal) return - if(istype(AM, /mob/living/carbon)) + if(iscarbon(AM)) var/mob/living/carbon/M = AM if(M.slip("foam", 5, 2)) if(reagents) @@ -113,7 +109,6 @@ var/fraction = 5 / reagents.total_volume reagents.reaction(M, TOUCH, fraction) - /datum/effect/system/foam_spread var/amount = 5 // the size of the foam spread. var/list/carried_reagents // the IDs of reagents present when the foam was mixed @@ -121,7 +116,7 @@ var/temperature = T0C var/list/banned_reagents = list("smoke_powder", "fluorosurfactant", "stimulants") -/datum/effect/system/foam_spread/set_up(amt=5, loca, var/datum/reagents/carry = null, var/metalfoam = 0) +/datum/effect/system/foam_spread/set_up(amt=5, loca, datum/reagents/carry = null, metalfoam = 0) amount = min(round(amt/5, 1), 7) if(istype(loca, /turf/)) location = loca @@ -168,7 +163,6 @@ // wall formed by metal foams // dense and opaque, but easy to break - /obj/structure/foamedmetal icon = 'icons/effects/effects.dmi' icon_state = "metalfoam" @@ -199,7 +193,6 @@ else icon_state = "ironfoam" - /obj/structure/foamedmetal/ex_act(severity) qdel(src) @@ -210,7 +203,7 @@ if(metal==MFOAM_ALUMINUM || prob(50)) qdel(src) -/obj/structure/foamedmetal/attack_hand(var/mob/user) +/obj/structure/foamedmetal/attack_hand(mob/user) user.changeNext_move(CLICK_CD_MELEE) user.do_attack_animation(src) if((HULK in user.mutations) || (prob(75 - metal*25))) @@ -219,7 +212,7 @@ else to_chat(user, "You hit the metal foam but bounce off it.") -/obj/structure/foamedmetal/attackby(var/obj/item/I, var/mob/user, params) +/obj/structure/foamedmetal/attackby(obj/item/I, mob/user, params) user.changeNext_move(CLICK_CD_MELEE) user.do_attack_animation(src) if(istype(I, /obj/item/weapon/grab)) diff --git a/code/game/objects/effects/effect_system/effects_other.dm b/code/game/objects/effects/effect_system/effects_other.dm index 69246db2859..27c5804ada8 100644 --- a/code/game/objects/effects/effect_system/effects_other.dm +++ b/code/game/objects/effects/effect_system/effects_other.dm @@ -35,7 +35,7 @@ I.dir = src.holder.dir flick("ion_fade", I) I.icon_state = "" - spawn( 20 ) + spawn(20) if(I) I.delete() src.oldposition = T @@ -98,9 +98,11 @@ flick("ion_fade", II) I.icon_state = "" II.icon_state = "" - spawn( 20 ) - if(I) I.delete() - if(II) II.delete() + spawn(20) + if(I) + I.delete() + if(II) + II.delete() spawn(2) if(src.on) src.processing = 1 @@ -113,64 +115,65 @@ var/flashing = 0 // does explosion creates flash effect? var/flashing_factor = 0 // factor of how powerful the flash effect relatively to the explosion - set_up (amt, loc, flash = 0, flash_fact = 0) - amount = amt - if(istype(loc, /turf/)) - location = loc - else - location = get_turf(loc) +/datum/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 + flashing = flash + flashing_factor = flash_fact + return + +/datum/effect/system/reagents_explosion/start() + if(amount <= 2) + var/datum/effect/system/spark_spread/s = new /datum/effect/system/spark_spread + s.set_up(2, 1, location) + s.start() + + for(var/mob/M in viewers(5, location)) + to_chat(M, "The 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/devastation = -1 + var/heavy = -1 + var/light = -1 + var/flash = -1 - start() - if(amount <= 2) - var/datum/effect/system/spark_spread/s = new /datum/effect/system/spark_spread - s.set_up(2, 1, location) - s.start() + // Clamp all values to MAX_EXPLOSION_RANGE + if(round(amount/12) > 0) + devastation = min (MAX_EX_DEVESTATION_RANGE, devastation + round(amount/12)) - for(var/mob/M in viewers(5, location)) - to_chat(M, "The 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/devastation = -1 - var/heavy = -1 - var/light = -1 - var/flash = -1 + if(round(amount/6) > 0) + heavy = min (MAX_EX_HEAVY_RANGE, heavy + round(amount/6)) - // 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/3) > 0) + light = min (MAX_EX_LIGHT_RANGE, light + round(amount/3)) - if(round(amount/6) > 0) - heavy = min (MAX_EX_HEAVY_RANGE, heavy + round(amount/6)) + if(flash && flashing_factor) + flash += (round(amount/4) * flashing_factor) - if(round(amount/3) > 0) - light = min (MAX_EX_LIGHT_RANGE, light + round(amount/3)) + for(var/mob/M in viewers(8, location)) + to_chat(M, "The solution violently explodes.") - if(flash && flashing_factor) - flash += (round(amount/4) * flashing_factor) + explosion(location, devastation, heavy, light, flash) - for(var/mob/M in viewers(8, location)) - to_chat(M, "The solution violently explodes.") +/datum/effect/system/reagents_explosion/proc/holder_damage(atom/holder) + if(holder) + var/dmglevel = 4 - explosion(location, devastation, heavy, light, flash) + if(round(amount/8) > 0) + dmglevel = 1 + else if(round(amount/4) > 0) + dmglevel = 2 + else if(round(amount/2) > 0) + dmglevel = 3 - proc/holder_damage(var/atom/holder) - if(holder) - var/dmglevel = 4 - - if(round(amount/8) > 0) - dmglevel = 1 - else if(round(amount/4) > 0) - dmglevel = 2 - else if(round(amount/2) > 0) - dmglevel = 3 - - if(dmglevel<4) holder.ex_act(dmglevel) + if(dmglevel<4) + holder.ex_act(dmglevel) diff --git a/code/game/objects/effects/effect_system/effects_smoke.dm b/code/game/objects/effects/effect_system/effects_smoke.dm index 6f5ca6d6359..b7636ad427d 100644 --- a/code/game/objects/effects/effect_system/effects_smoke.dm +++ b/code/game/objects/effects/effect_system/effects_smoke.dm @@ -27,7 +27,7 @@ /obj/effect/effect/harmless_smoke/New() ..() - spawn (100) + spawn(100) delete() return @@ -39,42 +39,40 @@ var/total_smoke = 0 // To stop it being spammed and lagging! var/direction - set_up(n = 5, c = 0, loca, direct) - if(n > 10) - n = 10 - number = n - cardinals = c - if(istype(loca, /turf/)) - location = loca - else - location = get_turf(loca) - if(direct) - direction = direct - - - 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 10) + n = 10 + number = n + cardinals = c + if(istype(loca, /turf/)) + location = loca + else + location = get_turf(loca) + if(direct) + direction = direct +/datum/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 - - 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 + if(istype(loca, /turf/)) + location = loca + else + location = get_turf(loca) + if(direct) + direction = direct +/datum/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) +/datum/effect/system/chem_smoke_spread/set_up(datum/reagents/carry = null, n = 5, c = 0, loca, direct, silent = 0) + if(n > 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) - 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]" - var/where = "[A.name] | [location.x], [location.y]" - var/whereLink = "[where]" - - if(carry && carry.my_atom) - if(carry.my_atom.fingerprintslast) - var/mob/M = get_mob_by_key(carry.my_atom.fingerprintslast) - var/more = "" - if(M) - more = " " - msg_admin_attack("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 - msg_admin_attack("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.") + if(carry && carry.my_atom) + if(carry.my_atom.fingerprintslast) + var/mob/M = get_mob_by_key(carry.my_atom.fingerprintslast) + var/more = "" + if(M) + more = " " + msg_admin_attack("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 - msg_admin_attack("A chemical smoke reaction has taken place in ([whereLink]). No associated key. CODERS: carry.my_atom may be null.", 0, 1) - log_game("A chemical smoke reaction has taken place in ([where])[contained]. No associated key. CODERS: carry.my_atom may be null.") + msg_admin_attack("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.") + else + msg_admin_attack("A chemical smoke reaction has taken place in ([whereLink]). No associated key. CODERS: carry.my_atom may be null.", 0, 1) + log_game("A chemical smoke reaction has taken place in ([where])[contained]. No associated key. CODERS: carry.my_atom may be null.") - start(effect_range = 2) - var/i = 0 +/datum/effect/system/chem_smoke_spread/start(effect_range = 2) + var/i = 0 - var/color = mix_color_from_reagents(chemholder.reagents.reagent_list) - var/obj/effect/effect/chem_smoke/smokeholder = new /obj/effect/effect/chem_smoke(src.location) - for(var/atom/A in view(effect_range, smokeholder)) - chemholder.reagents.reaction(A) - if(iscarbon(A)) - var/mob/living/carbon/C = A - if(C.can_breathe_gas()) - chemholder.reagents.copy_to(C, chemholder.reagents.total_volume) - qdel(smokeholder) - 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(color) - smoke.icon += color // give the smoke color, if it has any to begin with + var/color = mix_color_from_reagents(chemholder.reagents.reagent_list) + var/obj/effect/effect/chem_smoke/smokeholder = new /obj/effect/effect/chem_smoke(src.location) + for(var/atom/A in view(effect_range, smokeholder)) + chemholder.reagents.reaction(A) + if(iscarbon(A)) + var/mob/living/carbon/C = A + if(C.can_breathe_gas()) + chemholder.reagents.copy_to(C, chemholder.reagents.total_volume) + qdel(smokeholder) + 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 - // 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/system/sleep_smoke_spread/set_up(n = 5, c = 0, loca, direct) + if(n > 20) + n = 20 + number = n + cardinals = c + if(istype(loca, /turf/)) + location = loca + else + location = get_turf(loca) + if(direct) + direction = direct - - 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 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 20) - n = 20 - number = n - cardinals = c - if(istype(loca, /turf/)) - location = loca - else - location = get_turf(loca) - if(direct) - direction = direct +/datum/effect/system/mustard_gas_spread/set_up(n = 5, c = 0, loca, direct) + if(n > 20) + n = 20 + number = n + cardinals = c + if(istype(loca, /turf/)) + location = loca + else + location = get_turf(loca) + if(direct) + direction = direct - start() - var/i = 0 - for(i=0, i 20) - return - spawn(0) - if(holder) - src.location = get_turf(holder) - var/obj/effect/effect/mustard_gas/smoke = new /obj/effect/effect/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 20) + return + spawn(0) + if(holder) + src.location = get_turf(holder) + var/obj/effect/effect/mustard_gas/smoke = new /obj/effect/effect/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 10) - n = 10 - number = n - cardinals = c - if(istype(loca, /turf/)) - location = loca - else - location = get_turf(loca) +/datum/effect/system/spark_spread/set_up(n = 3, c = 0, loca) + if(n > 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 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 - location = loc +/datum/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