From 23ac49b2916d662699ba8f8dfe6acc47d5a1ea42 Mon Sep 17 00:00:00 2001 From: Casey Date: Mon, 6 Dec 2021 04:44:02 -0500 Subject: [PATCH 1/2] Merge pull request #11964 from Heroman3003/fruitfix Fixes produce persistence --- code/modules/persistence/storage/smartfridge.dm | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/code/modules/persistence/storage/smartfridge.dm b/code/modules/persistence/storage/smartfridge.dm index 9978168c65..a47099f328 100644 --- a/code/modules/persistence/storage/smartfridge.dm +++ b/code/modules/persistence/storage/smartfridge.dm @@ -52,11 +52,11 @@ // Delete some stacks if we want if(stacks_go_missing) var/fuzzy = rand(55,65)*0.01 // loss of 35-45% with rounding down - count = round(count*fuzzy) + count = round(count*fuzzy) if(count <= 0) continue - - while(count > 0) + + while(count > 0) inst = new real_path(null, min(count, max_amount)) count -= inst.get_amount() . += inst @@ -72,6 +72,16 @@ name = "fruit storage lossy" go_missing_chance = 12.5 // 10% loss between rounds +/datum/persistent/storage/smartfridge/produce/generate_items(var/list/L) // Mostly same as storage/generate_items() but without converting string to path + . = list() + for(var/fruit_type in L) + for(var/i in 1 to L[fruit_type]) + if(prob(go_missing_chance)) + continue + var/atom/A = create_item(fruit_type) + if(!QDELETED(A)) + . += A + /datum/persistent/storage/smartfridge/produce/create_item(var/seedtype) return new /obj/item/weapon/reagent_containers/food/snacks/grown(null, seedtype) // Smartfridge will be stock()ed with it, loc is unimportant