Hypospray sprite change and some tweaks (#8216)

This commit is contained in:
Wowzewow (Wezzy)
2020-02-15 17:27:03 -03:00
committed by GitHub
parent a25e235b6a
commit 8cb59cbab0
6 changed files with 102 additions and 60 deletions
@@ -4,7 +4,9 @@
/obj/item/reagent_containers/hypospray
name = "hypospray"
desc = "The Zeng-Hu Pharmaceuticals hypospray is a sterile, air-needle autoinjector for administration of drugs to patients."
desc = "A sterile, air-needle autoinjector for administration of drugs to patients."
description_fluff = "The Zeng-Hu Pharmaceuticals' Hypospray - 9 out of 10 doctors recommend it!"
description_info = "Unlike a syringe, reagents have to be poured into the hypospray before it can be used."
icon = 'icons/obj/syringe.dmi'
item_state = "hypo"
icon_state = "hypo"
@@ -14,11 +16,10 @@
possible_transfer_amounts = null
flags = OPENCONTAINER
slot_flags = SLOT_BELT
center_of_mass = null
drop_sound = 'sound/items/drop/bottle.ogg'
drop_sound = 'sound/items/drop/gun.ogg'
var/armorcheck = 1
var/time = 3 SECONDS
var/has_level_sprites = TRUE
var/image/filling //holds a reference to the current filling overlay
matter = list("glass" = 400, DEFAULT_WALL_MATERIAL = 200)
/obj/item/reagent_containers/hypospray/Initialize()
@@ -31,8 +32,10 @@
/obj/item/reagent_containers/hypospray/cmo
name = "premium hypospray"
desc = "The Zeng-Hu Pharmaceuticalsn premium hypospray is a cutting-edge, sterile, air-needle autoinjector for rapid administration of drugs to patients."
item_state = "cmo_hypo"
desc = "A high-end version of the regular hypospray, it allows for a substantially higher rate of drug administration to patients."
description_fluff = "The Zeng-Hu Pharmaceuticals' Hypospray Mk-II is a cutting-edge version of the regular hypospray, with a much more expensive and streamlined injection process."
description_info = "This version of the hypospray has no delay before injecting a patient with reagent."
icon_state = "cmo_hypo"
volume = 30
time = 0
@@ -40,7 +43,7 @@
. = ..()
var/mob/living/carbon/human/H = M
if(istype(H))
user.visible_message("<span class='warning'>\The [user] is trying to inject \the [M] with \the [src]!</span>","<span class='notice'>You are trying to inject \the [M] with \the [src].</span>")
user.visible_message(span("warning", "\The [user] is trying to inject \the [M] with \the [src]!"),span("notice", "You are trying to inject \the [M] with \the [src]."))
var/inj_time = time
if(armorcheck && H.run_armor_check(target_zone,"melee",0,"Your armor slows down the injection!","Your armor slows down the injection!"))
inj_time += 6 SECONDS
@@ -48,21 +51,18 @@
return 1
/obj/item/reagent_containers/hypospray/update_icon()
if(!has_level_sprites)
return
var/percent = round((reagents.total_volume / 10) * 100)
switch(percent)
if(0 to 25)
icon_state = "[item_state]"
if(26 to 50)
icon_state = "[item_state]_25"
if(51 to 75)
icon_state = "[item_state]_50"
if(76 to 99)
icon_state = "[item_state]_75"
if(100 to INFINITY)
icon_state = "[item_state]_100"
cut_overlays()
var/rounded_vol = round(reagents.total_volume, round(reagents.maximum_volume / (volume / 5)))
icon_state = "[initial(icon_state)]_[rounded_vol]"
if(reagents.total_volume)
filling = image('icons/obj/syringe.dmi', src, "[initial(icon_state)][volume]")
filling.icon_state = "[initial(icon_state)][rounded_vol]"
filling.color = reagents.get_color()
add_overlay(filling)
/obj/item/reagent_containers/hypospray/afterattack(var/mob/M, var/mob/user, proximity)
if (!istype(M))
@@ -72,13 +72,13 @@
return
if(!reagents.total_volume)
to_chat(user,"<span class='warning'>\The [src] is empty.</span>")
to_chat(user,span("warning", "\The [src] is empty."))
return
user.setClickCooldown(DEFAULT_QUICK_COOLDOWN)
user.do_attack_animation(M)
to_chat(user,"<span class='notice'>You inject \the [M] with \the [src].</span>")
to_chat(M,"<span class='notice'>You feel a tiny prick!</span>")
to_chat(user,span("notice", "You inject \the [M] with \the [src]."))
to_chat(M,span("notice", "You feel a tiny prick!"))
playsound(src, 'sound/items/hypospray.ogg',25)
if(M.reagents)
@@ -86,7 +86,7 @@
var/temp = reagents.get_temperature()
var/trans = reagents.trans_to_mob(M, amount_per_transfer_from_this, CHEM_BLOOD)
admin_inject_log(user, M, src, contained, temp, trans)
to_chat(user,"<span class='notice'>[trans] units injected. [reagents.total_volume] units remaining in \the [src].</span>")
to_chat(user,span("notice", "[trans] units injected. [reagents.total_volume] units remaining in \the [src]."))
update_icon()
return TRUE
@@ -101,7 +101,6 @@
amount_per_transfer_from_this = 5
volume = 5
time = 0
has_level_sprites = FALSE
/obj/item/reagent_containers/hypospray/autoinjector/Initialize()
. =..()
@@ -110,25 +109,25 @@
/obj/item/reagent_containers/hypospray/autoinjector/attack(var/mob/M, var/mob/user, target_zone)
if(is_open_container())
to_chat(user,"<span class='notice'>You must secure the reagents inside \the [src] before using it!</span>")
to_chat(user,span("notice", "You must secure the reagents inside \the [src] before using it!"))
return FALSE
. = ..()
/obj/item/reagent_containers/hypospray/autoinjector/attack_self(mob/user as mob)
if(is_open_container())
if(reagents && reagents.reagent_list.len)
to_chat(user,"<span class='notice'>With a quick twist of \the [src]'s lid, you secure the reagents inside.</span>")
to_chat(user,span("notice", "With a quick twist of \the [src]'s lid, you secure the reagents inside."))
flags &= ~OPENCONTAINER
update_icon()
else
to_chat(user,"<span class='notice'>You can't secure \the [src] without putting reagents in!</span>")
to_chat(user,span("notice", "You can't secure \the [src] without putting reagents in!"))
else
to_chat(user,"<span class='notice'>The reagents inside \the [src] are already secured.</span>")
to_chat(user,span("notice", "The reagents inside \the [src] are already secured."))
return
/obj/item/reagent_containers/hypospray/autoinjector/attackby(obj/item/W, mob/user)
if(W.isscrewdriver() && !is_open_container())
to_chat(user,"<span class='notice'>Using \the [W], you unsecure the autoinjector's lid.</span>") // it locks shut after being secured
to_chat(user,span("notice", "Using \the [W], you unsecure the autoinjector's lid.")) // it locks shut after being secured
flags |= OPENCONTAINER
update_icon()
return
@@ -143,9 +142,9 @@
/obj/item/reagent_containers/hypospray/autoinjector/examine(mob/user)
..(user)
if(reagents && reagents.reagent_list.len)
to_chat(user, "<span class='notice'>It is currently loaded.</span>")
to_chat(user, span("notice", "It is currently loaded."))
else
to_chat(user, "<span class='notice'>It is empty.</span>")
to_chat(user, span("notice", "It is empty."))
/obj/item/reagent_containers/hypospray/autoinjector/norepinephrine
@@ -196,7 +195,6 @@
volume = 20
armorcheck = 0
time = 0
has_level_sprites = FALSE
/obj/item/reagent_containers/hypospray/combat/Initialize()
. = ..()
@@ -153,25 +153,25 @@
if(SYRINGE_DRAW)
if(!reagents.get_free_space())
to_chat(user, "<span class='warning'>The syringe is full.</span>")
to_chat(user, span("warning", "The syringe is full."))
mode = SYRINGE_INJECT
return
if(ismob(target))//Blood!
if(reagents.has_reagent("blood"))
to_chat(user, "<span class='notice'>There is already a blood sample in this syringe.</span>")
to_chat(user, span("notice", "There is already a blood sample in this syringe."))
return
if(istype(target, /mob/living/carbon))
if(istype(target, /mob/living/carbon/slime))
to_chat(user, "<span class='warning'>You are unable to locate any blood.</span>")
to_chat(user, span("warning", "You are unable to locate any blood."))
return
var/amount = reagents.get_free_space()
var/mob/living/carbon/T = target
if(!T.dna)
to_chat(user, "<span class='warning'>You are unable to locate any blood. (To be specific, your target seems to be missing their DNA datum).</span>")
to_chat(user, span("warning", "You are unable to locate any blood. (To be specific, your target seems to be missing their DNA datum)."))
return
if(NOCLONE in T.mutations) //target done been et, no more blood in him
to_chat(user, "<span class='warning'>You are unable to locate any blood.</span>")
to_chat(user, span("warning", "You are unable to locate any blood."))
return
var/datum/reagent/B
@@ -189,21 +189,21 @@
reagents.update_total()
on_reagent_change()
reagents.handle_reactions()
to_chat(user, "<span class='notice'>You take a blood sample from [target].</span>")
to_chat(user, span("notice", "You take a blood sample from [target]."))
for(var/mob/O in viewers(4, user))
O.show_message("<span class='notice'>[user] takes a blood sample from [target].</span>", 1)
O.show_message(span("notice", "[user] takes a blood sample from [target]."), 1)
else //if not mob
if(!target.reagents.total_volume)
to_chat(user, "<span class='notice'>[target] is empty.</span>")
to_chat(user, span("notice", "[target] is empty."))
return
if(!target.is_open_container() && !istype(target, /obj/structure/reagent_dispensers) && !istype(target, /obj/item/slime_extract))
to_chat(user, "<span class='notice'>You cannot directly remove reagents from this object.</span>")
to_chat(user, span("notice", "You cannot directly remove reagents from this object."))
return
var/trans = target.reagents.trans_to_obj(src, amount_per_transfer_from_this)
to_chat(user, "<span class='notice'>You fill the syringe with [trans] units of the solution.</span>")
to_chat(user, span("notice", "You fill the syringe with [trans] units of the solution."))
update_icon()
if(!reagents.get_free_space())
@@ -212,17 +212,17 @@
if(SYRINGE_INJECT)
if(!reagents.total_volume)
to_chat(user, "<span class='notice'>The syringe is empty.</span>")
to_chat(user, span("notice", "The syringe is empty."))
mode = SYRINGE_DRAW
return
if(istype(target, /obj/item/implantcase/chem))
return
if(!target.is_open_container() && !ismob(target) && !istype(target, /obj/item/reagent_containers/food) && !istype(target, /obj/item/slime_extract) && !istype(target, /obj/item/clothing/mask/smokable/cigarette) && !istype(target, /obj/item/storage/fancy/cigarettes))
to_chat(user, "<span class='notice'>You cannot directly fill this object.</span>")
to_chat(user, span("notice", "You cannot directly fill this object."))
return
if(!target.reagents.get_free_space())
to_chat(user, "<span class='notice'>[target] is full.</span>")
to_chat(user, span("notice", "[target] is full."))
return
var/mob/living/carbon/human/H = target
@@ -230,10 +230,10 @@
if(istype(H))
affected = H.get_organ(user.zone_sel.selecting)
if(!affected)
to_chat(user, "<span class='danger'>\The [H] is missing that limb!</span>")
to_chat(user, span("danger", "\The [H] is missing that limb!"))
return
else if(affected.status & ORGAN_ROBOT)
to_chat(user, "<span class='danger'>You cannot inject a robotic limb.</span>")
to_chat(user, span("danger", "You cannot inject a robotic limb."))
return
if(ismob(target) && target != user)
@@ -256,12 +256,12 @@
return
if(injtime == time)
user.visible_message("<span class='warning'>[user] is trying to inject [target] with [visible_name]!</span>")
user.visible_message(span("warning", "[user] is trying to inject [target] with [visible_name]!"))
else
if(isvaurca(H))
user.visible_message("<span class='warning'>[user] begins hunting for an injection port on [target]'s carapace!</span>")
user.visible_message(span("warning", "[user] begins hunting for an injection port on [target]'s carapace!"))
else
user.visible_message("<span class='warning'>[user] begins hunting for an injection port on [target]'s suit!</span>")
user.visible_message(span("warning", "[user] begins hunting for an injection port on [target]'s suit!"))
user.setClickCooldown(DEFAULT_QUICK_COOLDOWN)
user.do_attack_animation(target)
@@ -269,7 +269,7 @@
if(!do_mob(user, target, injtime))
return
user.visible_message("<span class='warning'>[user] injects [target] with the syringe!</span>")
user.visible_message(span("warning", "[user] injects [target] with the syringe!"))
var/trans
if(ismob(target))
@@ -279,7 +279,7 @@
admin_inject_log(user, target, src, contained, reagents.get_temperature(), trans)
else
trans = reagents.trans_to(target, amount_per_transfer_from_this)
to_chat(user, "<span class='notice'>You inject [trans] units of the solution. The syringe now contains [src.reagents.total_volume] units.</span>")
to_chat(user, span("notice", "You inject [trans] units of the solution. The syringe now contains [src.reagents.total_volume] units."))
if (reagents.total_volume <= 0 && mode == SYRINGE_INJECT)
mode = SYRINGE_DRAW
update_icon()
@@ -335,7 +335,7 @@
var/obj/item/organ/external/affecting = H.get_organ(target_zone)
if (!affecting || affecting.is_stump())
to_chat(user, "<span class='danger'>They are missing that limb!</span>")
to_chat(user, span("danger", "They are missing that limb!"))
return
var/hit_area = affecting.name
@@ -345,7 +345,7 @@
if (target != user && H.getarmor(target_zone, "melee") > 5 && prob(50))
for(var/mob/O in viewers(world.view, user))
O.show_message(text("<span class='danger'>[user] tries to stab [target] in \the [hit_area] with [src.name], but the attack is deflected by armor!</span>"), 1)
O.show_message(text(span("danger", "[user] tries to stab [target] in \the [hit_area] with [src.name], but the attack is deflected by armor!")), 1)
user.remove_from_mob(src)
qdel(src)
@@ -355,13 +355,13 @@
return
user.visible_message("<span class='danger'>[user] stabs [target] in \the [hit_area] with [src.name]!</span>")
user.visible_message(span("danger", "[user] stabs [target] in \the [hit_area] with [src.name]!"))
if(affecting.take_damage(3))
H.UpdateDamageIcon()
else
user.visible_message("<span class='danger'>[user] stabs [target] with [src.name]!</span>")
user.visible_message(span("danger", "[user] stabs [target] with [src.name]!"))
target.take_organ_damage(3)// 7 is the same as crowbar punch
var/syringestab_amount_transferred = rand(0, (reagents.total_volume - 5)) //nerfed by popular demand
@@ -390,10 +390,10 @@
/obj/item/reagent_containers/syringe/ld50_syringe/afterattack(obj/target, mob/user, flag)
if(mode == SYRINGE_DRAW && ismob(target)) // No drawing 50 units of blood at once
to_chat(user, "<span class='notice'>This needle isn't designed for drawing blood.</span>")
to_chat(user, span("notice", "This needle isn't designed for drawing blood."))
return
if(user.a_intent == "hurt" && ismob(target)) // No instant injecting
to_chat(user, "<span class='notice'>This syringe is too big to stab someone with it.</span>")
to_chat(user, span("notice", "This syringe is too big to stab someone with it."))
..()
////////////////////////////////////////////////////////////////////////////////