mirror of
https://github.com/SPLURT-Station/S.P.L.U.R.T-Station-13.git
synced 2025-12-10 18:02:57 +00:00
Fixing things and gui
This commit is contained in:
@@ -973,10 +973,8 @@
|
|||||||
for(var/A in cached_reagents)
|
for(var/A in cached_reagents)
|
||||||
var/datum/reagent/R = A
|
var/datum/reagent/R = A
|
||||||
if (R.type == reagent)
|
if (R.type == reagent)
|
||||||
if((total_volume - amount) <= 0)//Because this can result in 0, I don't want it to crash.
|
|
||||||
pH = REAGENT_NORMAL_PH
|
|
||||||
//In practice this is really confusing and players feel like it randomly melts their beakers, but I'm not sure how else to handle it. We'll see how it goes and I can remove this if it confuses people.
|
//In practice this is really confusing and players feel like it randomly melts their beakers, but I'm not sure how else to handle it. We'll see how it goes and I can remove this if it confuses people.
|
||||||
else if (!ignore_pH)
|
if(!ignore_pH)
|
||||||
//if (((pH > R.pH) && (pH <= 7)) || ((pH < R.pH) && (pH >= 7)))
|
//if (((pH > R.pH) && (pH <= 7)) || ((pH < R.pH) && (pH >= 7)))
|
||||||
pH = (((pH - R.pH) / total_volume) * amount) + pH
|
pH = (((pH - R.pH) / total_volume) * amount) + pH
|
||||||
if(istype(my_atom, /obj/item/reagent_containers/))
|
if(istype(my_atom, /obj/item/reagent_containers/))
|
||||||
@@ -987,6 +985,8 @@
|
|||||||
amount = clamp(amount, 0, R.volume)
|
amount = clamp(amount, 0, R.volume)
|
||||||
R.volume -= amount
|
R.volume -= amount
|
||||||
update_total()
|
update_total()
|
||||||
|
if(total_volume <= 0)//Because this can result in 0, I don't want it to crash.
|
||||||
|
pH = REAGENT_NORMAL_PH
|
||||||
if(!safety)//So it does not handle reactions when it need not to
|
if(!safety)//So it does not handle reactions when it need not to
|
||||||
handle_reactions()
|
handle_reactions()
|
||||||
if(my_atom)
|
if(my_atom)
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
circuit = /obj/item/circuitboard/machine/chem_dispenser
|
circuit = /obj/item/circuitboard/machine/chem_dispenser
|
||||||
var/obj/item/stock_parts/cell/cell
|
var/obj/item/stock_parts/cell/cell
|
||||||
var/powerefficiency = 0.0666666
|
var/powerefficiency = 0.0666666
|
||||||
|
var/dispenceUnit = 5
|
||||||
var/amount = 30
|
var/amount = 30
|
||||||
var/recharge_amount = 10
|
var/recharge_amount = 10
|
||||||
var/recharge_counter = 0
|
var/recharge_counter = 0
|
||||||
@@ -32,6 +33,7 @@
|
|||||||
var/nopower_state = "dispenser_nopower"
|
var/nopower_state = "dispenser_nopower"
|
||||||
var/has_panel_overlay = TRUE
|
var/has_panel_overlay = TRUE
|
||||||
var/obj/item/reagent_containers/beaker = null
|
var/obj/item/reagent_containers/beaker = null
|
||||||
|
var/list/stored_beakers = list()
|
||||||
var/list/dispensable_reagents = list(
|
var/list/dispensable_reagents = list(
|
||||||
/datum/reagent/hydrogen,
|
/datum/reagent/hydrogen,
|
||||||
/datum/reagent/lithium,
|
/datum/reagent/lithium,
|
||||||
@@ -58,7 +60,9 @@
|
|||||||
/datum/reagent/silver,
|
/datum/reagent/silver,
|
||||||
/datum/reagent/iodine,
|
/datum/reagent/iodine,
|
||||||
/datum/reagent/bromine,
|
/datum/reagent/bromine,
|
||||||
/datum/reagent/stable_plasma
|
/datum/reagent/stable_plasma,
|
||||||
|
/datum/reagent/fermi/acidic_buffer/weak,
|
||||||
|
/datum/reagent/fermi/basic_buffer/weak
|
||||||
)
|
)
|
||||||
//These become available once upgraded.
|
//These become available once upgraded.
|
||||||
var/list/upgrade_reagents = list(
|
var/list/upgrade_reagents = list(
|
||||||
@@ -102,6 +106,7 @@
|
|||||||
if(upgrade_reagents3)
|
if(upgrade_reagents3)
|
||||||
upgrade_reagents3 = sortList(upgrade_reagents3, /proc/cmp_reagents_asc)
|
upgrade_reagents3 = sortList(upgrade_reagents3, /proc/cmp_reagents_asc)
|
||||||
dispensable_reagents = sortList(dispensable_reagents, /proc/cmp_reagents_asc)
|
dispensable_reagents = sortList(dispensable_reagents, /proc/cmp_reagents_asc)
|
||||||
|
create_reagents(200, NO_REACT)
|
||||||
update_icon()
|
update_icon()
|
||||||
|
|
||||||
/obj/machinery/chem_dispenser/Destroy()
|
/obj/machinery/chem_dispenser/Destroy()
|
||||||
@@ -190,13 +195,16 @@
|
|||||||
data["amount"] = amount
|
data["amount"] = amount
|
||||||
data["energy"] = cell.charge ? cell.charge * powerefficiency : "0" //To prevent NaN in the UI.
|
data["energy"] = cell.charge ? cell.charge * powerefficiency : "0" //To prevent NaN in the UI.
|
||||||
data["maxEnergy"] = cell.maxcharge * powerefficiency
|
data["maxEnergy"] = cell.maxcharge * powerefficiency
|
||||||
|
data["storedVol"] = reagents.total_volume
|
||||||
|
data["maxVol"] = reagents.maximum_volume
|
||||||
data["isBeakerLoaded"] = beaker ? 1 : 0
|
data["isBeakerLoaded"] = beaker ? 1 : 0
|
||||||
|
data["stepAmount"] = dispenceUnit
|
||||||
|
|
||||||
var/beakerContents[0]
|
var/beakerContents[0]
|
||||||
var/beakerCurrentVolume = 0
|
var/beakerCurrentVolume = 0
|
||||||
if(beaker && beaker.reagents && beaker.reagents.reagent_list.len)
|
if(beaker && beaker.reagents && beaker.reagents.reagent_list.len)
|
||||||
for(var/datum/reagent/R in beaker.reagents.reagent_list)
|
for(var/datum/reagent/R in beaker.reagents.reagent_list)
|
||||||
beakerContents.Add(list(list("name" = R.name, "volume" = R.volume))) // list in a list because Byond merges the first list...
|
beakerContents.Add(list(list("name" = R.name, "id" = R.type, "volume" = R.volume))) // list in a list because Byond merges the first list...
|
||||||
beakerCurrentVolume += R.volume
|
beakerCurrentVolume += R.volume
|
||||||
data["beakerContents"] = beakerContents
|
data["beakerContents"] = beakerContents
|
||||||
|
|
||||||
@@ -204,10 +212,9 @@
|
|||||||
data["beakerCurrentVolume"] = beakerCurrentVolume
|
data["beakerCurrentVolume"] = beakerCurrentVolume
|
||||||
data["beakerMaxVolume"] = beaker.volume
|
data["beakerMaxVolume"] = beaker.volume
|
||||||
data["beakerTransferAmounts"] = beaker.possible_transfer_amounts
|
data["beakerTransferAmounts"] = beaker.possible_transfer_amounts
|
||||||
data["beakerCurrentpH"] = beaker.reagents.pH
|
|
||||||
//pH accuracy
|
//pH accuracy
|
||||||
for(var/obj/item/stock_parts/capacitor/C in component_parts)
|
for(var/obj/item/stock_parts/capacitor/C in component_parts)
|
||||||
data["partRating"]= 10**(C.rating-1)
|
data["beakerCurrentpH"] = round(beaker.reagents.pH, 10**-(C.rating+1))
|
||||||
|
|
||||||
else
|
else
|
||||||
data["beakerCurrentVolume"] = null
|
data["beakerCurrentVolume"] = null
|
||||||
@@ -225,11 +232,17 @@
|
|||||||
var/chemname = temp.name
|
var/chemname = temp.name
|
||||||
if(is_hallucinating && prob(5))
|
if(is_hallucinating && prob(5))
|
||||||
chemname = "[pick_list_replacements("hallucination.json", "chemicals")]"
|
chemname = "[pick_list_replacements("hallucination.json", "chemicals")]"
|
||||||
chemicals.Add(list(list("title" = chemname, "id" = ckey(temp.name))))
|
chemicals.Add(list(list("title" = chemname, "id" = ckey(temp.name), "pH" = temp.pH, "pHCol" = ConvertpHToCol(temp.pH))))
|
||||||
data["chemicals"] = chemicals
|
data["chemicals"] = chemicals
|
||||||
data["recipes"] = saved_recipes
|
data["recipes"] = saved_recipes
|
||||||
|
|
||||||
data["recordingRecipe"] = recording_recipe
|
data["recordingRecipe"] = recording_recipe
|
||||||
|
|
||||||
|
var/storedContents[0]
|
||||||
|
if(reagents.total_volume)
|
||||||
|
for(var/datum/reagent/N in reagents.reagent_list)
|
||||||
|
storedContents.Add(list(list("name" = N.name, "id" = N.type, "volume" = N.volume)))
|
||||||
|
data["storedContents"] = storedContents
|
||||||
return data
|
return data
|
||||||
|
|
||||||
/obj/machinery/chem_dispenser/ui_act(action, params)
|
/obj/machinery/chem_dispenser/ui_act(action, params)
|
||||||
@@ -240,10 +253,9 @@
|
|||||||
if(!is_operational() || QDELETED(beaker))
|
if(!is_operational() || QDELETED(beaker))
|
||||||
return
|
return
|
||||||
var/target = text2num(params["target"])
|
var/target = text2num(params["target"])
|
||||||
if(target in beaker.possible_transfer_amounts)
|
SetAmount(target)
|
||||||
amount = target
|
work_animation()
|
||||||
work_animation()
|
. = TRUE
|
||||||
. = TRUE
|
|
||||||
if("dispense")
|
if("dispense")
|
||||||
if(!is_operational() || QDELETED(cell))
|
if(!is_operational() || QDELETED(cell))
|
||||||
return
|
return
|
||||||
@@ -268,10 +280,9 @@
|
|||||||
if(!is_operational() || recording_recipe)
|
if(!is_operational() || recording_recipe)
|
||||||
return
|
return
|
||||||
var/amount = text2num(params["amount"])
|
var/amount = text2num(params["amount"])
|
||||||
if(beaker && (amount in beaker.possible_transfer_amounts))
|
beaker.reagents.remove_all(amount) //This should be set correctly in "amount"
|
||||||
beaker.reagents.remove_all(amount)
|
work_animation()
|
||||||
work_animation()
|
. = TRUE
|
||||||
. = TRUE
|
|
||||||
if("eject")
|
if("eject")
|
||||||
replace_beaker(usr)
|
replace_beaker(usr)
|
||||||
. = TRUE
|
. = TRUE
|
||||||
@@ -338,6 +349,48 @@
|
|||||||
recording_recipe = null
|
recording_recipe = null
|
||||||
. = TRUE
|
. = TRUE
|
||||||
|
|
||||||
|
//Storing and unstoring reagents
|
||||||
|
if("store")
|
||||||
|
if(!is_operational() || QDELETED(cell))
|
||||||
|
return
|
||||||
|
if(!beaker)
|
||||||
|
return
|
||||||
|
if(recording_recipe)
|
||||||
|
say("Cannot store while recording!")
|
||||||
|
return
|
||||||
|
if(beaker.reagents.fermiIsReacting)
|
||||||
|
say("Cannot store ongoing reactions!")
|
||||||
|
return
|
||||||
|
var/reagent = text2path(params["id"])
|
||||||
|
var/datum/reagent/R = beaker.reagents.has_reagent(reagent)
|
||||||
|
if(reagents.total_volume+amount > reagents.maximum_volume)
|
||||||
|
say("Not enough storage space left!")
|
||||||
|
return
|
||||||
|
beaker.reagents.trans_id_to(src, R.type, amount)
|
||||||
|
work_animation()
|
||||||
|
. = TRUE
|
||||||
|
|
||||||
|
if("unstore")
|
||||||
|
if(!is_operational() || QDELETED(cell))
|
||||||
|
return
|
||||||
|
if(!beaker)
|
||||||
|
return
|
||||||
|
if(recording_recipe)
|
||||||
|
say("Cannot distribute while recording!")
|
||||||
|
return
|
||||||
|
var/reagent = text2path(params["id"])
|
||||||
|
var/datum/reagent/R = reagents.has_reagent(reagent)
|
||||||
|
reagents.trans_id_to(beaker, R.type, amount)
|
||||||
|
work_animation()
|
||||||
|
. = TRUE
|
||||||
|
|
||||||
|
/obj/machinery/chem_dispenser/proc/SetAmount(inputAmount)
|
||||||
|
if(inputAmount % 5 == 0) //Always allow 5u values
|
||||||
|
amount = inputAmount
|
||||||
|
return
|
||||||
|
inputAmount -= inputAmount % dispenceUnit
|
||||||
|
amount = inputAmount
|
||||||
|
|
||||||
/obj/machinery/chem_dispenser/attackby(obj/item/I, mob/user, params)
|
/obj/machinery/chem_dispenser/attackby(obj/item/I, mob/user, params)
|
||||||
if(default_unfasten_wrench(user, I))
|
if(default_unfasten_wrench(user, I))
|
||||||
return
|
return
|
||||||
@@ -390,6 +443,8 @@
|
|||||||
cell = P
|
cell = P
|
||||||
for(var/obj/item/stock_parts/matter_bin/M in component_parts)
|
for(var/obj/item/stock_parts/matter_bin/M in component_parts)
|
||||||
newpowereff += 0.0166666666*M.rating
|
newpowereff += 0.0166666666*M.rating
|
||||||
|
if(reagents)
|
||||||
|
reagents.maximum_volume = 200*(M.rating+1)
|
||||||
for(var/obj/item/stock_parts/capacitor/C in component_parts)
|
for(var/obj/item/stock_parts/capacitor/C in component_parts)
|
||||||
recharge_amount *= C.rating
|
recharge_amount *= C.rating
|
||||||
for(var/obj/item/stock_parts/manipulator/M in component_parts)
|
for(var/obj/item/stock_parts/manipulator/M in component_parts)
|
||||||
@@ -399,6 +454,15 @@
|
|||||||
dispensable_reagents |= upgrade_reagents2
|
dispensable_reagents |= upgrade_reagents2
|
||||||
if(M.rating > 3)
|
if(M.rating > 3)
|
||||||
dispensable_reagents |= upgrade_reagents3
|
dispensable_reagents |= upgrade_reagents3
|
||||||
|
switch(M.rating)
|
||||||
|
if(0)
|
||||||
|
dispenceUnit = 5
|
||||||
|
if(1)
|
||||||
|
dispenceUnit = 3
|
||||||
|
if(2)
|
||||||
|
dispenceUnit = 2
|
||||||
|
if(3 to INFINITY)
|
||||||
|
dispenceUnit = 1
|
||||||
powerefficiency = round(newpowereff, 0.01)
|
powerefficiency = round(newpowereff, 0.01)
|
||||||
|
|
||||||
/obj/machinery/chem_dispenser/proc/replace_beaker(mob/living/user, obj/item/reagent_containers/new_beaker)
|
/obj/machinery/chem_dispenser/proc/replace_beaker(mob/living/user, obj/item/reagent_containers/new_beaker)
|
||||||
@@ -409,6 +473,8 @@
|
|||||||
user.put_in_hands(B)
|
user.put_in_hands(B)
|
||||||
if(new_beaker)
|
if(new_beaker)
|
||||||
beaker = new_beaker
|
beaker = new_beaker
|
||||||
|
if(amount > beaker.reagents.maximum_volume)
|
||||||
|
amount = beaker.reagents.maximum_volume
|
||||||
else
|
else
|
||||||
beaker = null
|
beaker = null
|
||||||
update_icon()
|
update_icon()
|
||||||
@@ -427,6 +493,32 @@
|
|||||||
replace_beaker(user)
|
replace_beaker(user)
|
||||||
return TRUE
|
return TRUE
|
||||||
|
|
||||||
|
/obj/machinery/chem_dispenser/proc/ConvertpHToCol(pH)
|
||||||
|
switch(pH)
|
||||||
|
if(-INFINITY to 1)
|
||||||
|
return "red"
|
||||||
|
if(1 to 2)
|
||||||
|
return "orange"
|
||||||
|
if(2 to 3)
|
||||||
|
return "average"
|
||||||
|
if(3 to 4)
|
||||||
|
return "yellow" //yellow looks really bad for some reason
|
||||||
|
if(4 to 5)
|
||||||
|
return "olive"
|
||||||
|
if(5 to 6)
|
||||||
|
return "good"
|
||||||
|
if(6 to 8)
|
||||||
|
return "green"
|
||||||
|
if(8 to 9.5)
|
||||||
|
return "teal"
|
||||||
|
if(9.5 to 11)
|
||||||
|
return "blue"
|
||||||
|
if(11 to 12.5)
|
||||||
|
return "violet"
|
||||||
|
if(12.5 to INFINITY)
|
||||||
|
return "purple"
|
||||||
|
|
||||||
|
|
||||||
/obj/machinery/chem_dispenser/drinks/Initialize()
|
/obj/machinery/chem_dispenser/drinks/Initialize()
|
||||||
. = ..()
|
. = ..()
|
||||||
AddComponent(/datum/component/simple_rotation, ROTATION_ALTCLICK | ROTATION_CLOCKWISE)
|
AddComponent(/datum/component/simple_rotation, ROTATION_ALTCLICK | ROTATION_CLOCKWISE)
|
||||||
@@ -453,6 +545,7 @@
|
|||||||
b_o.pixel_y = -7
|
b_o.pixel_y = -7
|
||||||
b_o.pixel_x = rand(-9, 9)
|
b_o.pixel_x = rand(-9, 9)
|
||||||
return b_o
|
return b_o
|
||||||
|
|
||||||
|
|
||||||
/obj/machinery/chem_dispenser/drinks
|
/obj/machinery/chem_dispenser/drinks
|
||||||
name = "soda dispenser"
|
name = "soda dispenser"
|
||||||
|
|||||||
@@ -126,7 +126,7 @@
|
|||||||
var beakerContents[0]
|
var beakerContents[0]
|
||||||
if(beaker)
|
if(beaker)
|
||||||
for(var/datum/reagent/R in beaker.reagents.reagent_list)
|
for(var/datum/reagent/R in beaker.reagents.reagent_list)
|
||||||
beakerContents.Add(list(list("name" = R.name, "volume" = R.volume, "purity" = R.purity))) // list in a list because Byond merges the first list...
|
beakerContents.Add(list(list("name" = R.name, "volume" = round(R.volume, 0.01), "purity" = round(R.purity, 0.01)))) // list in a list because Byond merges the first list...
|
||||||
data["beakerContents"] = beakerContents
|
data["beakerContents"] = beakerContents
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|||||||
@@ -184,13 +184,13 @@
|
|||||||
var/beakerContents[0]
|
var/beakerContents[0]
|
||||||
if(beaker)
|
if(beaker)
|
||||||
for(var/datum/reagent/R in beaker.reagents.reagent_list)
|
for(var/datum/reagent/R in beaker.reagents.reagent_list)
|
||||||
beakerContents.Add(list(list("name" = R.name, "id" = ckey(R.name), "volume" = R.volume))) // list in a list because Byond merges the first list...
|
beakerContents.Add(list(list("name" = R.name, "id" = R.type, "volume" = R.volume))) // list in a list because Byond merges the first list...
|
||||||
data["beakerContents"] = beakerContents
|
data["beakerContents"] = beakerContents
|
||||||
|
|
||||||
var/bufferContents[0]
|
var/bufferContents[0]
|
||||||
if(reagents.total_volume)
|
if(reagents.total_volume)
|
||||||
for(var/datum/reagent/N in reagents.reagent_list)
|
for(var/datum/reagent/N in reagents.reagent_list)
|
||||||
bufferContents.Add(list(list("name" = N.name, "id" = ckey(N.name), "volume" = N.volume))) // ^
|
bufferContents.Add(list(list("name" = N.name, "id" = N.type, "volume" = N.volume))) // ^
|
||||||
data["bufferContents"] = bufferContents
|
data["bufferContents"] = bufferContents
|
||||||
|
|
||||||
//Calculated at init time as it never changes
|
//Calculated at init time as it never changes
|
||||||
@@ -216,7 +216,7 @@
|
|||||||
if(action == "transfer")
|
if(action == "transfer")
|
||||||
if(!beaker)
|
if(!beaker)
|
||||||
return FALSE
|
return FALSE
|
||||||
var/reagent = GLOB.name2reagent[params["id"]]
|
var/reagent = text2path(params["id"])
|
||||||
var/amount = text2num(params["amount"])
|
var/amount = text2num(params["amount"])
|
||||||
var/to_container = params["to"]
|
var/to_container = params["to"]
|
||||||
// Custom amount
|
// Custom amount
|
||||||
@@ -386,7 +386,7 @@
|
|||||||
|
|
||||||
if(action == "analyze")
|
if(action == "analyze")
|
||||||
// var/datum/reagent/R = GLOB.name2reagent[params["id"]]
|
// var/datum/reagent/R = GLOB.name2reagent[params["id"]]
|
||||||
var/reagent = GLOB.name2reagent[params["id"]]
|
var/reagent = text2path(params["id"])
|
||||||
var/datum/reagent/R = GLOB.chemical_reagents_list[reagent]
|
var/datum/reagent/R = GLOB.chemical_reagents_list[reagent]
|
||||||
if(R)
|
if(R)
|
||||||
var/state = "Unknown"
|
var/state = "Unknown"
|
||||||
@@ -405,7 +405,7 @@
|
|||||||
analyzeVars = list("name" = initial(R.name), "state" = state, "color" = initial(R.color), "description" = initial(R.description), "metaRate" = T, "overD" = initial(R.overdose_threshold), "addicD" = initial(R.addiction_threshold), "purityF" = R.purity, "inverseRatioF" = initial(R.inverse_chem_val), "purityE" = initial(Rcr.PurityMin), "minTemp" = initial(Rcr.OptimalTempMin), "maxTemp" = initial(Rcr.OptimalTempMax), "eTemp" = initial(Rcr.ExplodeTemp), "pHpeak" = pHpeakCache)
|
analyzeVars = list("name" = initial(R.name), "state" = state, "color" = initial(R.color), "description" = initial(R.description), "metaRate" = T, "overD" = initial(R.overdose_threshold), "addicD" = initial(R.addiction_threshold), "purityF" = R.purity, "inverseRatioF" = initial(R.inverse_chem_val), "purityE" = initial(Rcr.PurityMin), "minTemp" = initial(Rcr.OptimalTempMin), "maxTemp" = initial(Rcr.OptimalTempMax), "eTemp" = initial(Rcr.ExplodeTemp), "pHpeak" = pHpeakCache)
|
||||||
else
|
else
|
||||||
fermianalyze = FALSE
|
fermianalyze = FALSE
|
||||||
analyzeVars = list("name" = initial(R.name), "state" = state, "color" = initial(R.color), "description" = initial(R.description), "metaRate" = T, "overD" = initial(R.overdose_threshold), "addicD" = initial(R.addiction_threshold))
|
analyzeVars = list("name" = initial(R.name), "state" = state, "color" = initial(R.color), "description" = initial(R.description), "metaRate" = T, "overD" = initial(R.overdose_threshold), "addicD" = initial(R.addiction_threshold), "purityF" = R.purity)
|
||||||
screen = "analyze"
|
screen = "analyze"
|
||||||
return TRUE
|
return TRUE
|
||||||
|
|
||||||
|
|||||||
@@ -117,6 +117,8 @@
|
|||||||
if(St.purity < 1)
|
if(St.purity < 1)
|
||||||
St.volume *= St.purity
|
St.volume *= St.purity
|
||||||
St.purity = 1
|
St.purity = 1
|
||||||
|
if(!N)
|
||||||
|
return
|
||||||
var/amount = clamp(0.002, 0, N.volume)
|
var/amount = clamp(0.002, 0, N.volume)
|
||||||
N.volume -= amount
|
N.volume -= amount
|
||||||
St.data["grown_volume"] = St.data["grown_volume"] + added_volume
|
St.data["grown_volume"] = St.data["grown_volume"] + added_volume
|
||||||
|
|||||||
@@ -335,11 +335,13 @@ datum/reagent/fermi/nanite_b_gone/reaction_obj(obj/O, reac_volume)
|
|||||||
holder.clear_reagents()
|
holder.clear_reagents()
|
||||||
|
|
||||||
/datum/reagent/fermi/acidic_buffer
|
/datum/reagent/fermi/acidic_buffer
|
||||||
name = "Acidic buffer"
|
name = "Potent acidic buffer"
|
||||||
description = "This reagent will consume itself and move the pH of a beaker towards acidity when added to another."
|
description = "This reagent will consume itself and move the pH of a beaker towards acidity when added to another."
|
||||||
color = "#fbc314"
|
color = "#fbc314"
|
||||||
pH = 0
|
pH = 0
|
||||||
|
chemical_flags = REAGENT_FORCEONNEW
|
||||||
can_synth = TRUE
|
can_synth = TRUE
|
||||||
|
var/strength = 2
|
||||||
|
|
||||||
//Consumes self on addition and shifts pH
|
//Consumes self on addition and shifts pH
|
||||||
/datum/reagent/fermi/acidic_buffer/on_new(datapH)
|
/datum/reagent/fermi/acidic_buffer/on_new(datapH)
|
||||||
@@ -348,18 +350,36 @@ datum/reagent/fermi/nanite_b_gone/reaction_obj(obj/O, reac_volume)
|
|||||||
data = datapH
|
data = datapH
|
||||||
if(LAZYLEN(holder.reagent_list) == 1)
|
if(LAZYLEN(holder.reagent_list) == 1)
|
||||||
return ..()
|
return ..()
|
||||||
holder.pH = ((holder.pH * holder.total_volume)+(pH * (volume)))/(holder.total_volume + (volume))
|
holder.pH = ((holder.pH * (holder.total_volume-volume))+(pH * (volume*strength)))/(holder.total_volume + volume)
|
||||||
holder.my_atom.visible_message("<span class='warning'>The beaker fizzes as the pH changes!</b></span>")
|
holder.my_atom.visible_message("<span class='warning'>The beaker fizzes as the pH changes!</b></span>")
|
||||||
playsound(holder.my_atom, 'sound/FermiChem/bufferadd.ogg', 50, 1)
|
playsound(holder.my_atom, 'sound/FermiChem/bufferadd.ogg', 50, 1)
|
||||||
holder.remove_reagent(type, volume, ignore_pH = TRUE)
|
holder.remove_reagent(type, volume, ignore_pH = TRUE)
|
||||||
..()
|
..()
|
||||||
|
|
||||||
|
/datum/reagent/fermi/acidic_buffer/weak
|
||||||
|
name = "Acidic buffer"
|
||||||
|
description = "This reagent will consume itself and move the pH of a beaker towards acidity when added to another."
|
||||||
|
color = "#fbf344"
|
||||||
|
pH = 4
|
||||||
|
can_synth = TRUE
|
||||||
|
strength = 0.4
|
||||||
|
|
||||||
/datum/reagent/fermi/basic_buffer
|
/datum/reagent/fermi/basic_buffer
|
||||||
name = "Basic buffer"
|
name = "Potent basic buffer"
|
||||||
description = "This reagent will consume itself and move the pH of a beaker towards alkalinity when added to another."
|
description = "This reagent will consume itself and move the pH of a beaker towards alkalinity when added to another."
|
||||||
color = "#3853a4"
|
color = "#3853a4"
|
||||||
pH = 14
|
pH = 14
|
||||||
|
chemical_flags = REAGENT_FORCEONNEW
|
||||||
can_synth = TRUE
|
can_synth = TRUE
|
||||||
|
var/strength = 2
|
||||||
|
|
||||||
|
/datum/reagent/fermi/basic_buffer/weak
|
||||||
|
name = "Basic buffer"
|
||||||
|
description = "This reagent will consume itself and move the pH of a beaker towards alkalinity when added to another."
|
||||||
|
color = "#5873c4"
|
||||||
|
pH = 10
|
||||||
|
can_synth = TRUE
|
||||||
|
strength = 0.4
|
||||||
|
|
||||||
/datum/reagent/fermi/basic_buffer/on_new(datapH)
|
/datum/reagent/fermi/basic_buffer/on_new(datapH)
|
||||||
if(holder.has_reagent(/datum/reagent/stabilizing_agent))
|
if(holder.has_reagent(/datum/reagent/stabilizing_agent))
|
||||||
@@ -367,7 +387,7 @@ datum/reagent/fermi/nanite_b_gone/reaction_obj(obj/O, reac_volume)
|
|||||||
data = datapH
|
data = datapH
|
||||||
if(LAZYLEN(holder.reagent_list) == 1)
|
if(LAZYLEN(holder.reagent_list) == 1)
|
||||||
return ..()
|
return ..()
|
||||||
holder.pH = ((holder.pH * holder.total_volume)+(pH * (volume)))/(holder.total_volume + (volume))
|
holder.pH = ((holder.pH * (holder.total_volume-volume))+(pH * (volume*strength)))/(holder.total_volume + volume)
|
||||||
holder.my_atom.visible_message("<span class='warning'>The beaker froths as the pH changes!</b></span>")
|
holder.my_atom.visible_message("<span class='warning'>The beaker froths as the pH changes!</b></span>")
|
||||||
playsound(holder.my_atom, 'sound/FermiChem/bufferadd.ogg', 50, 1)
|
playsound(holder.my_atom, 'sound/FermiChem/bufferadd.ogg', 50, 1)
|
||||||
holder.remove_reagent(type, volume, ignore_pH = TRUE)
|
holder.remove_reagent(type, volume, ignore_pH = TRUE)
|
||||||
|
|||||||
@@ -1,13 +1,18 @@
|
|||||||
import { toFixed } from 'common/math';
|
import { toFixed } from 'common/math';
|
||||||
import { toTitleCase } from 'common/string';
|
import { toTitleCase } from 'common/string';
|
||||||
import { Fragment } from 'inferno';
|
import { Fragment } from 'inferno';
|
||||||
import { useBackend } from '../backend';
|
import { useBackend, useLocalState } from '../backend';
|
||||||
import { AnimatedNumber, Box, Button, Icon, LabeledList, ProgressBar, Section } from '../components';
|
import { AnimatedNumber, Box, Button, Icon, LabeledList, ProgressBar, Section, Table, NumberInput } from '../components';
|
||||||
import { Window } from '../layouts';
|
import { Window } from '../layouts';
|
||||||
|
|
||||||
export const ChemDispenser = (props, context) => {
|
export const ChemDispenser = (props, context) => {
|
||||||
const { act, data } = useBackend(context);
|
const { act, data } = useBackend(context);
|
||||||
const recording = !!data.recordingRecipe;
|
const recording = !!data.recordingRecipe;
|
||||||
|
const [hasCol, setHasCol] = useLocalState(
|
||||||
|
context, 'fs_title', false);
|
||||||
|
const {
|
||||||
|
storedContents = [],
|
||||||
|
} = data;
|
||||||
// TODO: Change how this piece of shit is built on server side
|
// TODO: Change how this piece of shit is built on server side
|
||||||
// It has to be a list, not a fucking OBJECT!
|
// It has to be a list, not a fucking OBJECT!
|
||||||
const recipes = Object.keys(data.recipes)
|
const recipes = Object.keys(data.recipes)
|
||||||
@@ -28,7 +33,7 @@ export const ChemDispenser = (props, context) => {
|
|||||||
return (
|
return (
|
||||||
<Window
|
<Window
|
||||||
width={565}
|
width={565}
|
||||||
height={620}
|
height={680}
|
||||||
resizable>
|
resizable>
|
||||||
<Window.Content scrollable>
|
<Window.Content scrollable>
|
||||||
<Section
|
<Section
|
||||||
@@ -105,16 +110,22 @@ export const ChemDispenser = (props, context) => {
|
|||||||
<Section
|
<Section
|
||||||
title="Dispense"
|
title="Dispense"
|
||||||
buttons={(
|
buttons={(
|
||||||
beakerTransferAmounts.map(amount => (
|
[<NumberInput
|
||||||
<Button
|
width="65px"
|
||||||
key={amount}
|
unit="u"
|
||||||
icon="plus"
|
step={data.stepAmount}
|
||||||
selected={amount === data.amount}
|
stepPixelSize={data.stepAmount}
|
||||||
content={amount}
|
value={data.amount}
|
||||||
onClick={() => act('amount', {
|
minValue={0}
|
||||||
|
maxValue={data.beakerMaxVolume}
|
||||||
|
onDrag={(e, amount) => act('amount', {
|
||||||
target: amount,
|
target: amount,
|
||||||
})} />
|
})} />,
|
||||||
))
|
<Button icon="cog"
|
||||||
|
tooltip="Color code the reagents by pH"
|
||||||
|
tooltipPosition="bottom-left"
|
||||||
|
selected={hasCol}
|
||||||
|
onClick={() => setHasCol(!hasCol)} />]
|
||||||
)}>
|
)}>
|
||||||
<Box mr={-1}>
|
<Box mr={-1}>
|
||||||
{data.chemicals.map(chemical => (
|
{data.chemicals.map(chemical => (
|
||||||
@@ -124,12 +135,29 @@ export const ChemDispenser = (props, context) => {
|
|||||||
width="129.5px"
|
width="129.5px"
|
||||||
lineHeight={1.75}
|
lineHeight={1.75}
|
||||||
content={chemical.title}
|
content={chemical.title}
|
||||||
|
tooltip={"pH: "+chemical.pH}
|
||||||
|
color={hasCol ? chemical.pHCol : "blue"}
|
||||||
onClick={() => act('dispense', {
|
onClick={() => act('dispense', {
|
||||||
reagent: chemical.id,
|
reagent: chemical.id,
|
||||||
})} />
|
})} />
|
||||||
))}
|
))}
|
||||||
</Box>
|
</Box>
|
||||||
</Section>
|
</Section>
|
||||||
|
<Section
|
||||||
|
title="Storage">
|
||||||
|
<ProgressBar
|
||||||
|
value={data.storedVol / data.maxVol}>
|
||||||
|
{toFixed(data.storedVol) + ' units'}
|
||||||
|
</ProgressBar>
|
||||||
|
<ChemicalBuffer>
|
||||||
|
{storedContents.map(chemical => (
|
||||||
|
<ChemicalBufferEntry
|
||||||
|
key={chemical.id}
|
||||||
|
chemical={chemical}
|
||||||
|
transferTo="beaker" />
|
||||||
|
))}
|
||||||
|
</ChemicalBuffer>
|
||||||
|
</Section>
|
||||||
<Section
|
<Section
|
||||||
title="Beaker"
|
title="Beaker"
|
||||||
buttons={(
|
buttons={(
|
||||||
@@ -171,17 +199,14 @@ export const ChemDispenser = (props, context) => {
|
|||||||
{(!data.isBeakerLoaded && !recording) && 'N/A'
|
{(!data.isBeakerLoaded && !recording) && 'N/A'
|
||||||
|| beakerContents.length === 0 && 'Nothing'}
|
|| beakerContents.length === 0 && 'Nothing'}
|
||||||
</Box>
|
</Box>
|
||||||
{beakerContents.map(chemical => (
|
<ChemicalBeaker>
|
||||||
<Box
|
{beakerContents.map(chemical => (
|
||||||
key={chemical.name}
|
<ChemicalBeakerEntry
|
||||||
color="label">
|
key={chemical.id}
|
||||||
<AnimatedNumber
|
chemical={chemical}
|
||||||
initial={0}
|
transferTo="beaker" />
|
||||||
value={chemical.volume} />
|
))}
|
||||||
{' '}
|
</ChemicalBeaker>
|
||||||
units of {chemical.name}
|
|
||||||
</Box>
|
|
||||||
))}
|
|
||||||
<Box
|
<Box
|
||||||
key={"pH"}>
|
key={"pH"}>
|
||||||
pH:
|
pH:
|
||||||
@@ -196,3 +221,56 @@ export const ChemDispenser = (props, context) => {
|
|||||||
</Window>
|
</Window>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const ChemicalBuffer = Table;
|
||||||
|
|
||||||
|
const ChemicalBufferEntry = (props, context) => {
|
||||||
|
const { act } = useBackend(context);
|
||||||
|
const { chemical, transferTo } = props;
|
||||||
|
return (
|
||||||
|
<Table.Row key={chemical.id}>
|
||||||
|
<Table.Cell color="label">
|
||||||
|
<AnimatedNumber
|
||||||
|
value={chemical.volume}
|
||||||
|
initial={0} />
|
||||||
|
{` units of ${chemical.name}`}
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell collapsing>
|
||||||
|
<Button
|
||||||
|
content="Dispense"
|
||||||
|
icon="download"
|
||||||
|
mt={0.5}
|
||||||
|
onClick={() => act('unstore', {
|
||||||
|
id: chemical.id,
|
||||||
|
})} />
|
||||||
|
</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const ChemicalBeaker = Table;
|
||||||
|
|
||||||
|
const ChemicalBeakerEntry = (props, context) => {
|
||||||
|
const { act } = useBackend(context);
|
||||||
|
const { chemical, transferTo } = props;
|
||||||
|
return (
|
||||||
|
<Table.Row key={chemical.id}>
|
||||||
|
<Table.Cell color="label">
|
||||||
|
<AnimatedNumber
|
||||||
|
value={chemical.volume}
|
||||||
|
initial={0} />
|
||||||
|
{` units of ${chemical.name}`}
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell collapsing>
|
||||||
|
<Button
|
||||||
|
content="Store"
|
||||||
|
icon="upload"
|
||||||
|
mt={0.5}
|
||||||
|
onClick={() => act('store', {
|
||||||
|
id: chemical.id,
|
||||||
|
})} />
|
||||||
|
</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -400,11 +400,11 @@ const AnalysisResults = (props, context) => {
|
|||||||
<LabeledList.Item label="Addiction Threshold">
|
<LabeledList.Item label="Addiction Threshold">
|
||||||
{analyzeVars.addicD}
|
{analyzeVars.addicD}
|
||||||
</LabeledList.Item>
|
</LabeledList.Item>
|
||||||
{!!fermianalyze && ( // why did you do that before? it's fucking bad.
|
<LabeledList.Item label="Purity">
|
||||||
|
{analyzeVars.purityF}
|
||||||
|
</LabeledList.Item>
|
||||||
|
{!! data.fermianalyze && ( // why did you do that before? it's fucking bad.
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<LabeledList.Item label="Purity">
|
|
||||||
{analyzeVars.purityF}
|
|
||||||
</LabeledList.Item>
|
|
||||||
<LabeledList.Item label="Inverse Ratio">
|
<LabeledList.Item label="Inverse Ratio">
|
||||||
{analyzeVars.inverseRatioF}
|
{analyzeVars.inverseRatioF}
|
||||||
</LabeledList.Item>
|
</LabeledList.Item>
|
||||||
|
|||||||
Reference in New Issue
Block a user