Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes Autoinjectors and Some Hyposprays Working on Robotic/Missing Limbs, Minor Refactor of can_inject() and Related Variables #27118

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions code/modules/mob/living/carbon/human/human_mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@
xylophone=0
return

/mob/living/carbon/human/can_inject(mob/user, error_msg, target_zone, penetrate_thick = FALSE, piercing = FALSE)
/mob/living/carbon/human/can_inject(mob/user, error_msg, target_zone, penetrate_thick = FALSE, penetrate_everything = FALSE)
. = TRUE

if(!target_zone)
Expand All @@ -823,12 +823,6 @@
else
target_zone = user.zone_selected

if(HAS_TRAIT(src, TRAIT_PIERCEIMMUNE))
. = FALSE

if(wear_suit && HAS_TRAIT(wear_suit, TRAIT_RSG_IMMUNE))
return FALSE

var/obj/item/organ/external/affecting = get_organ(target_zone)
var/fail_msg
if(!affecting)
Expand All @@ -838,9 +832,16 @@
. = FALSE
fail_msg = "That limb is robotic."

if(piercing)
// If there is flesh, inject.
if(penetrate_everything)
return TRUE

if(HAS_TRAIT(src, TRAIT_PIERCEIMMUNE))
. = FALSE

if(wear_suit && HAS_TRAIT(wear_suit, TRAIT_RSG_IMMUNE))
. = FALSE

if(target_zone == "head")
if((head?.flags & THICKMATERIAL) && !penetrate_thick)
. = FALSE
Expand Down
6 changes: 3 additions & 3 deletions code/modules/projectiles/projectile/bullets.dm
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@
name = "dart"
icon_state = "cbbolt"
damage = 6
var/piercing = FALSE
var/penetrate_thick = FALSE

/obj/item/projectile/bullet/dart/New()
..()
Expand All @@ -235,7 +235,7 @@
if(iscarbon(target))
var/mob/living/carbon/M = target
if(blocked != INFINITY)
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.
if(M.can_inject(null, FALSE, hit_zone, penetrate_thick)) // Pass the hit zone to see if it can inject by whether it hit the head or the body.
..()

reagents.reaction(M, REAGENT_INGEST, 0.1)
Expand Down Expand Up @@ -268,7 +268,7 @@
damage = 20

/obj/item/projectile/bullet/dart/syringe/pierce_ignore
piercing = TRUE
penetrate_thick = TRUE

/obj/item/projectile/bullet/dart/syringe/tranquilizer

Expand Down
12 changes: 6 additions & 6 deletions code/modules/reagents/reagent_containers/borghydro.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/// How many SSobj ticks it takes for the reagents to recharge by 10 units
var/recharge_time = 3
/// Can the autohypo inject through thick materials?
var/bypass_protection = 0
var/penetrate_thick = FALSE
var/choosen_reagent = "salglu_solution"
var/list/datum/reagents/reagent_list = list()
var/list/reagent_ids = list("salglu_solution", "epinephrine", "spaceacillin", "charcoal", "hydrocodone", "mannitol", "salbutamol")
Expand Down Expand Up @@ -57,14 +57,14 @@
reagent_ids = list("syndicate_nanites", "potass_iodide", "hydrocodone")
total_reagents = 30
maximum_reagents = 30
bypass_protection = TRUE
penetrate_thick = TRUE
choosen_reagent = "syndicate_nanites"

/obj/item/reagent_containers/borghypo/abductor
charge_cost = 40
recharge_time = 3
reagent_ids = list("salglu_solution", "epinephrine", "hydrocodone", "spaceacillin", "charcoal", "mannitol", "salbutamol", "corazone")
bypass_protection = 1
penetrate_thick = TRUE

/obj/item/reagent_containers/borghypo/Initialize(mapload)
. = ..()
Expand Down Expand Up @@ -94,7 +94,7 @@
return
if(!istype(M))
return
if(total_reagents && M.can_inject(user, TRUE, user.zone_selected, penetrate_thick = bypass_protection))
if(total_reagents && M.can_inject(user, TRUE, user.zone_selected, penetrate_thick))
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>")

Expand Down Expand Up @@ -127,11 +127,11 @@
/obj/item/reagent_containers/borghypo/emag_act(mob/user)
if(!emagged)
emagged = TRUE
bypass_protection = TRUE
penetrate_thick = TRUE
reagent_ids += reagent_ids_emagged
return
emagged = FALSE
bypass_protection = FALSE
penetrate_thick = FALSE
reagent_ids -= reagent_ids_emagged

