mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
Merge pull request #3303 from CHOMPStation2/upstream-merge-11964
[MIRROR] Fixes produce persistence
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user