From 05254aab77488de633088b15eb1edf6888a05d21 Mon Sep 17 00:00:00 2001 From: SpaceVampire <> Date: Fri, 18 Jun 2021 04:54:37 -0400 Subject: [PATCH 1/5] aaa --- code/modules/persistence/storage/smartfridge.dm | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/code/modules/persistence/storage/smartfridge.dm b/code/modules/persistence/storage/smartfridge.dm index 0584ab9e79..35296968eb 100644 --- a/code/modules/persistence/storage/smartfridge.dm +++ b/code/modules/persistence/storage/smartfridge.dm @@ -51,14 +51,7 @@ // Delete some stacks if we want if(stacks_go_missing) - var/fuzzy = rand(-5,5) - switch(count / max_amount) - if(0 to 1) - count -= 10+fuzzy // 1 stack or less, lose 10 - if(1 to 10) - count -= max_amount+fuzzy // 1 to 10 stacks, lose a stack - if(10 to INFINITY) - count -= max_amount*3+fuzzy // 10+ stacks, lose 3 stacks + count -= count*0.2 // flat loss of 20% if(count <= 0) continue From 994d2804044860fb58ca278a321d57c8963c7bec Mon Sep 17 00:00:00 2001 From: SpaceVampire <> Date: Fri, 18 Jun 2021 17:54:00 -0400 Subject: [PATCH 2/5] return-of-random-floor --- code/modules/persistence/storage/smartfridge.dm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/modules/persistence/storage/smartfridge.dm b/code/modules/persistence/storage/smartfridge.dm index 35296968eb..f56661bf8b 100644 --- a/code/modules/persistence/storage/smartfridge.dm +++ b/code/modules/persistence/storage/smartfridge.dm @@ -51,7 +51,8 @@ // Delete some stacks if we want if(stacks_go_missing) - count -= count*0.2 // flat loss of 20% + var/fuzzy = rand(-5,5)*.01 + count -= floor(count*(0.8+fuzzy)) // loss of 15-25% with rounding down if(count <= 0) continue From d918d3f23904cb9df56c5bb8f0a087b7d00546d6 Mon Sep 17 00:00:00 2001 From: SpaceVampire <> Date: Fri, 18 Jun 2021 18:08:20 -0400 Subject: [PATCH 3/5] oops --- code/modules/persistence/storage/smartfridge.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/modules/persistence/storage/smartfridge.dm b/code/modules/persistence/storage/smartfridge.dm index f56661bf8b..74ab16ff0f 100644 --- a/code/modules/persistence/storage/smartfridge.dm +++ b/code/modules/persistence/storage/smartfridge.dm @@ -51,8 +51,8 @@ // Delete some stacks if we want if(stacks_go_missing) - var/fuzzy = rand(-5,5)*.01 - count -= floor(count*(0.8+fuzzy)) // loss of 15-25% with rounding down + var/fuzzy = rand(75,85) + count -= round(count*0.01*fuzzy) // loss of 15-25% with rounding down if(count <= 0) continue From 52f6d486c14038aac5596edb726055161ab27f69 Mon Sep 17 00:00:00 2001 From: SpaceVampire <> Date: Fri, 18 Jun 2021 18:20:23 -0400 Subject: [PATCH 4/5] fixes-equal --- code/modules/persistence/storage/smartfridge.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/persistence/storage/smartfridge.dm b/code/modules/persistence/storage/smartfridge.dm index 74ab16ff0f..f0f9229722 100644 --- a/code/modules/persistence/storage/smartfridge.dm +++ b/code/modules/persistence/storage/smartfridge.dm @@ -52,7 +52,7 @@ // Delete some stacks if we want if(stacks_go_missing) var/fuzzy = rand(75,85) - count -= round(count*0.01*fuzzy) // loss of 15-25% with rounding down + count = round(count*0.01*fuzzy) // loss of 15-25% with rounding down if(count <= 0) continue From b9a82730e83510533f1d4915f0afb3fc95a6419f Mon Sep 17 00:00:00 2001 From: SpaceVampire <> Date: Mon, 28 Jun 2021 16:59:00 -0400 Subject: [PATCH 5/5] perfectly-balanced As all things should be. --- code/modules/persistence/storage/smartfridge.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/modules/persistence/storage/smartfridge.dm b/code/modules/persistence/storage/smartfridge.dm index f0f9229722..edd8294a90 100644 --- a/code/modules/persistence/storage/smartfridge.dm +++ b/code/modules/persistence/storage/smartfridge.dm @@ -51,8 +51,8 @@ // Delete some stacks if we want if(stacks_go_missing) - var/fuzzy = rand(75,85) - count = round(count*0.01*fuzzy) // loss of 15-25% with rounding down + var/fuzzy = rand(55,65) + count = round(count*0.01*fuzzy) // loss of 35-45% with rounding down if(count <= 0) continue