Update code/game/objects/items/storage/firstaid.dm

Co-authored-by: silicons <2003111+silicons@users.noreply.github.com>
This commit is contained in:
Chiirno
2020-07-10 02:35:42 -04:00
committed by GitHub
parent 2553ef6dd8
commit 2940f0efa5

View File

@@ -232,12 +232,17 @@
/obj/item/storage/pill_bottle/AltClick(mob/living/carbon/user)
if(!istype(user) || !user.canUseTopic(src, BE_CLOSE, ismonkey(user)))
return
var/obj/item/reagent_containers/pill/W = locate(/obj/item/reagent_containers/pill) in contents
if(W && contents.len > 0)
SEND_SIGNAL(src, COMSIG_TRY_STORAGE_TAKE, W, user)
user.put_in_hands(W)
contents -= W
to_chat(user, "<span class='notice'>You pop \a [W] out of the bottle.</span>")
if(!length(user.get_empty_held_indexes()))
to_chat(user, "<span class='warning'>Your hands are full!</span>")
return
var/obj/item/reagent_containers/pill/P = locate() in contents
if(P)
SEND_SIGNAL(src, COMSIG_TRY_STORAGE_TAKE, P, user)
if(!user.put_in_hands(P))
P.forceMove(user.drop_location()) // make sure it's not stuck in the user if the put in hands somehow fails
to_chat(user, "<span class='notice'>You take \a [P] out of [src].</span>")
else
to_chat(user, "<span class='warning'>[P] drops to the floor!</span>")
else
to_chat(user, "<span class='notice'>There are no pills left in the bottle.</span>")
return TRUE