From edba4e0529ed35a454b2424f67463aab6393af86 Mon Sep 17 00:00:00 2001 From: phil235 Date: Sat, 18 Apr 2015 20:30:35 +0200 Subject: [PATCH] Fix reagents not using current_cycle var for their stuff. Fixes current_cycle being incremented twice for certain reagents. Fixes flash never working for /datum/effect/effect/system/reagents_explosion because of a typo. Readding nitroglycerin reagent, it can now be stabilized with stabilizing agent and can explodes when exposed to 474K (like blackpowder). Readjusted black powder explosion: no more flash (like nitroglycerin), tweaked the values a bit to not nerf blackpowder explosion. Adding changelog. --- .../effects/effect_system/effects_other.dm | 2 +- .../Drink-Reagents/Drinks.dm | 49 ++++--- .../Consumable-Reagents/Food-Reagents.dm | 1 - .../Chemistry-Reagents/Medicine-Reagents.dm | 9 +- .../Pyrotechnic-Reagents.dm | 8 +- .../Chemistry-Reagents/Toxin-Reagents.dm | 4 +- .../Chemistry-Recipes/Pyrotechnics.dm | 125 ++++++++++-------- html/changelogs/phil235-Chems.yml | 11 ++ 8 files changed, 116 insertions(+), 93 deletions(-) create mode 100644 html/changelogs/phil235-Chems.yml diff --git a/code/game/objects/effects/effect_system/effects_other.dm b/code/game/objects/effects/effect_system/effects_other.dm index 740a6da9566..93219cb61b4 100644 --- a/code/game/objects/effects/effect_system/effects_other.dm +++ b/code/game/objects/effects/effect_system/effects_other.dm @@ -102,7 +102,7 @@ if (round(amount/3) > 0) light = min (MAX_EX_LIGHT_RANGE, light + round(amount/3)) - if (flash && flashing_factor) + if (flashing && flashing_factor) flash += (round(amount/4) * flashing_factor) explosion(location, devastation, heavy, light, flash) diff --git a/code/modules/reagents/Chemistry-Reagents/Consumable-Reagents/Drink-Reagents/Drinks.dm b/code/modules/reagents/Chemistry-Reagents/Consumable-Reagents/Drink-Reagents/Drinks.dm index 53c56a9ff70..2ba1088cda7 100644 --- a/code/modules/reagents/Chemistry-Reagents/Consumable-Reagents/Drink-Reagents/Drinks.dm +++ b/code/modules/reagents/Chemistry-Reagents/Consumable-Reagents/Drink-Reagents/Drinks.dm @@ -55,7 +55,6 @@ datum/reagent/consumable/carrotjuice/on_mob_life(var/mob/living/M as mob) if(21 to INFINITY) if (prob(current_cycle-10)) M.disabilities &= ~NEARSIGHT - current_cycle++ ..() return @@ -472,7 +471,6 @@ datum/reagent/consumable/atomicbomb/on_mob_life(var/mob/living/M as mob) if (!M.slurring) M.slurring = 1 M.slurring += 3 - current_cycle++ switch(current_cycle) if(51 to 200) M.sleeping += 1 @@ -489,18 +487,19 @@ datum/reagent/consumable/gargle_blaster color = "#664300" // rgb: 102, 67, 0 datum/reagent/consumable/gargle_blaster/on_mob_life(var/mob/living/M as mob) - current_cycle++ M.dizziness +=6 - if(current_cycle >= 15 && current_cycle <45) - if (!M.slurring) - M.slurring = 1 - M.slurring += 3 - else if(current_cycle >= 45 && prob(50) && current_cycle <55) - M.confused = max(M.confused+3,0) - else if(current_cycle >=55) - M.druggy = max(M.druggy, 55) - else if(current_cycle >=200) - M.adjustToxLoss(2) + switch(current_cycle) + if(15 to 45) + if(!M.slurring) + M.slurring = 1 + M.slurring += 3 + if(45 to 55) + if(prob(50)) + M.confused = max(M.confused+3,0) + if(55 to 200) + M.druggy = max(M.druggy, 55) + if(200 to INFINITY) + M.adjustToxLoss(2) ..() return @@ -512,18 +511,19 @@ datum/reagent/consumable/neurotoxin datum/reagent/consumable/neurotoxin/on_mob_life(var/mob/living/carbon/M as mob) M.weakened = max(M.weakened, 3) - current_cycle++ M.dizziness +=6 - if(current_cycle >= 15 && current_cycle <45) - if (!M.slurring) - M.slurring = 1 - M.slurring += 3 - else if(current_cycle >= 45 && prob(50) && current_cycle <55) - M.confused = max(M.confused+3,0) - else if(current_cycle >=55) - M.druggy = max(M.druggy, 55) - else if(current_cycle >=200) - M.adjustToxLoss(2) + switch(current_cycle) + if(15 to 45) + if(!M.slurring) + M.slurring = 1 + M.slurring += 3 + if(45 to 55) + if(prob(50)) + M.confused = max(M.confused+3,0) + if(55 to 200) + M.druggy = max(M.druggy, 55) + if(200 to INFINITY) + M.adjustToxLoss(2) ..() return @@ -537,7 +537,6 @@ datum/reagent/consumable/hippies_delight datum/reagent/consumable/hippies_delight/on_mob_life(var/mob/living/M as mob) M.druggy = max(M.druggy, 50) - current_cycle++ switch(current_cycle) if(1 to 5) if (!M.slurring) M.slurring = 1 diff --git a/code/modules/reagents/Chemistry-Reagents/Consumable-Reagents/Food-Reagents.dm b/code/modules/reagents/Chemistry-Reagents/Consumable-Reagents/Food-Reagents.dm index af94ba121fa..e10d2af11ec 100644 --- a/code/modules/reagents/Chemistry-Reagents/Consumable-Reagents/Food-Reagents.dm +++ b/code/modules/reagents/Chemistry-Reagents/Consumable-Reagents/Food-Reagents.dm @@ -288,7 +288,6 @@ datum/reagent/mushroomhallucinogen/on_mob_life(var/mob/living/M as mob) M.druggy = max(M.druggy, 40) if(prob(30)) M.emote(pick("twitch","giggle")) - current_cycle++ ..() return diff --git a/code/modules/reagents/Chemistry-Reagents/Medicine-Reagents.dm b/code/modules/reagents/Chemistry-Reagents/Medicine-Reagents.dm index c4425c6d595..700315b3e36 100644 --- a/code/modules/reagents/Chemistry-Reagents/Medicine-Reagents.dm +++ b/code/modules/reagents/Chemistry-Reagents/Medicine-Reagents.dm @@ -125,7 +125,6 @@ datum/reagent/medicine/rezadone color = "#669900" // rgb: 102, 153, 0 datum/reagent/medicine/rezadone/on_mob_life(var/mob/living/M as mob) - current_cycle++ switch(current_cycle) if(1 to 15) M.adjustCloneLoss(-1) @@ -465,7 +464,6 @@ datum/reagent/medicine/morphine description = "Will allow you to ignore slowdown from equipment and damage. Will eventually knock you out if you take too much. If overdosed it will cause jitteriness, dizziness, force the victim to drop items in their hands and eventually deal toxin damage." reagent_state = LIQUID color = "#C8A5DC" - var/cycle_count = 0 metabolization_rate = 0.5 * REAGENTS_METABOLISM overdose_threshold = 30 addiction_threshold = 25 @@ -473,9 +471,8 @@ datum/reagent/medicine/morphine datum/reagent/medicine/morphine/on_mob_life(var/mob/living/M as mob) M.status_flags |= IGNORESLOWDOWN - if(cycle_count >= 36) + if(current_cycle >= 36) M.sleeping += 3 - cycle_count++ ..() return @@ -536,11 +533,9 @@ datum/reagent/medicine/oculine reagent_state = LIQUID color = "#C8A5DC" metabolization_rate = 0.25 * REAGENTS_METABOLISM - var/cycle_amount = 0 datum/reagent/medicine/oculine/on_mob_life(var/mob/living/M as mob) - cycle_amount++ - if(M.eye_blind > 0 && cycle_amount > 20) + if(M.eye_blind > 0 && current_cycle > 20) if(prob(30)) M.eye_blind = 0 else if(prob(80)) diff --git a/code/modules/reagents/Chemistry-Reagents/Pyrotechnic-Reagents.dm b/code/modules/reagents/Chemistry-Reagents/Pyrotechnic-Reagents.dm index abe7b21c1f6..a5704d0b950 100644 --- a/code/modules/reagents/Chemistry-Reagents/Pyrotechnic-Reagents.dm +++ b/code/modules/reagents/Chemistry-Reagents/Pyrotechnic-Reagents.dm @@ -21,6 +21,12 @@ datum/reagent/thermite/on_mob_life(var/mob/living/M as mob) M.adjustFireLoss(1) ..() +datum/reagent/nitroglycerin + name = "Nitroglycerin" + id = "nitroglycerin" + description = "Nitroglycerin is a heavy, colorless, oily, explosive liquid obtained by nitrating glycerol." + color = "#808080" // rgb: 128, 128, 128 + /datum/reagent/stabilizing_agent name = "Stabilizing Agent" id = "stabilizing_agent" @@ -90,7 +96,7 @@ datum/reagent/thermite/on_mob_life(var/mob/living/M as mob) /datum/reagent/blackpowder/on_ex_act() var/location = get_turf(holder.my_atom) var/datum/effect/effect/system/reagents_explosion/e = new() - e.set_up(round(volume/8, 1), location, 1, 4, message = 0) + e.set_up(1 + round(volume/6, 1), location, 0, 0, message = 0) e.start() holder.clear_reagents() diff --git a/code/modules/reagents/Chemistry-Reagents/Toxin-Reagents.dm b/code/modules/reagents/Chemistry-Reagents/Toxin-Reagents.dm index 7f53a393efd..d20c1e40d65 100644 --- a/code/modules/reagents/Chemistry-Reagents/Toxin-Reagents.dm +++ b/code/modules/reagents/Chemistry-Reagents/Toxin-Reagents.dm @@ -253,7 +253,6 @@ datum/reagent/toxin/chloralhydrate metabolization_rate = 1.5 * REAGENTS_METABOLISM datum/reagent/toxin/chloralhydrate/on_mob_life(var/mob/living/M as mob) - current_cycle++ switch(current_cycle) if(1 to 10) M.confused += 2 @@ -280,7 +279,6 @@ datum/reagent/toxin/beer2/on_mob_life(var/mob/living/M as mob) if(51 to INFINITY) M.sleeping += 1 M.adjustToxLoss((current_cycle - 50)*REM) - current_cycle++ ..() return @@ -414,7 +412,7 @@ datum/reagent/toxin/neurotoxin2/on_mob_life(var/mob/living/M as mob) if(M.brainloss + M.toxloss <= 60) M.adjustBrainLoss(1*REM) M.adjustToxLoss(1*REM) - if(current_cycle == 54) + if(current_cycle >= 54) M.sleeping += 5 ..() diff --git a/code/modules/reagents/Chemistry-Recipes/Pyrotechnics.dm b/code/modules/reagents/Chemistry-Recipes/Pyrotechnics.dm index 3f5d1e03f51..d53162d2a96 100644 --- a/code/modules/reagents/Chemistry-Recipes/Pyrotechnics.dm +++ b/code/modules/reagents/Chemistry-Recipes/Pyrotechnics.dm @@ -1,4 +1,74 @@ +/datum/chemical_reaction/nitroglycerin + name = "Nitroglycerin" + id = "nitroglycerin" + result = "nitroglycerin" + required_reagents = list("glycerol" = 1, "facid" = 1, "sacid" = 1) + result_amount = 2 + +/datum/chemical_reaction/nitroglycerin/on_reaction(var/datum/reagents/holder, var/created_volume) + if(holder.has_reagent("stabilizing_agent")) + return + holder.remove_reagent("nitroglycerin", created_volume) + var/location = get_turf(holder.my_atom) + var/datum/effect/effect/system/reagents_explosion/e = new() + e.set_up(round (created_volume/2, 1), location, 0, 0) + e.start() + holder.clear_reagents() + +/datum/chemical_reaction/nitroglycerin_explosion + name = "Nitroglycerin explosion" + id = "nitroglycerin_explosion" + result = null + required_reagents = list("nitroglycerin" = 1) + result_amount = 1 + required_temp = 474 + +/datum/chemical_reaction/nitroglycerin_explosion/on_reaction(var/datum/reagents/holder, var/created_volume) + var/location = get_turf(holder.my_atom) + var/datum/effect/effect/system/reagents_explosion/e = new() + e.set_up(round(created_volume/2, 1), location, 0, 0) + e.start() + holder.clear_reagents() + +/datum/chemical_reaction/potassium_explosion + name = "Explosion" + id = "potassium_explosion" + result = null + required_reagents = list("water" = 1, "potassium" = 1) + result_amount = 2 + +/datum/chemical_reaction/potassium_explosion/on_reaction(var/datum/reagents/holder, var/created_volume) + var/location = get_turf(holder.my_atom) + var/datum/effect/effect/system/reagents_explosion/e = new() + e.set_up(round (created_volume/10, 1), location, 0, 0) + e.start() + holder.clear_reagents() + +/datum/chemical_reaction/blackpowder + name = "Black Powder" + id = "blackpowder" + result = "blackpowder" + required_reagents = list("saltpetre" = 1, "charcoal" = 1, "sulfur" = 1) + result_amount = 3 + +/datum/chemical_reaction/blackpowder_explosion + name = "Black Powder Kaboom" + id = "blackpowder_explosion" + result = null + required_reagents = list("blackpowder" = 1) + result_amount = 1 + required_temp = 474 + mix_message = "Sparks start flying around the black powder!" + +/datum/chemical_reaction/blackpowder_explosion/on_reaction(var/datum/reagents/holder, var/created_volume) + sleep(rand(50,100)) + var/location = get_turf(holder.my_atom) + var/datum/effect/effect/system/reagents_explosion/e = new() + e.set_up(1 + round(created_volume/6, 1), location, 0, 0) + e.start() + holder.clear_reagents() + /datum/chemical_reaction/thermite name = "Thermite" id = "thermite" @@ -6,34 +76,6 @@ required_reagents = list("aluminium" = 1, "iron" = 1, "oxygen" = 1) result_amount = 3 -/datum/chemical_reaction/explosion_nitroglycerin - name = "Nitroglycerin explosion" - id = "explosion_nitroglycerin" - result = null - required_reagents = list("glycerol" = 1, "facid" = 1, "sacid" = 1) - result_amount = 2 - -/datum/chemical_reaction/explosion_nitroglycerin/on_reaction(var/datum/reagents/holder, var/created_volume) - var/location = get_turf(holder.my_atom) - var/datum/effect/effect/system/reagents_explosion/e = new() - e.set_up(round(created_volume/2, 1), location, 0, 0) - e.start() - holder.clear_reagents() - -/datum/chemical_reaction/explosion_potassium - name = "Explosion" - id = "explosion_potassium" - result = null - required_reagents = list("water" = 1, "potassium" = 1) - result_amount = 2 - -/datum/chemical_reaction/explosion_potassium/on_reaction(var/datum/reagents/holder, var/created_volume) - var/location = get_turf(holder.my_atom) - var/datum/effect/effect/system/reagents_explosion/e = new() - e.set_up(round (created_volume/10, 1), location, 0, 0) - e.start() - holder.clear_reagents() - /datum/chemical_reaction/emp_pulse name = "EMP Pulse" id = "emp_pulse" @@ -48,8 +90,6 @@ empulse(location, round(created_volume / 24), round(created_volume / 14), 1) holder.clear_reagents() - - /datum/chemical_reaction/stabilizing_agent name = "stabilizing_agent" id = "stabilizing_agent" @@ -123,31 +163,6 @@ var/turf/simulated/T = get_turf(holder.my_atom) goonchem_vortex(T, 0, 5, 6) -/datum/chemical_reaction/blackpowder - name = "Black Powder" - id = "blackpowder" - result = "blackpowder" - required_reagents = list("saltpetre" = 1, "charcoal" = 1, "sulfur" = 1) - result_amount = 3 - -/datum/chemical_reaction/blackpowder_explosion - name = "Black Powder Kaboom" - id = "blackpowder_explosion" - result = null - required_reagents = list("blackpowder" = 1) - result_amount = 1 - required_temp = 474 - mix_message = "Sparks start flying around the black powder!" - -/datum/chemical_reaction/blackpowder_explosion/on_reaction(var/datum/reagents/holder, var/created_volume) - sleep(rand(50,100)) - var/location = get_turf(holder.my_atom) - var/datum/effect/effect/system/reagents_explosion/e = new() - e.set_up(round(created_volume/8, 1), location, 1, 4, message = 0) - e.start() - holder.clear_reagents() - - /datum/chemical_reaction/flash_powder name = "Flash powder" id = "flash_powder" diff --git a/html/changelogs/phil235-Chems.yml b/html/changelogs/phil235-Chems.yml new file mode 100644 index 00000000000..c16574fd7af --- /dev/null +++ b/html/changelogs/phil235-Chems.yml @@ -0,0 +1,11 @@ + +author: phil235 + +delete-after: True + +changes: + - tweak: "Reagents are now back to being metabolized every tick. Fixes frost oil and capsaicin not working." + - tweak: "Fixes not being able to make sterilizine." + - rscadd: "Adding overdose to space drug, causing mild hallucination and toxin and brain damage." + - tweak: "Nerfed healing power of stimulant reagent. Buffed ephedrine a bit." + - rscadd: "Nitroglycerin can now be stabilized with stabilizing agent, and explodes when heated."