/obj/item/reagent_containers/borghypo/basic
Expand Down
23 changes: 15 additions & 8 deletions code/modules/reagents/reagent_containers/hypospray.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
resistance_flags = ACID_PROOF
container_type = OPENCONTAINER
slot_flags = SLOT_FLAG_BELT
/// If TRUE, the hypospray can inject through most hardsuits/modsuits.
var/can_pierce_hardsuits = FALSE
/// If TRUE, the hypospray can inject any clothing without TRAIT_HYPOSPRAY_IMMUNE.
var/penetrate_thick = FALSE
/// If TRUE, the hypospray isn't blocked by suits with TRAIT_HYPOSPRAY_IMMUNE.
var/ignore_hypospray_immunity = FALSE
/// if TRUE, the hypospray will always succeed at injecting an organic limb regardless of protective clothing or traits such as the thick skin gene (except for TRAIT_HYPOSPRAY_IMMUNE).
var/penetrate_everything = FALSE
/// If TRUE, the hypospray will reject any chemicals not on the safe_chem_list.
var/safety_hypo = FALSE
// List of SOSHA-approved medicines.
Expand All @@ -32,16 +34,18 @@
if(!reagents.total_volume)
to_chat(user, "<span class='warning'>[src] is empty!</span>")
return

if(!iscarbon(M))
return

var/mob/living/carbon/human/H = M
if(H.wear_suit)
if(HAS_TRAIT(H.wear_suit, TRAIT_HYPOSPRAY_IMMUNE) && !ignore_hypospray_immunity) // This check is here entirely to stop goobers injecting nukies with meme chems
// This check is here entirely to stop goobers injecting Nukies, the SST, and the Deathsquad with meme chems.
if(HAS_TRAIT(H.wear_suit, TRAIT_HYPOSPRAY_IMMUNE) && !ignore_hypospray_immunity)
to_chat(user, "<span class='warning'>[src] is unable to penetrate the armour of [M] or interface with any injection ports.</span>")
return

if(reagents.total_volume && (can_pierce_hardsuits || M.can_inject(user, TRUE))) // can_pierce_hardsuits should be checked first or there will be an error message.
if(reagents.total_volume && M.can_inject(user, TRUE, user.zone_selected, penetrate_thick, penetrate_everything))
to_chat(M, "<span class='warning'>You feel a tiny prick!</span>")
to_chat(user, "<span class='notice'>You inject [M] with [src].</span>")

Expand Down Expand Up @@ -99,7 +103,8 @@
/obj/item/reagent_containers/hypospray/emag_act(mob/user)
if(safety_hypo && !emagged)
emagged = TRUE
can_pierce_hardsuits = TRUE
penetrate_thick = TRUE
penetrate_everything = TRUE
to_chat(user, "<span class='warning'>You short out the safeties on [src].</span>")
return TRUE

Expand All @@ -124,8 +129,9 @@
possible_transfer_amounts = list(5, 10, 15, 20, 25, 30)
icon_state = "combat_hypo"
volume = 90
can_pierce_hardsuits = TRUE // So they can heal their comrades.
penetrate_thick = TRUE // So they can heal their comrades.
ignore_hypospray_immunity = TRUE
penetrate_everything = TRUE
list_reagents = list("epinephrine" = 30, "weak_omnizine" = 30, "salglu_solution" = 30)

/obj/item/reagent_containers/hypospray/combat/nanites
Expand All @@ -148,7 +154,7 @@
desc = "Nanotrasen's own, reverse-engineered and improved version of DeForest's hypospray."
list_reagents = list("omnizine" = 30)
volume = 100
can_pierce_hardsuits = TRUE
penetrate_thick = TRUE
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | ACID_PROOF

/obj/item/reagent_containers/hypospray/CMO/Initialize(mapload)
Expand Down Expand Up @@ -177,8 +183,9 @@
amount_per_transfer_from_this = 10
possible_transfer_amounts = null
volume = 10
can_pierce_hardsuits = TRUE //so you can medipen through hardsuits
penetrate_thick = TRUE
ignore_hypospray_immunity = TRUE
penetrate_everything = TRUE // Autoinjectors bypass everything.
container_type = DRAWABLE
flags = null

Expand Down