Merge pull request #5927 from CHOMPStation2/upstream-merge-14681

[MIRROR] [MIRROR] Sheet storage has different caps per type.
This commit is contained in:
Nadyr
2023-03-17 03:09:26 -04:00
committed by GitHub
4 changed files with 33 additions and 13 deletions

View File

@@ -28,4 +28,4 @@
add_overlay(mainOverlay)
add_overlay(shadeOverlay)
add_hiddenprint(usr)
add_hiddenprint(usr)

View File

@@ -1,4 +1,4 @@
/obj/machinery/smartfridge/sheets //Is this used anywhere? It's not secure.
/obj/machinery/smartfridge/sheets
name = "\improper Smart Sheet Storage"
desc = "A storage unit for metals."
icon_contents = "boxes"
@@ -27,6 +27,6 @@
/obj/machinery/smartfridge/sheets/find_record(var/obj/item/O)
for(var/datum/stored_item/stack/I as anything in item_records)
if(istype(O, I.item_path)) // Typecheck should evaluate material-specific subtype
if(O.type == I.item_path) // Typecheck should evaluate material-specific subtype
return I
return null

View File

@@ -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

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],