From db7af654ec17c30d6e7af40aeea0cd7aacc6ad9f Mon Sep 17 00:00:00 2001 From: Yoshax Date: Sat, 5 Dec 2015 15:10:10 +0000 Subject: [PATCH] Adds checks to ensure target is valid, adds user feedback --- .../reagents/reagent_containers/food/drinks/bottle.dm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/code/modules/reagents/reagent_containers/food/drinks/bottle.dm b/code/modules/reagents/reagent_containers/food/drinks/bottle.dm index 96f1ff219f..d6ad4a750a 100644 --- a/code/modules/reagents/reagent_containers/food/drinks/bottle.dm +++ b/code/modules/reagents/reagent_containers/food/drinks/bottle.dm @@ -82,9 +82,16 @@ if(A.density && usr.Adjacent(A) && !istype(A, /mob)) things_to_smash_on += A - var/choice = input("Select what you want to smash the bottle on.") as null|anything in things_to_smash_on + var/atom/choice = input("Select what you want to smash the bottle on.") as null|anything in things_to_smash_on + if(!choice) + return + if(!(choice.density && usr.Adjacent(choice))) + usr << "You must stay close to your target! You moved away from \the [choice]" + return + usr.put_in_hands(src.smash(usr.loc, choice)) - usr.visible_message("[usr] smashed the bottle on [choice]!") + usr.visible_message("\The [usr] smashed \the [src] on \the [choice]!") + usr << "You smash \the [src] on \the [choice]!" /obj/item/weapon/reagent_containers/food/drinks/bottle/attackby(obj/item/W, mob/user) if(!rag && istype(W, /obj/item/weapon/reagent_containers/glass/rag))