Syringe Refactor. Overhauls Lethal Injection Syringe

This commit is contained in:
Fox McCloud
2019-09-30 18:25:36 -04:00
parent 7766b47093
commit a97d050f4b
25 changed files with 89 additions and 203 deletions
+1 -1
View File
@@ -396,7 +396,7 @@
/datum/plant_gene/trait/stinging/on_throw_impact(obj/item/reagent_containers/food/snacks/grown/G, atom/target)
if(isliving(target) && G.reagents && G.reagents.total_volume)
var/mob/living/L = target
if(L.reagents && L.can_inject(null, 0))
if(L.reagents && L.can_inject(null, FALSE))
var/injecting_amount = max(1, G.seed.potency*0.2) // Minimum of 1, max of 20
var/fraction = min(injecting_amount/G.reagents.total_volume, 1)
G.reagents.reaction(L, INGEST, fraction)
@@ -54,6 +54,8 @@
else
healths.icon_state = "health6"
/mob/living/carbon/alien/humanoid/queen/can_inject()
return FALSE
//Queen verbs
/mob/living/carbon/alien/humanoid/queen/verb/lay_egg()
@@ -1006,7 +1006,7 @@
xylophone=0
return
/mob/living/carbon/human/can_inject(var/mob/user, var/error_msg, var/target_zone, var/penetrate_thick = 0)
/mob/living/carbon/human/can_inject(mob/user, error_msg, target_zone, penetrate_thick = FALSE)
. = 1
if(!target_zone)
+5 -5
View File
@@ -362,15 +362,15 @@
return 1
return 0
// Living mobs use can_inject() to make sure that the mob is not syringe-proof in general.
/mob/living/proc/can_inject()
return TRUE
/mob/living/is_injectable(allowmobs = TRUE)
return (allowmobs && reagents && can_inject())
/mob/living/is_injectable(mob/user, allowmobs = TRUE)
return (allowmobs && reagents && can_inject(user))
/mob/living/is_drawable(allowmobs = TRUE)
return (allowmobs && reagents && can_inject())
/mob/living/is_drawable(mob/user, allowmobs = TRUE)
return (allowmobs && reagents && can_inject(user))
/mob/living/proc/get_organ_target()
var/mob/shooter = src
+3 -3
View File
@@ -92,10 +92,10 @@
/mob/living/silicon/proc/damage_mob(var/brute = 0, var/fire = 0, var/tox = 0)
return
/mob/living/silicon/can_inject(var/mob/user, var/error_msg)
/mob/living/silicon/can_inject(mob/user, error_msg)
if(error_msg)
to_chat(user, "<span class='alert'>Their outer shell is too tough.</span>")
return 0
to_chat(user, "<span class='alert'>[p_their(TRUE)] outer shell is too tough.</span>")
return FALSE
/mob/living/silicon/IsAdvancedToolUser()
return TRUE
@@ -44,7 +44,7 @@
if(. && venom_per_bite > 0 && iscarbon(target) && (!client || a_intent == INTENT_HARM))
var/mob/living/carbon/C = target
var/inject_target = pick("chest", "head")
if(C.can_inject(null, 0, inject_target, 0))
if(C.can_inject(null, FALSE, inject_target, FALSE))
C.reagents.add_reagent("spidertoxin", venom_per_bite)
//nursemaids - these create webs and eggs
@@ -18,7 +18,7 @@
attack_sound = 'sound/creatures/headcrab_attack.ogg'
speak_emote = list("hisses")
var/is_zombie = 0
stat_attack = DEAD //so they continue to attack when they are on the ground.
stat_attack = DEAD //so they continue to attack when they are on the ground.
var/host_species = ""
var/list/human_overlays = list()
@@ -168,5 +168,5 @@
/mob/living/simple_animal/hostile/headcrab/poison/AttackingTarget()
. = ..()
var/mob/living/carbon/C = target
if(C.can_inject(null, 0, "head", 0))
if(C.can_inject(null, FALSE, "head", FALSE))
C.reagents.add_reagent("lsd", 5)
@@ -32,7 +32,7 @@
if(L.reagents.has_reagent("terror_black_toxin", 100))
return ..()
var/inject_target = pick("chest", "head")
if(L.stunned || L.can_inject(null, 0, inject_target, 0))
if(L.stunned || L.can_inject(null, FALSE, inject_target, FALSE))
L.reagents.add_reagent("terror_black_toxin", 30) // inject our special poison
visible_message("<span class='danger'>[src] buries its long fangs deep into the [inject_target] of [target]!</span>")
else
@@ -54,6 +54,6 @@
if(istype(C))
if(!C.reagents.has_reagent("terror_black_toxin", 60))
var/inject_target = pick("chest","head")
if(C.can_inject(null, 0, inject_target, 0))
if(C.can_inject(null, FALSE, inject_target, FALSE))
to_chat(C, "<span class='danger'>[src] slices into you!</span>")
C.reagents.add_reagent("terror_black_toxin", 30)
@@ -80,7 +80,7 @@
..()
return
var/inject_target = pick("chest","head")
if(L.stunned || L.can_inject(null,0,inject_target,0))
if(L.stunned || L.can_inject(null, FALSE, inject_target, FALSE))
if(L.eye_blurry < 60)
L.AdjustEyeBlurry(10)
// instead of having a venom that only lasts seconds, we just add the eyeblur directly.
@@ -339,7 +339,7 @@
if(ismob(target))
var/mob/living/L = target
if(L.reagents)
if(L.can_inject(null, 0, "chest", 0))
if(L.can_inject(null, FALSE, "chest", FALSE))
L.Hallucinate(400)
if(!isterrorspider(L))
L.adjustToxLoss(bonus_tox)
@@ -351,6 +351,6 @@
/obj/structure/spider/terrorweb/queen/web_special_ability(mob/living/carbon/C)
if(istype(C))
var/inject_target = pick("chest","head")
if(C.can_inject(null, 0, inject_target, 0))
if(C.can_inject(null, FALSE, inject_target, FALSE))
C.Hallucinate(400)
C.adjustToxLoss(30)
@@ -42,7 +42,7 @@
else
targets3 += C
else if(ai_target_method == TS_DAMAGE_POISON)
if(C.can_inject(null,0,"chest",0))
if(C.can_inject(null, FALSE, "chest", FALSE))
targets1 += C
else if(C in enemies)
targets2 += C
@@ -40,7 +40,7 @@
return
var/inject_target = pick("chest","head")
L.attack_animal(src)
if(L.stunned || L.paralysis || L.can_inject(null, 0, inject_target, 0))
if(L.stunned || L.paralysis || L.can_inject(null, FALSE, inject_target, FALSE))
if(!IsTSInfected(L) && ishuman(L))
visible_message("<span class='danger'>[src] buries its long fangs deep into the [inject_target] of [L]!</span>")
new /obj/item/organ/internal/body_egg/terror_eggs(L)
@@ -66,6 +66,6 @@
if(istype(C))
if(!IsTSInfected(C) && ishuman(C))
var/inject_target = pick("chest","head")
if(C.can_inject(null, 0, inject_target, 0))
if(C.can_inject(null, FALSE, inject_target, FALSE))
to_chat(C, "<span class='danger'>[src] slices into you!</span>")
new /obj/item/organ/internal/body_egg/terror_eggs(C)
+1 -1
View File
@@ -109,7 +109,7 @@
return
if(!force)
if(M.can_inject(user, 1))
if(M.can_inject(user, TRUE))
to_chat(user, "<span class='warning'>You stab [M] with the pen.</span>")
// to_chat(M, "<span class='danger'>You feel a tiny prick!</span>")
. = 1
@@ -233,7 +233,7 @@
name = "dart"
icon_state = "cbbolt"
damage = 6
var/piercing = 0
var/piercing = FALSE
/obj/item/projectile/bullet/dart/New()
..()
@@ -244,7 +244,7 @@
if(iscarbon(target))
var/mob/living/carbon/M = target
if(blocked != 100)
if(M.can_inject(null,0,hit_zone)) // Pass the hit zone to see if it can inject by whether it hit the head or the body.
if(M.can_inject(null, FALSE, hit_zone, piercing)) // Pass the hit zone to see if it can inject by whether it hit the head or the body.
..()
reagents.trans_to(M, reagents.total_volume)
return 1
@@ -76,7 +76,7 @@
return
if(!istype(M))
return
if(R.total_volume && M.can_inject(user, 1, penetrate_thick = bypass_protection))
if(R.total_volume && M.can_inject(user, TRUE, user.zone_sel.selecting, penetrate_thick = bypass_protection))
to_chat(user, "<span class='notice'>You inject [M] with the injector.</span>")
to_chat(M, "<span class='notice'>You feel a tiny prick!</span>")
@@ -114,7 +114,7 @@
/obj/item/reagent_containers/dropper/precision/viral_injector
/obj/item/reagent_containers/dropper/precision/viral_injector/attack(mob/living/M, mob/living/user, def_zone)
if(M.can_inject(user, 1))
if(M.can_inject(user, TRUE))
to_chat(user, "<span class='warning'>You stab [M] with the [src].</span>")
if(reagents.total_volume && M.reagents)
var/list/injected = list()
@@ -135,8 +135,8 @@
virusData += " ([english_list(english_symptoms)])"
virList += virusData
var/str = english_list(virList)
add_attack_logs(user, M, "Infected with [str].")
add_attack_logs(user, M, "Infected with [str].")
reagents.reaction(M, INGEST, reagents.total_volume)
reagents.trans_to(M, 1)
@@ -24,7 +24,7 @@
if(!iscarbon(M))
return
if(reagents.total_volume && (ignore_flags || M.can_inject(user, 1))) // Ignore flag should be checked first or there will be an error message.
if(reagents.total_volume && (ignore_flags || M.can_inject(user, TRUE))) // Ignore flag should be checked first or there will be an error message.
to_chat(M, "<span class='warning'>You feel a tiny prick!</span>")
to_chat(user, "<span class='notice'>You inject [M] with [src].</span>")
@@ -101,7 +101,7 @@
"<span class='userdanger'>[user] removes [src]'s needle from [L]'s arm!</span>")
end_processing()
else // Inserting the needle
if(!L.can_inject(user, 1))
if(!L.can_inject(user, TRUE))
return
if(amount_per_transfer_from_this > 10) // We only want to be able to transfer 1, 5, or 10 units to people. Higher numbers are for transfering to other containers
to_chat(user, "<span class='warning'>The IV bag can only be used on someone with a transfer amount of 1, 5 or 10.</span>")
@@ -126,7 +126,7 @@
var/trans = reagents.trans_to(target, amount_per_transfer_from_this)
to_chat(user, "<span class='notice'>You transfer [trans] units of the solution to [target].</span>")
else if(istype(target, /obj/item/reagent_containers/glass) && !target.is_open_container())
to_chat(user, "<span class='warning'>You cannot fill [target] while it is sealed.</span>")
return
@@ -1,6 +1,3 @@
////////////////////////////////////////////////////////////////////////////////
/// Syringes.
////////////////////////////////////////////////////////////////////////////////
#define SYRINGE_DRAW 0
#define SYRINGE_INJECT 1
#define SYRINGE_BROKEN 2
@@ -12,14 +9,14 @@
item_state = "syringe_0"
icon_state = "0"
amount_per_transfer_from_this = 5
possible_transfer_amounts = null //list(5,10,15)
possible_transfer_amounts = list()
volume = 15
w_class = WEIGHT_CLASS_TINY
sharp = 1
container_type = TRANSPARENT
var/busy = 0
sharp = TRUE
var/busy = FALSE
var/mode = SYRINGE_DRAW
var/projectile_type = /obj/item/projectile/bullet/dart/syringe
materials = list(MAT_METAL=10, MAT_GLASS=20)
container_type = TRANSPARENT
/obj/item/reagent_containers/syringe/New()
..()
@@ -39,25 +36,14 @@
update_icon()
/obj/item/reagent_containers/syringe/attack_self(mob/user)
switch(mode)
if(SYRINGE_DRAW)
mode = SYRINGE_INJECT
if(SYRINGE_INJECT)
mode = SYRINGE_DRAW
if(SYRINGE_BROKEN)
return
mode = !mode
update_icon()
/obj/item/reagent_containers/syringe/attack_hand()
..()
update_icon()
/obj/item/reagent_containers/syringe/attack(mob/living/M, mob/living/user, def_zone)
return
/obj/item/reagent_containers/syringe/attackby(obj/item/I, mob/user, params)
if(istype(I,/obj/item/storage/bag))
..()
return
/obj/item/reagent_containers/syringe/afterattack(atom/target, mob/user , proximity)
@@ -69,13 +55,9 @@
var/mob/living/L
if(isliving(target))
L = target
if(!L.can_inject(user, 1))
if(!L.can_inject(user, TRUE))
return
if(mode == SYRINGE_BROKEN)
to_chat(user, "<span class='warning'>This syringe is broken!</span>")
return
switch(mode)
if(SYRINGE_DRAW)
@@ -88,15 +70,15 @@
if(target != user)
target.visible_message("<span class='danger'>[user] is trying to take a blood sample from [target]!</span>", \
"<span class='userdanger'>[user] is trying to take a blood sample from [target]!</span>")
busy = 1
busy = TRUE
if(!do_mob(user, target))
busy = 0
busy = FALSE
return
if(reagents.holder_full())
return
busy = 0
busy = FALSE
if(L.transfer_blood_to(src, drawn_amount))
user.visible_message("[user] takes a blood sample from [L].")
user.visible_message("<span class='notice'>[user] takes a blood sample from [L].</span>")
else
to_chat(user, "<span class='warning'>You are unable to draw any blood from [L]!</span>")
@@ -105,15 +87,15 @@
to_chat(user, "<span class='warning'>[target] is empty!</span>")
return
if(!target.is_drawable())
if(!target.is_drawable(user))
to_chat(user, "<span class='warning'>You cannot directly remove reagents from [target]!</span>")
return
var/trans = target.reagents.trans_to(src, amount_per_transfer_from_this) // transfer from, transfer to - who cares?
to_chat(user, "<span class='notice'>You fill [src] with [trans] units of the solution.</span>")
to_chat(user, "<span class='notice'>You fill [src] with [trans] units of the solution. It now contains [reagents.total_volume] units.</span>")
if(reagents.holder_full())
mode=!mode
mode = !mode
update_icon()
if(SYRINGE_INJECT)
@@ -121,17 +103,20 @@
to_chat(user, "<span class='notice'>[src] is empty.</span>")
return
if(!L && !target.is_injectable())
if(!L && !target.is_injectable(user)) //only checks on non-living mobs, due to how can_inject() handles
to_chat(user, "<span class='warning'>You cannot directly fill [target]!</span>")
return
if(target.reagents.total_volume >= target.reagents.maximum_volume)
to_chat(user, "<span class='notice'>[target] is full.</span>")
return
if(L) //living mob
if(!L.can_inject(user, TRUE))
return
if(L != user)
L.visible_message("<span class='danger'>[user] is trying to inject [L]!</span>", \
"<span class='userdanger'>[user] is trying to inject [L]!</span>")
"<span class='userdanger'>[user] is trying to inject you!</span>")
if(!do_mob(user, L))
return
if(!reagents.total_volume)
@@ -148,155 +133,43 @@
add_attack_logs(user, L, "Injected with [name] containing [contained], transfered [amount_per_transfer_from_this] units", reagents.harmless_helper() ? ATKLOG_ALMOSTALL : null)
var/fraction = min(amount_per_transfer_from_this/reagents.total_volume, 1)
var/fraction = min(amount_per_transfer_from_this / reagents.total_volume, 1)
reagents.reaction(L, INGEST, fraction)
reagents.trans_to(target, amount_per_transfer_from_this)
to_chat(user, "<span class='notice'>You inject [amount_per_transfer_from_this] units of the solution. The syringe now contains [reagents.total_volume] units.</span>")
if (reagents.total_volume <= 0 && mode==SYRINGE_INJECT)
if(reagents.total_volume <= 0 && mode == SYRINGE_INJECT)
mode = SYRINGE_DRAW
update_icon()
/obj/item/reagent_containers/syringe/update_icon()
if(mode == SYRINGE_BROKEN)
icon_state = "broken"
overlays.Cut()
return
var/rounded_vol = round(reagents.total_volume,5)
overlays.Cut()
cut_overlays()
var/rounded_vol
if(reagents && reagents.total_volume)
rounded_vol = Clamp(round((reagents.total_volume / volume * 15), 5), 1, 15)
var/image/filling_overlay = mutable_appearance('icons/obj/reagentfillings.dmi', "syringe[rounded_vol]")
filling_overlay.color = mix_color_from_reagents(reagents.reagent_list)
add_overlay(filling_overlay)
else
rounded_vol = 0
icon_state = "[rounded_vol]"
item_state = "syringe_[rounded_vol]"
if(ismob(loc))
var/mob/M = loc
var/injoverlay
switch(mode)
if(SYRINGE_DRAW)
injoverlay = "draw"
if(SYRINGE_INJECT)
injoverlay = "inject"
overlays += injoverlay
icon_state = "[rounded_vol]"
item_state = "syringe_[rounded_vol]"
if(reagents.total_volume)
var/image/filling = image('icons/obj/reagentfillings.dmi', src, "syringe10")
filling.icon_state = "syringe[rounded_vol]"
filling.icon += mix_color_from_reagents(reagents.reagent_list)
overlays += filling
/obj/item/reagent_containers/ld50_syringe
name = "Lethal Injection Syringe"
desc = "A syringe used for lethal injections."
icon = 'icons/goonstation/objects/syringe.dmi'
item_state = "syringe_0"
icon_state = "0"
amount_per_transfer_from_this = 50
possible_transfer_amounts = null //list(5,10,15)
volume = 50
var/mode = SYRINGE_DRAW
/obj/item/reagent_containers/ld50_syringe/on_reagent_change()
update_icon()
/obj/item/reagent_containers/ld50_syringe/pickup(mob/user)
. = ..()
update_icon()
/obj/item/reagent_containers/ld50_syringe/dropped(mob/user)
..()
update_icon()
/obj/item/reagent_containers/ld50_syringe/attack_self(mob/user)
mode = !mode
update_icon()
/obj/item/reagent_containers/ld50_syringe/attack_hand()
..()
update_icon()
/obj/item/reagent_containers/ld50_syringe/attackby(obj/item/I, mob/user)
return
/obj/item/reagent_containers/ld50_syringe/afterattack(obj/target, mob/user , flag)
if(!target.reagents)
return
switch(mode)
if(SYRINGE_DRAW)
if(reagents.total_volume >= reagents.maximum_volume)
to_chat(user, "<span class='warning'>The syringe is full.</span>")
return
if(ismob(target))
if(istype(target, /mob/living/carbon))//I Do not want it to suck 50 units out of people
to_chat(usr, "This needle isn't designed for drawing blood.")
return
else //if not mob
if(!target.reagents.total_volume)
to_chat(user, "<span class='warning'>[target] is empty.</span>")
return
if(!target.is_open_container() && !istype(target,/obj/structure/reagent_dispensers))
to_chat(user, "<span class='warning'>You cannot directly remove reagents from this object.</span>")
return
var/trans = target.reagents.trans_to(src, amount_per_transfer_from_this) // transfer from, transfer to - who cares?
to_chat(user, "<span class='notice'>You fill the syringe with [trans] units of the solution.</span>")
if(reagents.total_volume >= reagents.maximum_volume)
mode=!mode
update_icon()
if(SYRINGE_INJECT)
if(!reagents.total_volume)
to_chat(user, "<span class='warning'>The Syringe is empty.</span>")
return
if(istype(target, /obj/item/implantcase/chem))
return
if(!target.is_open_container() && !ismob(target) && !istype(target, /obj/item/reagent_containers/food))
to_chat(user, "<span class='warning'>You cannot directly fill this object.</span>")
return
if(target.reagents.total_volume >= target.reagents.maximum_volume)
to_chat(user, "<span class='warning'>[target] is full.</span>")
return
if(ismob(target) && target != user)
for(var/mob/O in viewers(world.view, user))
O.show_message(text("<span class='danger'>[] is trying to inject [] with a giant syringe!</span>", user, target), 1)
if(!do_mob(user, target, 300)) return
for(var/mob/O in viewers(world.view, user))
O.show_message(text("<span class='warning'>[] injects [] with a giant syringe!</span>", user, target), 1)
reagents.reaction(target, INGEST)
if(ismob(target) && target == user)
reagents.reaction(target, INGEST)
spawn(5)
var/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 [reagents.total_volume] units.</span>")
if(reagents.total_volume >= reagents.maximum_volume && mode==SYRINGE_INJECT)
mode = SYRINGE_DRAW
update_icon()
/obj/item/reagent_containers/ld50_syringe/update_icon()
var/rounded_vol = round(reagents.total_volume,50)
if(ismob(loc))
var/mode_t
switch(mode)
if(SYRINGE_DRAW)
mode_t = "d"
if(SYRINGE_INJECT)
mode_t = "i"
icon_state = "[mode_t][rounded_vol]"
else
icon_state = "[rounded_vol]"
item_state = "syringe_[rounded_vol]"
add_overlay(injoverlay)
M.update_inv_l_hand()
M.update_inv_r_hand()
/obj/item/reagent_containers/syringe/antiviral
name = "Syringe (spaceacillin)"
desc = "Contains antiviral agents."
list_reagents = list("spaceacillin" = 15)
/obj/item/reagent_containers/ld50_syringe/lethal
list_reagents = list("cyanide" = 10, "neurotoxin2" = 40)
/obj/item/reagent_containers/syringe/charcoal
name = "Syringe (charcoal)"
desc = "Contains charcoal - used to treat toxins and damage from toxins."
@@ -342,4 +215,11 @@
/obj/item/reagent_containers/syringe/pancuronium
name = "pancuronium syringe"
desc = "A powerful paralyzing poison."
list_reagents = list("pancuronium" = 15)
list_reagents = list("pancuronium" = 15)
/obj/item/reagent_containers/syringe/lethal
name = "lethal injection syringe"
desc = "A syringe used for lethal injections. It can hold up to 50 units."
amount_per_transfer_from_this = 50
volume = 50
list_reagents = list("toxin" = 15, "pancuronium" = 10, "cyanide" = 5, "facid" = 10, "fluorine" = 10)