Hyposprays and autoinjectors have a delay when used on a target that is not in help intent

This commit is contained in:
Anewbe
2018-02-06 01:52:06 -06:00
parent f56597efed
commit e565108ce7
2 changed files with 51 additions and 7 deletions

View File

@@ -31,7 +31,7 @@
/obj/item/weapon/reagent_containers/hypospray/attack(mob/living/M as mob, mob/user as mob)
if(!reagents.total_volume)
user << "<span class='warning'>[src] is empty.</span>"
to_chat(user, "<span class='warning'>[src] is empty.</span>")
return
if (!istype(M))
return
@@ -40,21 +40,29 @@
if(istype(H))
var/obj/item/organ/external/affected = H.get_organ(user.zone_sel.selecting)
if(!affected)
user << "<span class='danger'>\The [H] is missing that limb!</span>"
to_chat(user, "<span class='danger'>\The [H] is missing that limb!</span>")
return
else if(affected.robotic >= ORGAN_ROBOT)
user << "<span class='danger'>You cannot inject a robotic limb.</span>"
to_chat(user, "<span class='danger'>You cannot inject a robotic limb.</span>")
return
if(!H.stat)
if(H != user)
if(H.a_intent != I_HELP)
to_chat(user, "<span class='notice'>[H] is resisting your attempt to inject them with \the [src].</span>")
to_chat(H, "<span class='danger'> [user] is trying to inject you with \the [src]!</span>")
if(!do_after(user, 30))
return
user.setClickCooldown(DEFAULT_QUICK_COOLDOWN)
user << "<span class='notice'>You inject [M] with [src].</span>"
M << "<span class='notice'>You feel a tiny prick!</span>"
to_chat(user, "<span class='notice'>You inject [M] with \the [src].</span>")
to_chat(M, "<span class='notice'>You feel a tiny prick!</span>")
if(M.reagents)
var/contained = reagentlist()
var/trans = reagents.trans_to_mob(M, amount_per_transfer_from_this, CHEM_BLOOD)
admin_inject_log(user, M, src, contained, trans)
user << "<span class='notice'>[trans] units injected. [reagents.total_volume] units remaining in \the [src].</span>"
to_chat(user, "<span class='notice'>[trans] units injected. [reagents.total_volume] units remaining in \the [src].</span>")
if(!reusable && !used)
used = !used
@@ -110,7 +118,7 @@
user << "<span class='notice'>\The [src] already has a vial.</span>"
else
..()
/obj/item/weapon/reagent_containers/hypospray/autoinjector
name = "autoinjector"
desc = "A rapid and safe way to administer small amounts of drugs by untrained or trained personnel."