Sheet storage has different caps per type.

This commit is contained in:
Atermonera
2023-03-13 23:44:06 -08:00
committed by VirgoBot
parent 92ba37f44c
commit f7669b64d0
4 changed files with 40 additions and 15 deletions
@@ -32,6 +32,20 @@
max_storage = 250
stacks_go_missing = TRUE
/datum/persistent/storage/smartfridge/sheet_storage/variable_max
name = "variable max storage"
max_storage = list(
/obj/item/stack/material/steel = 150,
/obj/item/stack/material/glass = 150,
/obj/item/stack/material/copper = 150,
/obj/item/stack/material/wood = 150,
/obj/item/stack/material/plastic = 150,
/obj/item/stack/material/phoron = 100,
/obj/item/stack/material/plasteel = 50,
/obj/item/stack/material/cardboard = 50,
"default" = 10
)
/datum/persistent/storage/smartfridge/sheet_storage/generate_items(var/list/L)
. = list()
for(var/obj/item/stack/material/S as anything in L)
@@ -97,4 +111,4 @@
var/obj/item/weapon/reagent_containers/food/snacks/grown/G = I.instances[1]
if(!istype(G))
continue
.[G.plantname] = I.get_amount() // Store the seed type, because that's what's used to generate the fruit
.[G.plantname] = I.get_amount() // Store the seed type, because that's what's used to generate the fruit
+15 -9
View File
@@ -2,7 +2,7 @@
name = "storage"
entries_expire_at = 1
has_admin_data = TRUE
// Don't use these for storage persistence. If someone takes some sheets out and puts them back in mixed in with
// new sheets, how do you know the age of the stack? If you want sheets to 'decay', see go_missing_chance
entries_decay_at = 0
@@ -28,15 +28,21 @@
var/list/item_list = get_storage_list(entry)
var/list/storage_list = list()
for(var/item in item_list)
storage_list[item] = min(stored, storage_list[item] + item_list[item]) // Can't store more than max_storage
// stored gets reduced by qty stored, if greater than stored,
// previous assignment will handle overage, and we set to 0
if(!store_per_type)
stored = max(stored - item_list[item], 0)
if(islist(max_storage))
if(!is_path_in_list(item, stored))
stored[item] = stored["default"]
storage_list[item] = min(stored[item], storage_list[item] + item_list[item]) // Can't store more than max_storage
else
storage_list[item] = min(stored, storage_list[item] + item_list[item]) // Can't store more than max_storage
// stored gets reduced by qty stored, if greater than stored,
// previous assignment will handle overage, and we set to 0
if(!store_per_type)
stored = max(stored - item_list[item], 0)
LAZYADDASSOC(., "items", storage_list)
// Usage: returns list with structure:
// list(
// [type1] = [stored_quantity],