From 85b1125c833fce63329780fb89f5c59755d2f88b Mon Sep 17 00:00:00 2001 From: silicons <2003111+silicons@users.noreply.github.com> Date: Sat, 12 Jun 2021 04:36:02 -0700 Subject: [PATCH] fix --- code/datums/components/storage/storage.dm | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/code/datums/components/storage/storage.dm b/code/datums/components/storage/storage.dm index 7968caed54..3198c894b9 100644 --- a/code/datums/components/storage/storage.dm +++ b/code/datums/components/storage/storage.dm @@ -448,15 +448,28 @@ return A.add_fingerprint(M) -/datum/component/storage/proc/user_show_to_mob(mob/M, force = FALSE) +/datum/component/storage/proc/user_show_to_mob(mob/M, force = FALSE, trigger_on_found = TRUE) var/atom/A = parent if(!istype(M)) return FALSE A.add_fingerprint(M) if(!force && (check_locked(null, M) || !M.CanReach(parent, view_only = TRUE))) return FALSE + if(trigger_on_found) + if(check_on_found(M)) + return ui_show(M) +/** + * Check if we should trigger on_found() + * If this returns TRUE, it means an on_found() returned TRUE and immediately broke the chain. + * In most contexts, this should mean to stop. + */ +/datum/component/storage/proc/check_on_found(mob/user) + for(var/obj/item/I in contents()) + if(I.on_found(user)) + return TRUE + /datum/component/storage/proc/mousedrop_receive(datum/source, atom/movable/O, mob/M) if(isitem(O)) var/obj/item/I = O