From 177045c98057190896878efcc2cdc0340c21c1dd Mon Sep 17 00:00:00 2001 From: kevinz000 Date: Wed, 14 Sep 2016 17:59:23 -0700 Subject: [PATCH] [Ready]Electrical Chemistry (Tesla grenades) (#20448) Teslium is now easier to make, and as with most electronics, no longer mixes with water. tesla_act and tesla_zap both now have arguments to specify whether they explode machinery. By default only the tesla engine will explode machinery. This means that Tesla Revolvers will no longer cause a large area to implode if there is no one nearby the target of it to shock. This also means that tesla-grill bolts will no longer blow things up. --- code/game/machinery/machinery.dm | 4 +- code/game/objects/objs.dm | 4 +- .../recipes/tablecraft/recipes_cake.dm | 2 +- code/modules/power/lighting.dm | 5 ++- code/modules/power/tesla/energy_ball.dm | 16 ++++---- .../reagents/pyrotechnic_reagents.dm | 22 +++++++++- .../chemistry/reagents/toxin_reagents.dm | 18 -------- .../chemistry/recipes/pyrotechnics.dm | 41 +++++++++++++++++++ .../reagents/chemistry/recipes/toxins.dm | 8 ---- 9 files changed, 77 insertions(+), 43 deletions(-) diff --git a/code/game/machinery/machinery.dm b/code/game/machinery/machinery.dm index 4203573df56..2b7232cfc6d 100644 --- a/code/game/machinery/machinery.dm +++ b/code/game/machinery/machinery.dm @@ -459,9 +459,9 @@ Class Procs: . = 1 -/obj/machinery/tesla_act(var/power) +/obj/machinery/tesla_act(power, explosive = FALSE) ..() - if(prob(85)) + if(prob(85) && explosive) explosion(src.loc,1,2,4,flame_range = 2, adminlog = 0, smoke = 0) else if(prob(50)) emp_act(2) diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm index 22e1473d8c4..89a48c7c22c 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -216,10 +216,10 @@ if(burn) Item.fire_act() //Set them on fire, too -/obj/proc/tesla_act(var/power) +/obj/proc/tesla_act(power, explosive = FALSE) being_shocked = 1 var/power_bounced = power / 2 - tesla_zap(src, 3, power_bounced) + tesla_zap(src, 3, power_bounced, explosive) addtimer(src, "reset_shocked", 10) /obj/proc/reset_shocked() diff --git a/code/modules/food_and_drinks/recipes/tablecraft/recipes_cake.dm b/code/modules/food_and_drinks/recipes/tablecraft/recipes_cake.dm index 8229391e50e..439db2986b0 100644 --- a/code/modules/food_and_drinks/recipes/tablecraft/recipes_cake.dm +++ b/code/modules/food_and_drinks/recipes/tablecraft/recipes_cake.dm @@ -111,7 +111,7 @@ /obj/item/weapon/reagent_containers/food/snacks/meat/slab = 3, /datum/reagent/blood = 30, /datum/reagent/consumable/sprinkles = 5, - /datum/reagent/toxin/teslium = 1 //To shock the whole thing into life + /datum/reagent/teslium = 1 //To shock the whole thing into life ) result = /mob/living/simple_animal/pet/cat/cak category = CAT_CAKE //Cat! Haha, get it? CAT? GET IT??? diff --git a/code/modules/power/lighting.dm b/code/modules/power/lighting.dm index 41e77f5f886..6dd8f092ea1 100644 --- a/code/modules/power/lighting.dm +++ b/code/modules/power/lighting.dm @@ -534,8 +534,9 @@ else flicker() -/obj/machinery/light/tesla_act(var/power) - explosion(src.loc,0,0,0,flame_range = 5, adminlog = 0) +/obj/machinery/light/tesla_act(power, explosive = FALSE) + if(explosive) + explosion(src.loc,0,0,0,flame_range = 5, adminlog = 0) qdel(src) // called when area power state changes diff --git a/code/modules/power/tesla/energy_ball.dm b/code/modules/power/tesla/energy_ball.dm index 433056473ed..4b7399cad3e 100644 --- a/code/modules/power/tesla/energy_ball.dm +++ b/code/modules/power/tesla/energy_ball.dm @@ -65,13 +65,13 @@ var/list/blacklisted_tesla_types = typecacheof(list(/obj/machinery/atmospherics, pixel_x = 0 pixel_y = 0 - setDir(tesla_zap(src, 7, TESLA_DEFAULT_POWER)) + setDir(tesla_zap(src, 7, TESLA_DEFAULT_POWER, TRUE)) pixel_x = -32 pixel_y = -32 for (var/ball in orbiting_balls) var/range = rand(1, Clamp(orbiting_balls.len, 3, 7)) - tesla_zap(ball, range, TESLA_MINI_POWER/7*range) + tesla_zap(ball, range, TESLA_MINI_POWER/7*range, TRUE) else energy = 0 // ensure we dont have miniballs of miniballs @@ -152,7 +152,7 @@ var/list/blacklisted_tesla_types = typecacheof(list(/obj/machinery/atmospherics, var/mob/living/carbon/C = A C.dust() -/proc/tesla_zap(var/atom/source, zap_range = 3, power) +/proc/tesla_zap(atom/source, zap_range = 3, power, explosive = FALSE) . = source.dir if(power < 1000) return @@ -243,10 +243,10 @@ var/list/blacklisted_tesla_types = typecacheof(list(/obj/machinery/atmospherics, //per type stuff: if(closest_tesla_coil) - closest_tesla_coil.tesla_act(power) + closest_tesla_coil.tesla_act(power, explosive) else if(closest_grounding_rod) - closest_grounding_rod.tesla_act(power) + closest_grounding_rod.tesla_act(power, explosive) else if(closest_mob) var/shock_damage = Clamp(round(power/400), 10, 90) + rand(-5, 5) @@ -259,10 +259,10 @@ var/list/blacklisted_tesla_types = typecacheof(list(/obj/machinery/atmospherics, tesla_zap(closest_mob, 5, power / 1.5) else if(closest_machine) - closest_machine.tesla_act(power) + closest_machine.tesla_act(power, explosive) else if(closest_blob) - closest_blob.tesla_act(power) + closest_blob.tesla_act(power, explosive) else if(closest_structure) - closest_structure.tesla_act(power) + closest_structure.tesla_act(power, explosive) diff --git a/code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm b/code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm index 22d718e0b76..d2958b475da 100644 --- a/code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm @@ -164,7 +164,7 @@ /datum/reagent/cryostylane name = "Cryostylane" id = "cryostylane" - description = "Comes into existence at 20K. As long as there is sufficient oxygen for it to react with, Cryostylane slowly cools all other reagents in the mob down to 0K." + description = "Comes into existence at 20K. As long as there is sufficient oxygen for it to react with, Cryostylane slowly cools all other reagents in the container 0K." color = "#0000DC" metabolization_rate = 0.5 * REAGENTS_METABOLISM @@ -190,7 +190,7 @@ /datum/reagent/pyrosium name = "Pyrosium" id = "pyrosium" - description = "Comes into existence at 20K. As long as there is sufficient oxygen for it to react with, Pyrosium slowly cools all other reagents in the mob down to 0K." + description = "Comes into existence at 20K. As long as there is sufficient oxygen for it to react with, Pyrosium slowly heats all other reagents in the container." color = "#64FAC8" metabolization_rate = 0.5 * REAGENTS_METABOLISM @@ -206,3 +206,21 @@ holder.chem_temp += 10 holder.handle_reactions() ..() + +/datum/reagent/teslium //Teslium. Causes periodic shocks, and makes shocks against the target much more effective. + name = "Teslium" + id = "teslium" + description = "An unstable, electrically-charged metallic slurry. Periodically electrocutes its victim, and makes electrocutions against them more deadly. Excessively heating teslium results in dangerous destabilization. Do not allow to come into contact with water." + reagent_state = LIQUID + color = "#20324D" //RGB: 32, 50, 77 + metabolization_rate = 0.5 * REAGENTS_METABOLISM + var/shock_timer = 0 + +/datum/reagent/teslium/on_mob_life(mob/living/M) + shock_timer++ + if(shock_timer >= rand(5,30)) //Random shocks are wildly unpredictable + shock_timer = 0 + M.electrocute_act(rand(5,20), "Teslium in their body", 1, 1) //Override because it's caused from INSIDE of you + playsound(M, "sparks", 50, 1) + ..() + diff --git a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm index 7f6c1c4cbb4..2d344c1276e 100644 --- a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm @@ -657,24 +657,6 @@ . = 1 return ..() || . -/datum/reagent/toxin/teslium //Teslium. Causes periodic shocks, and makes shocks against the target much more effective. - name = "Teslium" - id = "teslium" - description = "An unstable, electrically-charged metallic slurry. Periodically electrocutes its victim, and makes electrocutions against them more deadly." - reagent_state = LIQUID - color = "#20324D" //RGB: 32, 50, 77 - metabolization_rate = 0.5 * REAGENTS_METABOLISM - toxpwr = 0 - var/shock_timer = 0 - -/datum/reagent/toxin/teslium/on_mob_life(mob/living/M) - shock_timer++ - if(shock_timer >= rand(5,30)) //Random shocks are wildly unpredictable - shock_timer = 0 - M.electrocute_act(rand(5,20), "Teslium in their body", 1, 1) //Override because it's caused from INSIDE of you - playsound(M, "sparks", 50, 1) - ..() - //ACID diff --git a/code/modules/reagents/chemistry/recipes/pyrotechnics.dm b/code/modules/reagents/chemistry/recipes/pyrotechnics.dm index 6cb48f90552..ab7c9dd746e 100644 --- a/code/modules/reagents/chemistry/recipes/pyrotechnics.dm +++ b/code/modules/reagents/chemistry/recipes/pyrotechnics.dm @@ -352,3 +352,44 @@ /datum/chemical_reaction/pyrosium/on_reaction(datum/reagents/holder, created_volume) holder.chem_temp = 20 // also cools the fuck down return + +/datum/chemical_reaction/teslium + name = "Teslium" + id = "teslium" + results = list("teslium" = 3) + required_reagents = list("stable_plasma" = 1, "silver" = 1, "blackpowder" = 1) + mix_message = "A jet of sparks flies from the mixture as it merges into a flickering slurry." + required_temp = 400 + +/datum/chemical_reaction/reagent_explosion/teslium_lightning + name = "Teslium Destabilization" + id = "teslium_lightning" + required_reagents = list("teslium" = 1, "water" = 1) + results = list("destabilized_teslium" = 1) + strengthdiv = 100 + modifier = -100 + mix_message = "The teslium starts to spark as electricity arcs away from it!" + mix_sound = 'sound/machines/defib_zap.ogg' + +/datum/chemical_reaction/reagent_explosion/teslium_lightning/on_reaction(datum/reagents/holder, created_volume) + var/T1 = created_volume * 20 //100 units : Zap 3 times, with powers 2000/5000/12000. Tesla revolvers have a power of 10000 for comparison. + var/T2 = created_volume * 50 + var/T3 = created_volume * 120 + sleep(10) + if(created_volume >= 75) //10 units minimum for lightning, 40 units for secondary blast, 75 units for tertiary blast. + tesla_zap(holder.my_atom, 7, T1) + playsound(holder.my_atom, 'sound/machines/defib_zap.ogg', 50, 1) + sleep(10) + if(created_volume >= 40) + tesla_zap(holder.my_atom, 7, T2) + playsound(holder.my_atom, 'sound/machines/defib_zap.ogg', 50, 1) + sleep(10) + if(created_volume >= 10) + tesla_zap(holder.my_atom, 7, T3) + playsound(holder.my_atom, 'sound/machines/defib_zap.ogg', 50, 1) + ..() + +/datum/chemical_reaction/reagent_explosion/teslium_lightning/heat + id = "teslium_lightning2" + required_temp = 474 + required_reagents = list("teslium" = 1) diff --git a/code/modules/reagents/chemistry/recipes/toxins.dm b/code/modules/reagents/chemistry/recipes/toxins.dm index 5d4fd3ba501..53fcb2bc473 100644 --- a/code/modules/reagents/chemistry/recipes/toxins.dm +++ b/code/modules/reagents/chemistry/recipes/toxins.dm @@ -81,14 +81,6 @@ results = list("mindbreaker" = 5) required_reagents = list("silicon" = 1, "hydrogen" = 1, "charcoal" = 1) -/datum/chemical_reaction/teslium - name = "Teslium" - id = "teslium" - results = list("teslium" = 3) - required_reagents = list("plasma" = 1, "silver" = 1, "blackpowder" = 1) - mix_message = "A jet of sparks flies from the mixture as it merges into a flickering slurry." - required_temp = 400 - /datum/chemical_reaction/heparin name = "Heparin" id = "Heparin"