From 1b7f34d230722a2b355b92f952d73d9a8d439e2c Mon Sep 17 00:00:00 2001 From: Seris02 Date: Sun, 12 Apr 2020 16:43:54 +0800 Subject: [PATCH 1/2] yeet --- code/datums/components/storage/storage.dm | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/code/datums/components/storage/storage.dm b/code/datums/components/storage/storage.dm index ea72a8a6dd..efbdd2447b 100644 --- a/code/datums/components/storage/storage.dm +++ b/code/datums/components/storage/storage.dm @@ -15,6 +15,7 @@ var/datum/component/storage/concrete/master //If not null, all actions act on master and this is just an access point. var/list/can_hold //if this is set, only things in this typecache will fit. + var/list/can_hold_extra //if this is set, it will also be able to hold these. var/list/cant_hold //if this is set, anything in this typecache will not be able to fit. var/list/mob/is_using //lazy list of mobs looking at the contents of this storage. @@ -591,19 +592,20 @@ if(!stop_messages) to_chat(M, "[host] is full, make some space!") return FALSE //Storage item is full - if(length(can_hold)) - if(!is_type_in_typecache(I, can_hold)) + if(!length(can_hold_extra) || !is_type_in_typecache(I, can_hold_extra)) + if(length(can_hold)) + if(!is_type_in_typecache(I, can_hold)) + if(!stop_messages) + to_chat(M, "[host] cannot hold [I]!") + return FALSE + if(is_type_in_typecache(I, cant_hold)) //Check for specific items which this container can't hold. if(!stop_messages) to_chat(M, "[host] cannot hold [I]!") return FALSE - if(is_type_in_typecache(I, cant_hold)) //Check for specific items which this container can't hold. - if(!stop_messages) - to_chat(M, "[host] cannot hold [I]!") - return FALSE - if(I.w_class > max_w_class) - if(!stop_messages) - to_chat(M, "[I] is too big for [host]!") - return FALSE + if(I.w_class > max_w_class) + if(!stop_messages) + to_chat(M, "[I] is too big for [host]!") + return FALSE var/sum_w_class = I.w_class for(var/obj/item/_I in real_location) sum_w_class += _I.w_class //Adds up the combined w_classes which will be in the storage item if the item is added to it. From f01cb896e54f409883e333b7b279f0429ed70d82 Mon Sep 17 00:00:00 2001 From: Ghom <42542238+Ghommie@users.noreply.github.com> Date: Sat, 25 Apr 2020 02:43:56 +0200 Subject: [PATCH 2/2] Apply suggestions from code review --- code/datums/components/storage/storage.dm | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/code/datums/components/storage/storage.dm b/code/datums/components/storage/storage.dm index a51ccabe8f..aad6e8289f 100644 --- a/code/datums/components/storage/storage.dm +++ b/code/datums/components/storage/storage.dm @@ -495,20 +495,18 @@ host.add_fingerprint(M) return FALSE if(!length(can_hold_extra) || !is_type_in_typecache(I, can_hold_extra)) - if(length(can_hold)) - if(!is_type_in_typecache(I, can_hold)) - if(!stop_messages) - to_chat(M, "[host] cannot hold [I]!") - return FALSE + if(length(can_hold) && !is_type_in_typecache(I, can_hold)) + if(!stop_messages) + to_chat(M, "[host] cannot hold [I]!") + return FALSE if(is_type_in_typecache(I, cant_hold)) //Check for specific items which this container can't hold. if(!stop_messages) to_chat(M, "[host] cannot hold [I]!") return FALSE - if(storage_flags & STORAGE_LIMIT_MAX_W_CLASS) - if(I.w_class > max_w_class) - if(!stop_messages) - to_chat(M, "[I] is too long for [host]!") - return FALSE + if(storage_flags & STORAGE_LIMIT_MAX_W_CLASS && I.w_class > max_w_class) + if(!stop_messages) + to_chat(M, "[I] is too long for [host]!") + return FALSE // STORAGE LIMITS if(storage_flags & STORAGE_LIMIT_MAX_ITEMS) if(real_location.contents.len >= max_items)