From 57cd698994046b770b1bb4e0eeeda86864919361 Mon Sep 17 00:00:00 2001 From: Fermi <33956696+Thalpy@users.noreply.github.com> Date: Mon, 4 Jan 2021 13:40:26 +0000 Subject: [PATCH] Tweaks and fixes. Should be freature complete now. --- .../chemistry/machinery/chem_dispenser.dm | 7 +- .../reagents/chemistry/recipes/medicine.dm | 1 + .../chemistry/reagents/fermi_reagents.dm | 24 ++++-- .../packages/tgui/interfaces/ChemDispenser.js | 84 ++++++++++++++----- tgui/public/tgui.bundle.js | 2 +- 5 files changed, 84 insertions(+), 34 deletions(-) diff --git a/code/modules/reagents/chemistry/machinery/chem_dispenser.dm b/code/modules/reagents/chemistry/machinery/chem_dispenser.dm index 25658df0a5..01a41671ea 100644 --- a/code/modules/reagents/chemistry/machinery/chem_dispenser.dm +++ b/code/modules/reagents/chemistry/machinery/chem_dispenser.dm @@ -203,12 +203,12 @@ var/beakerCurrentVolume = 0 if(beaker && beaker.reagents && beaker.reagents.reagent_list.len) for(var/datum/reagent/R in beaker.reagents.reagent_list) - beakerContents.Add(list(list("name" = R.name, "id" = R.type, "volume" = R.volume))) // list in a list because Byond merges the first list... + beakerContents.Add(list(list("name" = R.name, "id" = R.type, "volume" = round(R.volume, 0.01)))) // list in a list because Byond merges the first list... beakerCurrentVolume += R.volume data["beakerContents"] = beakerContents if (beaker) - data["beakerCurrentVolume"] = beakerCurrentVolume + data["beakerCurrentVolume"] = round(beakerCurrentVolume, 0.01) data["beakerMaxVolume"] = beaker.volume data["beakerTransferAmounts"] = beaker.possible_transfer_amounts //pH accuracy @@ -389,6 +389,9 @@ amount = inputAmount return inputAmount -= inputAmount % dispenceUnit + if(inputAmount == 0) //Prevent ghost entries in macros + amount = dispenceUnit + return amount = inputAmount /obj/machinery/chem_dispenser/attackby(obj/item/I, mob/user, params) diff --git a/code/modules/reagents/chemistry/recipes/medicine.dm b/code/modules/reagents/chemistry/recipes/medicine.dm index 1a92ba0ad9..f2e9bd9e1a 100644 --- a/code/modules/reagents/chemistry/recipes/medicine.dm +++ b/code/modules/reagents/chemistry/recipes/medicine.dm @@ -116,6 +116,7 @@ holder.remove_reagent(id, added_volume*temp_ratio) if(St.purity < 1) St.volume *= St.purity + added_volume *= St.purity St.purity = 1 if(!N) return 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 3e2978ef04..1855bae486 100644 --- a/modular_citadel/code/modules/reagents/chemistry/reagents/fermi_reagents.dm +++ b/modular_citadel/code/modules/reagents/chemistry/reagents/fermi_reagents.dm @@ -335,13 +335,13 @@ datum/reagent/fermi/nanite_b_gone/reaction_obj(obj/O, reac_volume) holder.clear_reagents() /datum/reagent/fermi/acidic_buffer - name = "Potent acidic buffer" + name = "Strong acidic buffer" description = "This reagent will consume itself and move the pH of a beaker towards acidity when added to another." color = "#fbc314" pH = 0 chemical_flags = REAGENT_FORCEONNEW can_synth = TRUE - var/strength = 2 + var/strength = 1 //Consumes self on addition and shifts pH /datum/reagent/fermi/acidic_buffer/on_new(datapH) @@ -354,7 +354,11 @@ datum/reagent/fermi/nanite_b_gone/reaction_obj(obj/O, reac_volume) data = datapH if(LAZYLEN(holder.reagent_list) == 1) return ..() - holder.pH = ((holder.pH * (holder.total_volume-volume))+(pH * volume*strength))/holder.total_volume //This is BEFORE removal + if(holder.pH < pH) + holder.my_atom.visible_message("The beaker fizzes as the buffer is added, to no effect.") + playsound(holder.my_atom, 'sound/FermiChem/bufferadd.ogg', 50, 1) + return ..() + holder.pH = clamp((((holder.pH * (holder.total_volume-(volume*strength)))+(pH * (volume*strength)) )/holder.total_volume), 0, 14) //This is BEFORE removal holder.my_atom.visible_message("The beaker fizzes as the pH changes!") playsound(holder.my_atom, 'sound/FermiChem/bufferadd.ogg', 50, 1) holder.remove_reagent(type, volume, ignore_pH = TRUE) @@ -366,16 +370,16 @@ datum/reagent/fermi/nanite_b_gone/reaction_obj(obj/O, reac_volume) color = "#fbf344" pH = 4 can_synth = TRUE - strength = 0.4 + strength = 0.2 /datum/reagent/fermi/basic_buffer - name = "Potent basic buffer" + name = "Strong basic buffer" description = "This reagent will consume itself and move the pH of a beaker towards alkalinity when added to another." color = "#3853a4" pH = 14 chemical_flags = REAGENT_FORCEONNEW can_synth = TRUE - var/strength = 2 + var/strength = 1 /datum/reagent/fermi/basic_buffer/weak name = "Basic buffer" @@ -383,7 +387,7 @@ datum/reagent/fermi/nanite_b_gone/reaction_obj(obj/O, reac_volume) color = "#5873c4" pH = 10 can_synth = TRUE - strength = 0.4 + strength = 0.2 /datum/reagent/fermi/basic_buffer/on_new(datapH) if(!holder) @@ -395,7 +399,11 @@ datum/reagent/fermi/nanite_b_gone/reaction_obj(obj/O, reac_volume) data = datapH if(LAZYLEN(holder.reagent_list) == 1) return ..() - holder.pH = ((holder.pH * (holder.total_volume-volume))+(pH * volume*strength))/holder.total_volume //This is BEFORE removal + if(holder.pH > pH) + holder.my_atom.visible_message("The beaker froths as the buffer is added, to no effect.") + playsound(holder.my_atom, 'sound/FermiChem/bufferadd.ogg', 50, 1) + return ..() + holder.pH = clamp((((holder.pH * (holder.total_volume-(volume*strength)))+(pH * (volume*strength)) )/holder.total_volume), 0, 14) //This is BEFORE removal holder.my_atom.visible_message("The beaker froths as the pH changes!") playsound(holder.my_atom, 'sound/FermiChem/bufferadd.ogg', 50, 1) holder.remove_reagent(type, volume, ignore_pH = TRUE) diff --git a/tgui/packages/tgui/interfaces/ChemDispenser.js b/tgui/packages/tgui/interfaces/ChemDispenser.js index 434b447364..f1b32d7415 100644 --- a/tgui/packages/tgui/interfaces/ChemDispenser.js +++ b/tgui/packages/tgui/interfaces/ChemDispenser.js @@ -10,6 +10,8 @@ export const ChemDispenser = (props, context) => { const recording = !!data.recordingRecipe; const [hasCol, setHasCol] = useLocalState( context, 'fs_title', false); + const [modeToggle, setModeToggle] = useLocalState( + context, 'mode_toggle', true); const { storedContents = [], } = data; @@ -33,17 +35,26 @@ export const ChemDispenser = (props, context) => { return (
- - Recording - - )}> + buttons={ + [recording && ( + + + Recording + ), +
act('amount', { - target: amount, - })} />, -
+ title="Storage" + buttons={ + + Transfer amount: + + u + + } + > - {toFixed(data.storedVol) + ' units'} + {toFixed(data.storedVol) + ' units / ' + data.maxVol + ' units'} {storedContents.map(chemical => ( @@ -240,7 +278,7 @@ const ChemicalBufferEntry = (props, context) => {