Tweaks and fixes. Should be freature complete now.

This commit is contained in:
Fermi
2021-01-04 13:40:26 +00:00
parent c7965d3b4a
commit 57cd698994
5 changed files with 84 additions and 34 deletions

View File

@@ -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)

View File

@@ -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

View File

@@ -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("<span class='warning'>The beaker fizzes as the buffer is added, to no effect.</b></span>")
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("<span class='warning'>The beaker fizzes as the pH changes!</b></span>")
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("<span class='warning'>The beaker froths as the buffer is added, to no effect.</b></span>")
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("<span class='warning'>The beaker froths as the pH changes!</b></span>")
playsound(holder.my_atom, 'sound/FermiChem/bufferadd.ogg', 50, 1)
holder.remove_reagent(type, volume, ignore_pH = TRUE)

View File

@@ -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 (
<Window
width={565}
height={680}
height={720}
resizable>
<Window.Content scrollable>
<Section
title="Status"
buttons={recording && (
<Box inline mx={1} color="red">
<Icon name="circle" mr={1} />
Recording
</Box>
)}>
buttons={
[recording && (
<Box inline mx={1} color="red">
<Icon name="circle" mr={1} />
Recording
</Box>),
<Button
key="colorButton"
icon="cog"
disabled={!data.isBeakerLoaded}
tooltip="Alternate between buttons and radial input"
tooltipPosition="bottom-left"
selected={modeToggle}
onClick={() => setModeToggle(!modeToggle)}/>
]}>
<LabeledList>
<LabeledList.Item label="Energy">
<ProgressBar
@@ -108,20 +119,37 @@ export const ChemDispenser = (props, context) => {
</Box>
</Section>
<Section
key="dispense"
title="Dispense"
buttons={(
[<NumberInput
width="65px"
unit="u"
step={data.stepAmount}
stepPixelSize={data.stepAmount}
value={data.amount}
minValue={0}
maxValue={data.beakerMaxVolume}
onDrag={(e, amount) => act('amount', {
target: amount,
})} />,
<Button icon="cog"
[modeToggle ? (
beakerTransferAmounts.map(amount => (
<Button
key={amount}
icon="plus"
selected={amount === data.amount}
content={amount}
onClick={() => act('amount', {
target: amount,
})} />
))) : (!!data.isBeakerLoaded &&
<NumberInput
key="dispenseInput"
width="65px"
unit="u"
step={data.stepAmount}
stepPixelSize={data.stepAmount}
disabled={!data.isBeakerLoaded}
value={data.amount}
minValue={1}
maxValue={data.beakerMaxVolume}
onDrag={(e, amount) => act('amount', {
target: amount,
})} />
),
<Button
key="colorButton"
icon="cog"
tooltip="Color code the reagents by pH"
tooltipPosition="bottom-left"
selected={hasCol}
@@ -136,7 +164,7 @@ export const ChemDispenser = (props, context) => {
lineHeight={1.75}
content={chemical.title}
tooltip={"pH: "+chemical.pH}
color={hasCol ? chemical.pHCol : "blue"}
backgroundColor={hasCol ? chemical.pHCol : "blue"}
onClick={() => act('dispense', {
reagent: chemical.id,
})} />
@@ -144,10 +172,20 @@ export const ChemDispenser = (props, context) => {
</Box>
</Section>
<Section
title="Storage">
title="Storage"
buttons={
<Box>
Transfer amount:
<AnimatedNumber
initial={5}
value={data.amount} />
u
</Box>
}
>
<ProgressBar
value={data.storedVol / data.maxVol}>
{toFixed(data.storedVol) + ' units'}
{toFixed(data.storedVol) + ' units / ' + data.maxVol + ' units'}
</ProgressBar>
<ChemicalBuffer>
{storedContents.map(chemical => (
@@ -240,7 +278,7 @@ const ChemicalBufferEntry = (props, context) => {
<Button
content="Dispense"
icon="download"
disabled={!!data.recordingRecipe}
disabled={!!data.recordingRecipe || !data.isBeakerLoaded}
mt={0.5}
onClick={() => act('unstore', {
id: chemical.id,

File diff suppressed because one or more lines are too long