From 56fcd2dc9fc185291ee0cd64897ff1ad84e851d6 Mon Sep 17 00:00:00 2001 From: shellspeed1 Date: Sun, 31 Oct 2021 00:48:56 -0700 Subject: [PATCH] basic ability to load hypovial added --- .../modules/projectiles/guns/misc/chem_gun.dm | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/code/modules/projectiles/guns/misc/chem_gun.dm b/code/modules/projectiles/guns/misc/chem_gun.dm index a5e29a254e..3cce3c8d79 100644 --- a/code/modules/projectiles/guns/misc/chem_gun.dm +++ b/code/modules/projectiles/guns/misc/chem_gun.dm @@ -17,6 +17,11 @@ var/syringes_left = 5 var/max_syringes = 5 var/last_synth = 0 + var/obj/item/reagent_containers/glass/bottle/vial/vial + var/list/allowed_containers = list(/obj/item/reagent_containers/glass/bottle/vial/small, /obj/item/reagent_containers/glass/bottle/vial/large) + var/spawnwithvial = TRUE + var/start_vial = null + var/quickload = TRUE /obj/item/gun/chem/Initialize() . = ..() @@ -28,6 +33,49 @@ . = ..() STOP_PROCESSING(SSobj, src) +/obj/item/gun/chem/examine(mob/user) + . = ..() + if(vial) + . += "[vial] has [vial.reagents.total_volume]u remaining." + else + . += "It has no vial loaded in." + +/obj/item/gun/chem/proc/unload_hypo(obj/item/I, mob/user) + if((istype(I, /obj/item/reagent_containers/glass/bottle/vial))) + var/obj/item/reagent_containers/glass/bottle/vial/V = I + V.forceMove(user.loc) + user.put_in_hands(V) + to_chat(user, "You remove [vial] from [src].") + vial = null + //playsound(loc, 'sound/weapons/empty.ogg', 50, 1) + else + to_chat(user, "The weapon isn't loaded!") + return + +/obj/item/gun/chem/attackby(obj/item/I, mob/living/user) + if((istype(I, /obj/item/reagent_containers/glass/bottle/vial) && vial != null)) + if(!quickload) + to_chat(user, "[src] can not hold more than one vial!") + return FALSE + unload_hypo(vial, user) + if((istype(I, /obj/item/reagent_containers/glass/bottle/vial))) + var/obj/item/reagent_containers/glass/bottle/vial/V = I + if(!is_type_in_list(V, allowed_containers)) + to_chat(user, "[src] doesn't accept this type of vial.") + return FALSE + if(!user.transferItemToLoc(V,src)) + return FALSE + vial = V + user.visible_message("[user] has loaded a vial into [src].","You have loaded [vial] into [src].") + //playsound(loc, 'sound/weapons/autoguninsert.ogg', 35, 1) + return TRUE + else + to_chat(user, "This doesn't fit in [src].") + return FALSE + +/obj/item/gun/chem/on_attack_hand(mob/user, act_intent = user.a_intent, unarmed_attack_flags) + . = ..() //Don't bother changing this or removing it from containers will break. + /obj/item/gun/chem/can_shoot() return syringes_left