diff --git a/code/modules/detectivework/evidence.dm b/code/modules/detectivework/evidence.dm index 7148a5afed6..b5f6dfa2330 100644 --- a/code/modules/detectivework/evidence.dm +++ b/code/modules/detectivework/evidence.dm @@ -7,14 +7,39 @@ icon_state = "evidenceobj" item_state = "" w_class = 2 + var/obj/item/stored_item = null -/obj/item/weapon/evidencebag/afterattack(obj/item/I, mob/user as mob, proximity) - if(!proximity) return - if(!in_range(I, user)) +/obj/item/weapon/evidencebag/MouseDrop(var/obj/item/I as obj) + if (!ishuman(usr)) return - if(!istype(I) || I.anchored == 1) - return ..() + var/mob/living/carbon/human/user = usr + + if (!(user.l_hand == src || user.r_hand == src)) + return //bag must be in your hands to use + + if (isturf(I.loc)) + if (!user.Adjacent(I)) + return + else + //If it isn't on the floor. Do some checks to see if it's in our hands or a box. Otherwise give up. + if(istype(I.loc,/obj/item/weapon/storage)) //in a container. + var/sdepth = I.storage_depth(user) + if (sdepth == -1 || sdepth > 1) + return //too deeply nested to access + + var/obj/item/weapon/storage/U = I.loc + user.client.screen -= I + U.contents.Remove(I) + else if(user.l_hand == I) //in a hand + user.drop_l_hand() + else if(user.r_hand == I) //in a hand + user.drop_r_hand() + else + return + + if(!istype(I) || I.anchored) + return if(istype(I, /obj/item/weapon/evidencebag)) user << "You find putting an evidence bag in another evidence bag to be slightly absurd." @@ -26,19 +51,7 @@ if(contents.len) user << "[src] already has something inside it." - return ..() - - if(!isturf(I.loc)) //If it isn't on the floor. Do some checks to see if it's in our hands or a box. Otherwise give up. - if(istype(I.loc,/obj/item/weapon/storage)) //in a container. - var/obj/item/weapon/storage/U = I.loc - user.client.screen -= I - U.contents.Remove(I) - else if(user.l_hand == I) //in a hand - user.drop_l_hand() - else if(user.r_hand == I) //in a hand - user.drop_r_hand() - else - return + return user.visible_message("[user] puts [I] into [src]", "You put [I] inside [src].",\ "You hear a rustle as someone puts something into a plastic bag.") @@ -55,28 +68,35 @@ overlays += img overlays += "evidence" //should look nicer for transparent stuff. not really that important, but hey. - desc = "An evidence bag containing [I]. [I.desc]" + desc = "An evidence bag containing [I]." I.loc = src + stored_item = I w_class = I.w_class return /obj/item/weapon/evidencebag/attack_self(mob/user as mob) if(contents.len) - var/obj/item/I = contents[1] + var/obj/item/I = stored_item user.visible_message("[user] takes [I] out of [src]", "You take [I] out of [src].",\ "You hear someone rustle around in a plastic bag, and remove something.") overlays.Cut() //remove the overlays + user.put_in_hands(I) - w_class = 1 + stored_item = null + + w_class = initial(w_class) icon_state = "evidenceobj" desc = "An empty evidence bag." - else user << "[src] is empty." icon_state = "evidenceobj" return +/obj/item/weapon/evidencebag/examine() + ..() + if (stored_item) stored_item.examine() + /obj/item/weapon/storage/box/evidence name = "evidence bag box" desc = "A box claiming to contain evidence bags." diff --git a/html/changelog.html b/html/changelog.html index 83bf062df9a..a1b2f9a692b 100644 --- a/html/changelog.html +++ b/html/changelog.html @@ -56,6 +56,15 @@ should be listed in the changelog upon commit though. Thanks. --> +