diff --git a/code/datums/components/plumbing/_plumbing.dm b/code/datums/components/plumbing/_plumbing.dm index e1333ebc3f4..3af63f290f8 100644 --- a/code/datums/components/plumbing/_plumbing.dm +++ b/code/datums/components/plumbing/_plumbing.dm @@ -101,9 +101,14 @@ var/datum/component/plumbing/supplier = A if(supplier.can_give(amount, reagent, net)) valid_suppliers += supplier + // Need to ask for each in turn very carefully, making sure we get the total volume. This is to avoid a division that would always round down and become 0 + var/targetVolume = reagents.total_volume + amount + var/suppliersLeft = valid_suppliers.len for(var/A in valid_suppliers) var/datum/component/plumbing/give = A - give.transfer_to(src, amount / valid_suppliers.len, reagent, net) + var/currentRequest = (targetVolume - reagents.total_volume) / suppliersLeft + give.transfer_to(src, currentRequest, reagent, net) + suppliersLeft-- ///returns TRUE when they can give the specified amount and reagent. called by process request /datum/component/plumbing/proc/can_give(amount, reagent, datum/ductnet/net) diff --git a/code/datums/components/plumbing/reaction_chamber.dm b/code/datums/components/plumbing/reaction_chamber.dm index 39769190360..2fd837d229d 100644 --- a/code/datums/components/plumbing/reaction_chamber.dm +++ b/code/datums/components/plumbing/reaction_chamber.dm @@ -23,7 +23,7 @@ for(var/datum/reagent/containg_reagent as anything in reagents.reagent_list) if(required_reagent == containg_reagent.type) has_reagent = TRUE - if(containg_reagent.volume < chamber.required_reagents[required_reagent]) + if(containg_reagent.volume + CHEMICAL_QUANTISATION_LEVEL < chamber.required_reagents[required_reagent]) process_request(min(chamber.required_reagents[required_reagent] - containg_reagent.volume, MACHINE_REAGENT_TRANSFER) , required_reagent, dir) return if(!has_reagent) diff --git a/code/modules/plumbing/plumbers/plumbing_buffer.dm b/code/modules/plumbing/plumbers/plumbing_buffer.dm index 25dadcfb2fb..6c7a7c33ed7 100644 --- a/code/modules/plumbing/plumbers/plumbing_buffer.dm +++ b/code/modules/plumbing/plumbers/plumbing_buffer.dm @@ -31,11 +31,11 @@ /obj/machinery/plumbing/buffer/proc/on_reagent_change() if(!buffer_net) return - if(reagents.total_volume >= activation_volume && mode == UNREADY) + if(reagents.total_volume + CHEMICAL_QUANTISATION_LEVEL >= activation_volume && mode == UNREADY) mode = IDLE buffer_net.check_active() - else if(reagents.total_volume < activation_volume && mode != UNREADY) + else if(reagents.total_volume + CHEMICAL_QUANTISATION_LEVEL < activation_volume && mode != UNREADY) mode = UNREADY buffer_net.check_active()