From 79a7b6b45b178cc8883336fb7369dd6d8e92ba8c Mon Sep 17 00:00:00 2001 From: Fermi Date: Mon, 27 May 2019 20:25:57 +0100 Subject: [PATCH] Fixes. --- code/game/say.dm | 1 - code/modules/jobs/job_types/medical.dm | 2 +- code/modules/reagents/chemistry/holder.dm | 47 ++++++++++++------- code/modules/research/designs/misc_designs.dm | 2 +- code/modules/vending/wardrobes.dm | 2 +- .../code/modules/arousal/organs/genitals.dm | 21 +++++++-- .../chemistry/reagents/fermi_reagents.dm | 43 +++++++++-------- .../reagents/chemistry/recipes/fermi.dm | 36 ++++---------- .../code/modules/reagents/objects/items.dm | 20 ++++---- 9 files changed, 97 insertions(+), 77 deletions(-) diff --git a/code/game/say.dm b/code/game/say.dm index a6cf177140..e797fe5e64 100644 --- a/code/game/say.dm +++ b/code/game/say.dm @@ -29,7 +29,6 @@ GLOBAL_LIST_INIT(freqtospan, list( send_speech(message, 7, src, , spans, message_language=language) /atom/movable/proc/Hear(message, atom/movable/speaker, message_language, raw_message, radio_freq, list/spans, message_mode) - //message_admins("Pre: [message], [speaker], [message_language], [raw_message], [radio_freq], [spans], [message_mode]") SEND_SIGNAL(src, COMSIG_MOVABLE_HEAR, message, speaker, message_language, raw_message, radio_freq, spans, message_mode) /atom/movable/proc/can_speak() diff --git a/code/modules/jobs/job_types/medical.dm b/code/modules/jobs/job_types/medical.dm index 6447077173..716e58f417 100644 --- a/code/modules/jobs/job_types/medical.dm +++ b/code/modules/jobs/job_types/medical.dm @@ -127,7 +127,7 @@ Chemist backpack = /obj/item/storage/backpack/chemistry satchel = /obj/item/storage/backpack/satchel/chem duffelbag = /obj/item/storage/backpack/duffelbag/med - l_hand = /obj/item/pHbooklet + l_hand = /obj/item/FermiChem/pHbooklet chameleon_extras = /obj/item/gun/syringe diff --git a/code/modules/reagents/chemistry/holder.dm b/code/modules/reagents/chemistry/holder.dm index 61b7ab2c1a..0e3d10850b 100644 --- a/code/modules/reagents/chemistry/holder.dm +++ b/code/modules/reagents/chemistry/holder.dm @@ -128,7 +128,7 @@ im update_total() handle_reactions() - pH = REAGENT_NORMAL_PH //Maybe unnessicary? NO incredibly nessicary, blows the beaker up otherwise + //pH = REAGENT_NORMAL_PH //Maybe unnessicary? NO incredibly nessicary, blows the beaker up otherwise. YES 100% NOT REQUIRED, THIS IS FOR REAMOVING AN AMMOUNT, NOT ALL. return amount /datum/reagents/proc/get_master_reagent_name() @@ -684,20 +684,37 @@ im //Then adjust purity of result with reagent purity. purity *= reactant_purity(C) + /*old + stepChemAmmount = CLAMP(((deltaT * cached_results[P]) * multiplier), 0, (targetVol - reactedVol)) //used to have multipler, now it does + if (stepChemAmmount * cached_results[P] > C.RateUpLim) + stepChemAmmount = C.RateUpLim + else if (stepChemAmmount <= 0.01) + stepChemAmmount = 0.01 + */ + var/removeChemAmmount + var/addChemAmmount + //ONLY WORKS FOR ONE PRODUCT AT THE MOMENT + for(var/P in cached_results) + //stepChemAmmount = CLAMP(((deltaT * multiplier), 0, ((targetVol - reactedVol)/cached_results[P])) //used to have multipler, now it does + stepChemAmmount = (multiplier*cached_results[P]) + if (stepChemAmmount >= C.RateUpLim) + stepChemAmmount = (C.RateUpLim)//something weird with this line maybe. + addChemAmmount = deltaT * stepChemAmmount + if (addChemAmmount >= (targetVol - reactedVol)) + addChemAmmount = (targetVol - reactedVol) + if (addChemAmmount < 0.01) + addChemAmmount = 0.01 + removeChemAmmount = (addChemAmmount/cached_results[P]) + message_admins("Reaction vars: PreReacted: [reactedVol] of [targetVol]. deltaT [deltaT], multiplier [multiplier], Step [stepChemAmmount], uncapped Step [deltaT*(multiplier*cached_results[P])], addChemAmmount [addChemAmmount], removeFactor [removeChemAmmount] Pfactor [cached_results[P]], adding [addChemAmmount]") + for(var/B in cached_required_reagents) - remove_reagent(B, (stepChemAmmount * cached_required_reagents[B]), safety = 1)//safety? removes reagents from beaker using remove function. + remove_reagent(B, (removeChemAmmount * cached_required_reagents[B]), safety = 1)//safety? removes reagents from beaker using remove function. var/TotalStep = 0 for(var/P in cached_results)//Not sure how this works, what is selected_reaction.results? - stepChemAmmount = CLAMP(((deltaT * cached_results[P]) * multiplier), 0, (targetVol - reactedVol)) //used to have multipler, now it does - if (stepChemAmmount * cached_results[P] > C.RateUpLim) - stepChemAmmount = C.RateUpLim - else if (stepChemAmmount <= 0.01) - stepChemAmmount = 0.01 - SSblackbox.record_feedback("tally", "chemical_reaction", cached_results[P]*stepChemAmmount, P)//log - add_reagent(P, (stepChemAmmount), null, cached_temp, purity)//add reagent function!! I THINK I can do this: - TotalStep += stepChemAmmount//for multiple products + add_reagent(P, (addChemAmmount), null, cached_temp, purity)//add reagent function!! I THINK I can do this: + TotalStep += addChemAmmount//for multiple products //Above should reduce yeild based on holder purity. //Purity Check //NOT MULTIPROD SAFE. TODO: Add multiproduct support @@ -711,10 +728,10 @@ im C.FermiCreate(src)//proc that calls when step is done //Apply pH changes and thermal output of reaction to beaker - chem_temp = round(cached_temp + (C.ThermicConstant * stepChemAmmount)) //Why won't you update!!! Because I'm silly. - pH += (C.HIonRelease * stepChemAmmount)//honestly pH shifting is so confusing + chem_temp = round(cached_temp + (C.ThermicConstant * addChemAmmount)) //Why won't you update!!! Because I'm silly. + pH += (C.HIonRelease * addChemAmmount)//honestly pH shifting is so confusing //keep track of the current reacted amount - reactedVol = reactedVol + stepChemAmmount + reactedVol = reactedVol + addChemAmmount //return said amount to compare for next step. return (reactedVol) @@ -891,8 +908,6 @@ im update_total() if(my_atom) my_atom.on_reagent_change(ADD_REAGENT) - //if(R.FermiChem == TRUE) - // R.on_mob_add(my_atom) R.on_merge(data, amount, my_atom, other_purity) if(istype(D, /datum/reagent/fermi))//Is this a fermichem? var/datum/reagent/fermi/Ferm = D //It's Fermi time! @@ -958,7 +973,7 @@ im if (R.id == reagent) //clamp the removal amount to be between current reagent amount //and zero, to prevent removing more than the holder has stored - if((total_volume - amount) == 0)//Because this can result in 0, I don't want it to crash. + if((total_volume - amount) <= 0)//Because this can result in 0, I don't want it to crash. pH = 7 else pH = ((pH * total_volume)-(R.pH * amount))/(total_volume - amount) diff --git a/code/modules/research/designs/misc_designs.dm b/code/modules/research/designs/misc_designs.dm index 2e6908ea30..e33895f831 100644 --- a/code/modules/research/designs/misc_designs.dm +++ b/code/modules/research/designs/misc_designs.dm @@ -462,7 +462,7 @@ id = "pHmeter" build_type = PROTOLATHE materials = list(MAT_METAL = 1000, MAT_SILVER = 100, MAT_DIAMOND = 100) - build_path = /obj/item/pHmeter + build_path = /obj/item/FermiChem/pHmeter category = list("Equipment") departmental_flags = DEPARTMENTAL_FLAG_MEDICAL diff --git a/code/modules/vending/wardrobes.dm b/code/modules/vending/wardrobes.dm index cbb0e552b1..c40bec7eda 100644 --- a/code/modules/vending/wardrobes.dm +++ b/code/modules/vending/wardrobes.dm @@ -313,7 +313,7 @@ /obj/item/storage/backpack/chemistry = 3, /obj/item/storage/backpack/satchel/chem = 3, /obj/item/storage/bag/chemistry = 3, - /obj/item/pHbooklet = 3)//pH indicator) + /obj/item/FermiChem/pHbooklet = 3)//pH indicator) refill_canister = /obj/item/vending_refill/wardrobe/chem_wardrobe /obj/item/vending_refill/wardrobe/chem_wardrobe diff --git a/modular_citadel/code/modules/arousal/organs/genitals.dm b/modular_citadel/code/modules/arousal/organs/genitals.dm index 049252e5b7..cc14e5ad95 100644 --- a/modular_citadel/code/modules/arousal/organs/genitals.dm +++ b/modular_citadel/code/modules/arousal/organs/genitals.dm @@ -293,8 +293,8 @@ dna.species.use_skintones = TRUE return //So people who haven't set stuff up don't get rainbow surprises. - dna.features["cock_color"] = "#[dna.features["mcolor"]]" - dna.features["breasts_color"] = "#[dna.features["mcolor"]]" + //dna.features["cock_color"] = "#[dna.features["mcolor"]]" + //dna.features["breasts_color"] = "#[dna.features["mcolor"]]" return /datum/species/proc/handle_genitals(mob/living/carbon/human/H)//more like handle sadness @@ -360,7 +360,22 @@ genital_overlay.color = "#[H.dna.features["breasts_color"]]" if("vag_color") genital_overlay.color = "#[H.dna.features["vag_color"]]" - + //This was removed for some reason, but it breaks my code, so now it's back!! Tadahhh. + if(MUTCOLORS) + if(fixed_mut_color) + genital_overlay.color = "#[fixed_mut_color]" + else + genital_overlay.color = "#[H.dna.features["mcolor"]]" + if(MUTCOLORS2) + if(fixed_mut_color2) + genital_overlay.color = "#[fixed_mut_color2]" + else + genital_overlay.color = "#[H.dna.features["mcolor2"]]" + if(MUTCOLORS3) + if(fixed_mut_color3) + genital_overlay.color = "#[fixed_mut_color3]" + else + genital_overlay.color = "#[H.dna.features["mcolor3"]]" standing += genital_overlay if(LAZYLEN(standing)) H.overlays_standing[layer] = standing.Copy() diff --git a/modular_citadel/code/modules/reagents/chemistry/reagents/fermi_reagents.dm b/modular_citadel/code/modules/reagents/chemistry/reagents/fermi_reagents.dm index 66f7f5fe45..52ec12b899 100644 --- a/modular_citadel/code/modules/reagents/chemistry/reagents/fermi_reagents.dm +++ b/modular_citadel/code/modules/reagents/chemistry/reagents/fermi_reagents.dm @@ -617,9 +617,10 @@ IMPORTANT FACTORS TO CONSIDER WHILE BALANCING if(!B) H.emergent_genital_call() return - var/sizeConv = list("a" = 1, "b" = 2, "c" = 3, "d" = 4, "e" = 5) - B.prev_size = B.size - B.cached_size = sizeConv[B.size] + if(!B.size == "huge") + var/sizeConv = list("a" = 1, "b" = 2, "c" = 3, "d" = 4, "e" = 5) + B.prev_size = B.size + B.cached_size = sizeConv[B.size] //message_admins("init B size: [B.size], prev: [B.prev_size], cache = [B.cached_size], raw: [sizeConv[B.size]]") //if this runtimes it's cause someone's breasts are too big! /datum/reagent/fermi/BElarger/on_mob_life(mob/living/carbon/M) //Increases breast size @@ -1110,11 +1111,11 @@ And as stated earlier, this chem is hard to make, and is punishing on failure. Y //FERMICHEM2 split into different chems /datum/reagent/fermi/enthrall/on_mob_add(mob/living/carbon/M) . = ..() - if(!creatorID) - CRASH("Something went wrong in enthral creation THIS SHOULD NOT APPEAR") - return if(!ishuman(M))//Just to make sure screwy stuff doesn't happen. return + if(!creatorID) + CRASH("Something went wrong in enthral creation THIS SHOULD NOT APPEAR") //nervermind this appears when you blow up the reaction. I dunno how + return var/datum/status_effect/chem/enthrall/E = M.has_status_effect(/datum/status_effect/chem/enthrall) //Somehow a beaker got here? (what) if(E) return @@ -1141,7 +1142,7 @@ And as stated earlier, this chem is hard to make, and is punishing on failure. Y return var/list/seen = viewers(7, get_turf(M))//Sound and sight checkers for(var/victim in seen) - if((victim == /mob/living/simple_animal/pet/) || (victim == M)) + if((victim == /mob/living/simple_animal/pet/) || (victim == M) || (!M.client)) seen = seen - victim if(!seen) return @@ -1150,9 +1151,9 @@ And as stated earlier, this chem is hard to make, and is punishing on failure. Y return else // If someone else drinks it, the creator falls in love with them! var/mob/living/carbon/C = get_mob_by_key(creatorID) - if(C.has_status_effect(STATUS_EFFECT_INLOVE)) + if(M.has_status_effect(STATUS_EFFECT_INLOVE)) return - if(C in viewers(7, get_turf(M))) + if((C in viewers(7, get_turf(M))) && (C.client)) M.reagents.remove_reagent(src.id, src.volume) FallInLove(C, M) return @@ -1550,23 +1551,25 @@ And as stated earlier, this chem is hard to make, and is punishing on failure. Y description = "This reagent will consume itself and move the pH of a beaker towards 3 when added to another." taste_description = "an acidy sort of taste, blech." color = "#fbc314" - addProc = FALSE - pH = 6 + pH = 3 -/datum/reagent/fermi/fermiABuffer/on_new() +/datum/reagent/fermi/fermiABuffer/on_new(datapH) message_admins("Adding acid") + src.data = datapH if(LAZYLEN(holder.reagent_list) == 1) return - src.pH = data + /*to be fixed later + pH = data if (pH <= 3) pH = 3 else if (pH >= 7) pH = 7 + */ holder.pH = ((holder.pH * holder.total_volume)+(pH * src.volume))/(holder.total_volume + src.volume) //Shouldn't be required var/list/seen = viewers(5, get_turf(holder)) for(var/mob/M in seen) - to_chat(M, "The beaker fizzes as the buffer's pH changes!") + to_chat(M, "The beaker fizzes as the pH changes!") playsound(get_turf(holder), 'sound/FermiChem/bufferadd.ogg', 50, 1, -1) holder.remove_reagent(src.id, 1000) ..() @@ -1577,22 +1580,24 @@ And as stated earlier, this chem is hard to make, and is punishing on failure. Y description = "This reagent will consume itself and move the pH of a beaker towards 11 when added to another." taste_description = "an soapy sort of taste, blech." color = "#3853a4" - addProc = FALSE - pH = 8 + pH = 11 -/datum/reagent/fermi/fermiBBuffer/on_new() +/datum/reagent/fermi/fermiBBuffer/on_new(datapH) message_admins("Adding base") + src.data = datapH if(LAZYLEN(holder.reagent_list) == 1) return + /*to be fixed later src.pH = data if (pH >= 11) pH = 11 else if (pH <= 7) pH = 7 + */ holder.pH = ((holder.pH * holder.total_volume)+(pH * src.volume))/(holder.total_volume + src.volume) //Shouldn't be required Might be..? var/list/seen = viewers(5, get_turf(holder)) for(var/mob/M in seen) - to_chat(M, "The beaker froths as the buffer's pH changes!") - playsound(get_turf(holder), 'sound/FermiChem/bufferadd.ogg', 50, 1, -1) + to_chat(M, "The beaker froths as the pH changes!") + playsound(get_turf(holder.my_atom), 'sound/FermiChem/bufferadd.ogg', 50, 1) holder.remove_reagent(src.id, 1000) ..() diff --git a/modular_citadel/code/modules/reagents/chemistry/recipes/fermi.dm b/modular_citadel/code/modules/reagents/chemistry/recipes/fermi.dm index 96d8d4c601..496ffe6461 100644 --- a/modular_citadel/code/modules/reagents/chemistry/recipes/fermi.dm +++ b/modular_citadel/code/modules/reagents/chemistry/recipes/fermi.dm @@ -88,7 +88,7 @@ CurveSharppH = 2 // How sharp the pH exponential curve is (to the power of value) ThermicConstant = 5 //Temperature change per 1u produced HIonRelease = -0.1 //pH change per 1u reaction - RateUpLim = 5 //Optimal/max rate possible if all conditions are perfect (NEEDS TO BE A MULTIPLE OF 10 IF RESULTS IS DOWN BY A FACTOR OF 10) + RateUpLim = 5 //Optimal/max rate possible if all conditions are perfect FermiChem = TRUE//If the chemical uses the Fermichem reaction mechanics FermiExplode = FALSE //If the chemical explodes in a special way @@ -218,7 +218,7 @@ CurveSharppH = 1 ThermicConstant = 25 HIonRelease = -0.5 - RateUpLim = 10 + RateUpLim = 20 FermiChem = TRUE FermiExplode = TRUE PurityMin = 0.25 // explode purity! @@ -235,7 +235,7 @@ //FermiChem vars: OptimalTempMin = 780 OptimalTempMax = 800 - ExplodeTemp = 820 + ExplodeTemp = 830 OptimalpHMin = 12 OptimalpHMax = 13 ReactpHLim = 2 @@ -244,7 +244,7 @@ CurveSharppH = 4 ThermicConstant = 10 HIonRelease = -0.1 - RateUpLim = 2 + RateUpLim = 1 FermiChem = TRUE FermiExplode = TRUE PurityMin = 0.2 @@ -280,7 +280,6 @@ s.set_up(R, volume, T) s.start() my_atom.reagents.clear_reagents() - ..(volume = 0, pH = 7) //Just a lil fire. /datum/chemical_reaction/fermi/hatmium // done name = "Hat growth serum" @@ -342,7 +341,7 @@ /datum/chemical_reaction/fermi/naninte_b_gone//done test name = "Naninte bain" id = "naninte_b_gone" - results = list("naninte_b_gone" = 2) + results = list("naninte_b_gone" = 20) required_reagents = list("synthflesh" = 5, "uranium" = 5, "iron" = 5, "salglu_solution" = 5) mix_message = "the reaction gurgles, encapsulating the reagents in flesh before the emp can be set off." required_temp = 499//To force fermireactions before EMP. @@ -382,19 +381,10 @@ RateUpLim = 20 FermiChem = TRUE -//This reaction bugs and turns everything in it to FermiABuffer - but now it's a feature instead! And then I fixed it anyways + /datum/chemical_reaction/fermi/fermiABuffer/FermiFinish(datum/reagents/holder, var/atom/my_atom) //might need this var/datum/reagent/fermi/fermiABuffer/Fa = locate(/datum/reagent/fermi/fermiABuffer) in my_atom.reagents.reagent_list - if (Fa.pH <= 3) - Fa.pH = 3 - Fa.data = 3 - return - else if (Fa.pH >= 7) - Fa.pH = 7 - Fa.data = 7 - return - Fa.pH = my_atom.reagents.pH - Fa.data = Fa.pH + Fa.data = 3 /datum/chemical_reaction/fermi/fermiBBuffer//done test name = "Ethyl Ethanoate buffer" @@ -417,15 +407,7 @@ RateUpLim = 15 FermiChem = TRUE -//This reaction bugs and turns everything in it to FermiBBuffer - but now it's a feature instead! And then I fixed it anyways + /datum/chemical_reaction/fermi/fermiBBuffer/FermiFinish(datum/reagents/holder, var/atom/my_atom) //might need this var/datum/reagent/fermi/fermiBBuffer/Fb = locate(/datum/reagent/fermi/fermiBBuffer) in my_atom.reagents.reagent_list - if (Fb.pH >= 11) - Fb.pH = 11 - Fb.data = 11 - return - else if (Fb.pH <= 7) - Fb.pH = 7 - Fb.data = 7 - Fb.pH = my_atom.reagents.pH - Fb.data = Fb.pH + Fb.data = 11 diff --git a/modular_citadel/code/modules/reagents/objects/items.dm b/modular_citadel/code/modules/reagents/objects/items.dm index 457514df88..30b9c8d711 100644 --- a/modular_citadel/code/modules/reagents/objects/items.dm +++ b/modular_citadel/code/modules/reagents/objects/items.dm @@ -1,4 +1,4 @@ -/obj/item/pHbooklet +/obj/item/FermiChem/pHbooklet name = "pH indicator booklet" desc = "A booklet containing paper soaked in universal indicator." icon_state = "pHbooklet" @@ -10,10 +10,10 @@ //set flammable somehow //A little janky with pockets -/obj/item/pHbooklet/attack_hand(mob/user) +/obj/item/FermiChem/pHbooklet/attack_hand(mob/user) if(user.get_held_index_of_item(src)) if(numberOfPages >= 1) - var/obj/item/pHpaper/P = new /obj/item/pHpaper + var/obj/item/FermiChem/pHpaper/P = new /obj/item/FermiChem/pHpaper P.add_fingerprint(user) P.forceMove(user.loc) user.put_in_active_hand(P) @@ -34,7 +34,7 @@ user.put_in_active_hand(src) return -/obj/item/pHpaper +/obj/item/FermiChem/pHpaper name = "pH indicator strip" desc = "A piece of paper that will change colour depending on the pH of a solution." icon_state = "pHpaper" @@ -46,12 +46,14 @@ w_class = WEIGHT_CLASS_TINY //set flammable somehow -/obj/item/pHpaper/afterattack(obj/item/reagent_containers/cont, mob/user, proximity) +/obj/item/FermiChem/pHpaper/afterattack(obj/item/reagent_containers/cont, mob/user, proximity) if(!istype(cont)) return if(used == TRUE) to_chat(user, "[user] has already been used!") return + if(LAZYLEN(cont.reagents.reagent_list) == null) + return switch(round(cont.reagents.pH, 1)) if(14 to INFINITY) color = "#462c83" @@ -86,7 +88,7 @@ desc += " The paper looks to be around a pH of [round(cont.reagents.pH, 1)]" used = TRUE -/obj/item/pHmeter +/obj/item/FermiChem/pHmeter name = "pH meter" desc = "A a electrode attached to a small circuit box that will tell you the pH of a solution. The screen currently displays nothing." icon_state = "pHmeter" @@ -94,8 +96,10 @@ resistance_flags = FLAMMABLE w_class = WEIGHT_CLASS_TINY -/obj/item/pHmeter/afterattack(obj/item/reagent_containers/cont, mob/user, proximity) +/obj/item/FermiChem/pHmeter/afterattack(obj/item/reagent_containers/cont, mob/user, proximity) if(!istype(cont)) return - to_chat(src, "gives a beep and displays [round(cont.reagents.pH, 0.1)]") + if(LAZYLEN(cont.reagents.reagent_list) == null) + return + to_chat(user, "The pH meter beeps and displays [round(cont.reagents.pH, 0.1)]") desc = "An electrode attached to a small circuit box that will tell you the pH of a solution. The screen currently displays [round(cont.reagents.pH, 0.1)]."