Merge pull request #183 from Be1aya/plumbing-stall-fix

Fix for issue with plumbing reaction chambers getting stuck on filling
This commit is contained in:
evilew
2025-08-02 23:45:43 -05:00
committed by GitHub
3 changed files with 12 additions and 2 deletions
+7 -1
View File
@@ -66,9 +66,15 @@
var/datum/component/plumbing/supplier = A
if(supplier.can_give(amount, reagent, net))
valid_suppliers += supplier
///GS13 Edit: 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)
//GS13 Edit: See above comment
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)
if(amount <= 0)
@@ -23,7 +23,7 @@
var/datum/reagent/RD = A
if(RT == RD.type)
has_reagent = TRUE
if(RD.volume < RC.required_reagents[RT])
if(RD.volume + CHEMICAL_QUANTISATION_LEVEL < RC.required_reagents[RT]) //GS13 Edit: Allow the chamber to exit filling mode when it feels it has enough even if short by a tiny fraction
process_request(min(RC.required_reagents[RT] - RD.volume, MACHINE_REAGENT_TRANSFER) , RT, dir)
return
if(!has_reagent)