diff --git a/code/game/objects/items/weapons/storage/storage.dm b/code/game/objects/items/weapons/storage/storage.dm index 51b57b7781c..c12249ace8a 100644 --- a/code/game/objects/items/weapons/storage/storage.dm +++ b/code/game/objects/items/weapons/storage/storage.dm @@ -40,10 +40,35 @@ return if(!( istype(over_object, /obj/screen) )) + if(Adjacent(M)) + if( istype(over_object, /obj/item/weapon/storage) ) //Check if storage item + var/obj/item/weapon/storage/S = over_object + orient2hud(M) + if(M.s_active) + M.s_active.close(M) + for(var/obj/item/I in src) + if(S.can_be_inserted(I,0,M)) + remove_from_storage(I, S) + return + + if( istype(over_object, /obj/machinery/disposal) ) //Check if it's a bin + for(var/obj/item/I in src) + remove_from_storage(I, over_object) //No check needed, put everything inside + return + + var/turf/T = get_turf(over_object) //Get_turf, and check if the turf isn't a wall + if( istype(T, /turf/simulated/wall) ) + return + + for(var/obj/item/I in src) + remove_from_storage(I, T) + return + return ..() if(!(loc == usr) || (loc && loc.loc == usr)) return + playsound(loc, "rustle", 50, 1, -5) if(!( M.restrained() ) && !( M.stat )) switch(over_object.name) @@ -57,29 +82,6 @@ M.put_in_l_hand(src) add_fingerprint(usr) - if(Adjacent(over_object) && Adjacent(M)) - if( istype(over_object, /obj/item/weapon/storage) ) //Check if storage item - var/obj/item/weapon/storage/S = over_object - for(var/obj/item/I in src) - if(S.can_be_inserted(I,0,M)) - remove_from_storage(I, S) - return - - if( istype(over_object, /obj/structure/closet/crate/bin) ) //Check if it's a bin - for(var/obj/item/I in src) - remove_from_storage(I, over_object) //No check needed, put everything inside - return - - var/turf/T = get_turf(over_object) //Get_turf, and check if the turf isn't a wall - if( istype(T, /turf/simulated/wall) ) - return - - for(var/obj/item/I in src) - remove_from_storage(I, T) - - return - - return /obj/item/weapon/storage/proc/return_inv()