Chem master analyze fix, synthtissue update

This commit is contained in:
Archie
2021-01-03 07:15:51 -03:00
parent efb7bc7b45
commit 622a6232b0
5 changed files with 76 additions and 22 deletions
+1 -2
View File
@@ -237,7 +237,7 @@
src.handle_reactions()
return amount
/datum/reagents/proc/trans_id_to(obj/target, reagent, amount=1, preserve_data=1)//Not sure why this proc didn't exist before. It does now! /N
/datum/reagents/proc/trans_id_to(obj/target, reagent, amount = 1, preserve_data = TRUE)//Not sure why this proc didn't exist before. It does now! /N
var/list/cached_reagents = reagent_list
if (!target)
return
@@ -257,7 +257,6 @@
if(preserve_data)
trans_data = current_reagent.data
R.add_reagent(current_reagent.type, amount, trans_data, chem_temp, current_reagent.purity, pH, no_react = TRUE)
remove_reagent(current_reagent.type, amount, 1)
break
@@ -148,8 +148,8 @@
/obj/machinery/chem_master/on_deconstruction()
var/atom/A = drop_location()
beaker.forceMove(A)
bottle.forceMove(A)
beaker?.forceMove(A)
bottle?.forceMove(A)
return ..()
/obj/machinery/chem_master/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
@@ -216,15 +216,18 @@
if(beaker)
var/reagent = GLOB.name2reagent[params["id"]]
var/amount = text2num(params["amount"])
message_admins("[amount] + [reagent]")
if (amount > 0)
end_fermi_reaction()
beaker.reagents.trans_id_to(src, reagent, amount)
message_admins("Passed Transfer Phase")
. = TRUE
else if (amount == -1) // -1 means custom amount
useramount = input("Enter the Amount you want to transfer:", name, useramount) as num|null
if (useramount > 0)
end_fermi_reaction()
beaker.reagents.trans_id_to(src, reagent, useramount)
message_admins("Passed Transfer Phase")
. = TRUE
if("transferFromBuffer")
@@ -434,11 +437,11 @@
state = "Gas"
var/const/P = 3 //The number of seconds between life ticks
var/T = initial(R.metabolization_rate) * (60 / P)
var/datum/chemical_reaction/Rcr = get_chemical_reaction(R.type)
var/datum/chemical_reaction/Rcr = get_chemical_reaction(R)
if(Rcr && Rcr.FermiChem)
fermianalyze = TRUE
var/pHpeakCache = (Rcr.OptimalpHMin + Rcr.OptimalpHMax)/2
var/datum/reagent/targetReagent = beaker.reagents.has_reagent(R.type)
var/datum/reagent/targetReagent = beaker.reagents.has_reagent(R)
if(!targetReagent)
CRASH("Tried to find a reagent that doesn't exist in the chem_master!")
@@ -463,9 +466,9 @@
var/T = initial(R.metabolization_rate) * (60 / P)
if(istype(R, /datum/reagent/fermi))
fermianalyze = TRUE
var/datum/chemical_reaction/Rcr = get_chemical_reaction(R.type)
var/datum/chemical_reaction/Rcr = get_chemical_reaction(R)
var/pHpeakCache = (Rcr.OptimalpHMin + Rcr.OptimalpHMax)/2
var/datum/reagent/targetReagent = reagents.has_reagent(R.type)
var/datum/reagent/targetReagent = reagents.has_reagent(R)
if(!targetReagent)
CRASH("Tried to find a reagent that doesn't exist in the chem_master!")
@@ -483,7 +486,9 @@
/obj/machinery/chem_master/proc/end_fermi_reaction()//Ends any reactions upon moving.
if(beaker.reagents.fermiIsReacting)
message_admins("fermi reaction end called")
if(beaker && beaker.reagents.fermiIsReacting)
message_admins("fermi is reacting, calling end")
beaker.reagents.fermiEnd()
/obj/machinery/chem_master/proc/isgoodnumber(num)
@@ -1,5 +1,4 @@
#define REM REAGENTS_EFFECT_MULTIPLIER
GLOBAL_LIST_INIT(name2reagent, build_name2reagent())
/proc/build_name2reagent()
@@ -86,7 +86,7 @@
CurveSharppH = 2.5 // How sharp the pH exponential curve is (to the power of value)
ThermicConstant = 0.01 // Temperature change per 1u produced
HIonRelease = 0.015 // pH change per 1u reaction (inverse for some reason)
RateUpLim = 0.05 // Optimal/max rate possible if all conditions are perfect
RateUpLim = 0.1 // Optimal/max rate possible if all conditions are perfect
FermiChem = TRUE // If the chemical uses the Fermichem reaction mechanics
PurityMin = 0
@@ -101,7 +101,8 @@
if(St.purity < 1)
St.volume *= St.purity
St.purity = 1
N.volume -= 0.002
var/amount = CLAMP(0.002, 0, N.volume)
N.volume -= amount
St.data["grown_volume"] = St.data["grown_volume"] + added_volume
St.name = "[initial(St.name)] [round(St.data["grown_volume"], 0.1)]u colony"