From 3ba7f57cd1a89ab54a05524bbf59a069e0fdaf04 Mon Sep 17 00:00:00 2001 From: Fermi Date: Mon, 22 Apr 2019 23:53:16 +0100 Subject: [PATCH] Setting FermiReact to be part of a PROCESSING call. --- code/modules/reagents/chemistry/holder.dm | 41 +++++++++++++++---- code/modules/reagents/chemistry/reagents.dm | 1 + .../chemistry/reagents/fermi_reagents.dm | 21 +++++++--- 3 files changed, 49 insertions(+), 14 deletions(-) diff --git a/code/modules/reagents/chemistry/holder.dm b/code/modules/reagents/chemistry/holder.dm index 6abb41cc79..42417acc39 100644 --- a/code/modules/reagents/chemistry/holder.dm +++ b/code/modules/reagents/chemistry/holder.dm @@ -53,6 +53,10 @@ var/addiction_tick = 1 var/list/datum/reagent/addiction_list = new/list() var/reagents_holder_flags + //var/targetVol = 0 + //var/reactedVol = 0 + var/fermiIsReacting = FALSE + var/fermiReactID = null /datum/reagents/New(maximum=100) maximum_volume = maximum @@ -346,8 +350,16 @@ var/reaction_occurred = 0 // checks if reaction, binary variable var/continue_reacting = FALSE //Helps keep track what kind of reaction is occuring; standard or fermi. - var/targetVol = 0 - var/reactedVol = 0 + + if(fermiIsReacting == TRUE) + if (reactedVol >= targetVol) + STOP_PROCESSING(SSprocessing, src) + fermiIsReacting = FALSE + message_admins("FermiChem processing stopped") + reaction_occurred = 1 + return + + do //What does do do in byond? It sounds very redundant? is it a while loop? var/list/possible_reactions = list() //init list @@ -450,16 +462,24 @@ //if(selected_reaction) var/datum/chemical_reaction/C = selected_reaction - if (C.FermiChem == TRUE && !continue_reacting == TRUE) + if (C.FermiChem == TRUE && !continue_reacting) message_admins("FermiChem Proc'd") reaction_occurred = 1 for(var/P in selected_reaction.results) targetVol = cached_results[P]*multiplier - if (chem_temp > C.C.OptimalTempMin)//To prevent pointless reactions - while (reactedVol < targetVol) - reactedVol = FermiReact(selected_reaction, chem_temp, pH, multiplier, reactedVol, targetVol, cached_required_reagents, cached_results) + if (chem_temp > C.OptimalTempMin)//To prevent pointless reactions + if (reactedVol < targetVol) + reactedVol = FermiReact(selected_reaction, chem_temp, pH, multiplier, reactedVol, targetVol, cached_required_reagents, cached_results) + START_PROCESSING(SSprocessing, src) + message_admins("FermiChem processing started") + fermiIsReacting = TRUE + else + fermiIsReacting = FALSE + STOP_PROCESSING(SSprocessing, src) + message_admins("FermiChem processing stopped, 2nd catch, this shouldn't appear.") + SSblackbox.record_feedback("tally", "Fermi_chemical_reaction", reactedVol, C.id)//log @@ -506,12 +526,15 @@ update_total()//Don't know waht this does. return 0//end! +/datum/reagents/process() + handle_reactions() + /datum/reagents/proc/FermiReact(selected_reaction, chem_temp, pH, multiplier, reactedVol, targetVol, cached_required_reagents, cached_results) var/datum/chemical_reaction/C = selected_reaction var/deltaT = 0 var/deltapH = 0 var/stepChemAmmount = 0 - var/ammoReacted = 0 + //var/ammoReacted = 0 //get purity from combined beaker reactant purities HERE. var/purity = 1 //var/tempVol = totalVol @@ -577,7 +600,7 @@ message_admins("target volume reached. Reaction should stop after this loop") if (reactedVol > 0) - purity = ((purity * ammoReacted) + (deltapH * stepChemAmmount)) /((ammoReacted + stepChemAmmount)) //This should add the purity to the product + purity = ((purity * reactedVol) + (deltapH * stepChemAmmount)) /((reactedVol+ stepChemAmmount)) //This should add the purity to the product else purity = deltapH message_admins("purity: [purity], purity of beaker") @@ -608,7 +631,7 @@ reactedVol = reactedVol + stepChemAmmount - return (reactedVol) + return //(reactedVol) /datum/reagents/proc/FermiExplode() return diff --git a/code/modules/reagents/chemistry/reagents.dm b/code/modules/reagents/chemistry/reagents.dm index a52bb1ecfe..01810b9713 100644 --- a/code/modules/reagents/chemistry/reagents.dm +++ b/code/modules/reagents/chemistry/reagents.dm @@ -33,6 +33,7 @@ var/addiction_stage4_end = 40 var/overdosed = 0 // You fucked up and this is now triggering its overdose effects, purge that shit quick. var/self_consuming = FALSE + var/purity = 1 //Fermichem var /datum/reagent/Destroy() // This should only be called by the holder, so it's already handled clearing its references . = ..() 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 0a12e40bd6..d10fda80d1 100644 --- a/modular_citadel/code/modules/reagents/chemistry/reagents/fermi_reagents.dm +++ b/modular_citadel/code/modules/reagents/chemistry/reagents/fermi_reagents.dm @@ -32,15 +32,22 @@ overdose_threshold = 20 addiction_threshold = 30 metabolization_rate = 0.5 * REAGENTS_METABOLISM - addiction_stage3_end = 40 - addiction_stage4_end = 55 //Incase it's too long + addiction_stage2_end = 20 + addiction_stage3_end = 22 + addiction_stage4_end = 24 //Incase it's too long var/turf/open/location_created = null var/turf/open/location_return = null var/addictCyc3 = 1 var/mob/living/fermi_Tclone = null + var/teleBool = FALSE ///obj/item/reagent/fermi/eigenstate/Initialize() +/datum/reagent/fermi/eigenstate/on_new() + . = ..() //Needed! + location_created = get_turf(src) //Sets up coordinate of where it was created + ..() + /datum/reagent/fermi/eigenstate/New() . = ..() //Needed! location_created = get_turf(src) //Sets up coordinate of where it was created @@ -48,7 +55,7 @@ /datum/reagent/fermi/eigenstate/on_mob_life(mob/living/carbon/M) //Teleports to chemistry! - if (holder.has_reagent("eigenstate")) + if (teleBool == TRUE) do_sparks(5,FALSE,M) else location_return = get_turf(src) //sets up return point @@ -56,6 +63,7 @@ do_sparks(5,FALSE,M) M.forceMove(location_created) //Teleports to creation location do_sparks(5,FALSE,M) + teleBool = TRUE ..() /datum/reagent/fermi/eigenstate/on_mob_delete(mob/living/M) //returns back to original location @@ -63,6 +71,7 @@ to_chat(M, "You feel your wavefunction collapse!") M.forceMove(location_return) //Teleports home do_sparks(5,FALSE,src) + teleBool = FALSE ..() /datum/reagent/fermi/eigenstate/overdose_start(mob/living/M) //Overdose, makes you teleport randomly @@ -95,8 +104,9 @@ M.AdjustKnockdown(-40, 0) for(var/item in M.get_contents()) var/obj/item/I = item + M.dropItemToGround(I, TRUE) do_teleport(I, get_turf(I), 5, no_effects=TRUE); - ..() + //..() /datum/reagent/fermi/eigenstate/addiction_act_stage3(mob/living/M)//Pulls multiple copies of the character from alternative realities while teleporting them around! M.Jitter(100) @@ -119,6 +129,7 @@ // C.updateappearance(mutcolor_update=1) M.visible_message("[M] collapses in from an alternative reality!") + message_admins("Fermi T Clone: [fermi_Tclone]") if(2) do_teleport(fermi_Tclone, get_turf(fermi_Tclone), 3, no_effects=TRUE) //teleports clone so it's hard to find the real one! if(3) @@ -136,7 +147,7 @@ to_chat(M, "You feel your eigenstate settle, snapping an alternative version of yourself into reality. All your previous memories are lost and replaced with the alternative version of yourself. This version of you feels more [pick("affectionate", "happy", "lusty", "radical", "shy", "ambitious", "frank", "voracious", "sensible", "witty")] than your previous self, sent to god knows what universe.") M.emote("me",1,"gasps and gazes around in a bewildered and highly confused fashion!",TRUE) SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "Alternative dimension", /datum/mood_event/eigenstate) - ..() + //..() ///datum/reagent/fermi/eigenstate/overheat_explode(mob/living/M) // return