From fe8e1cd61cd494db5442fcaf4b618cfc850577cb Mon Sep 17 00:00:00 2001
From: kevinz000 <2003111+kevinz000@users.noreply.github.com>
Date: Sun, 29 Apr 2018 13:22:33 -0700
Subject: [PATCH] [syou can no longer insert a storage object into itself, and
therefore, no longer bohbomb with one boh (#37410)
* paradox
* fine, byond.
* src.
---
code/datums/components/storage/storage.dm | 26 ++++++++++++-----------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/code/datums/components/storage/storage.dm b/code/datums/components/storage/storage.dm
index 1ccce7549c..ba59712020 100644
--- a/code/datums/components/storage/storage.dm
+++ b/code/datums/components/storage/storage.dm
@@ -523,48 +523,50 @@
/datum/component/storage/proc/can_be_inserted(obj/item/I, stop_messages = FALSE, mob/M)
if(!istype(I) || (I.flags_1 & ABSTRACT_1))
return FALSE //Not an item
+ if(I == parent)
+ return FALSE //no paradoxes for you
var/atom/real_location = real_location()
- var/atom/parent = src.parent
+ var/atom/host = parent
if(real_location == I.loc)
return FALSE //Means the item is already in the storage item
if(locked)
if(M)
- parent.add_fingerprint(M)
- to_chat(M, "[parent] seems to be locked!")
+ host.add_fingerprint(M)
+ to_chat(M, "[host] seems to be locked!")
return FALSE
if(real_location.contents.len >= max_items)
if(!stop_messages)
- to_chat(M, "[parent] is full, make some space!")
+ 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(!stop_messages)
- to_chat(M, "[parent] cannot hold [I]!")
+ 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, "[parent] cannot hold [I]!")
+ 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 [parent]!")
+ 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.
if(sum_w_class > max_combined_w_class)
if(!stop_messages)
- to_chat(M, "[I] won't fit in [parent], make some space!")
+ to_chat(M, "[I] won't fit in [host], make some space!")
return FALSE
- if(isitem(parent))
- var/obj/item/IP = parent
+ if(isitem(host))
+ var/obj/item/IP = host
GET_COMPONENT_FROM(STR_I, /datum/component/storage, I)
if((I.w_class >= IP.w_class) && STR_I && !allow_big_nesting)
if(!stop_messages)
to_chat(M, "[IP] cannot hold [I] as it's a storage item of the same size!")
return FALSE //To prevent the stacking of same sized storage items.
if(I.flags_1 & NODROP_1) //SHOULD be handled in unEquip, but better safe than sorry.
- to_chat(M, "\the [I] is stuck to your hand, you can't put it in \the [parent]!")
+ to_chat(M, "\the [I] is stuck to your hand, you can't put it in \the [host]!")
return FALSE
var/datum/component/storage/concrete/master = master()
if(!istype(master))
@@ -607,7 +609,7 @@
O.update_icon()
/datum/component/storage/proc/signal_insertion_attempt(obj/item/I, mob/M, silent = FALSE, force = FALSE)
- if(!force && !can_be_inserted(I, TRUE, M))
+ if((!force && !can_be_inserted(I, TRUE, M)) || (I == parent))
return FALSE
return handle_item_insertion(I, silent, M)