From 5657f839b2899841b80e7d20ba4c5712603750ee Mon Sep 17 00:00:00 2001 From: atermonera Date: Sun, 21 Nov 2021 21:44:19 -0800 Subject: [PATCH 1/2] Fixes overflow bug that can delete sheets from smartfridge --- code/modules/food/kitchen/smartfridge/engineering.dm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/code/modules/food/kitchen/smartfridge/engineering.dm b/code/modules/food/kitchen/smartfridge/engineering.dm index 8141ca496d..2a3a56368b 100644 --- a/code/modules/food/kitchen/smartfridge/engineering.dm +++ b/code/modules/food/kitchen/smartfridge/engineering.dm @@ -20,8 +20,10 @@ if(amount < 1) return + count = min(count, amount) + while(count > 0) - var/obj/item/stack/S = I.get_product(get_turf(src), min(count, amount)) + var/obj/item/stack/S = I.get_product(get_turf(src), count) count -= S.amount SStgui.update_uis(src) From e5abe10a849f14152e5f5db8d2d9ecf63e3912f0 Mon Sep 17 00:00:00 2001 From: atermonera Date: Sun, 21 Nov 2021 22:16:39 -0800 Subject: [PATCH 2/2] Fixes ghost stacks lingering in the fridge --- code/datums/vending/stored_item.dm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/datums/vending/stored_item.dm b/code/datums/vending/stored_item.dm index d5e9c3cae0..92565a5f46 100644 --- a/code/datums/vending/stored_item.dm +++ b/code/datums/vending/stored_item.dm @@ -90,6 +90,8 @@ for(var/obj/item/stack/T as anything in instances) if(count <= 0) break + if(T.get_amount() <= count) + instances -= T count -= T.transfer_to(S, count) S.forceMove(product_location)