mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-21 11:07:12 +01:00
Make can_inject deterministic; fix odysseus syringes sometimes not working [PR #12858, take two] (#14637)
* PR #12858 revival * Move the can_inject unit tests to unit_tests/ * Remove the can_inject unit tests
This commit is contained in:
@@ -1021,34 +1021,34 @@
|
||||
return
|
||||
|
||||
/mob/living/carbon/human/can_inject(mob/user, error_msg, target_zone, penetrate_thick = FALSE)
|
||||
. = 1
|
||||
. = TRUE
|
||||
|
||||
if(!target_zone)
|
||||
if(!user)
|
||||
target_zone = pick("chest","chest","chest","left leg","right leg","left arm", "right arm", "head")
|
||||
. = FALSE
|
||||
CRASH("can_inject() called on a human mob with neither a user nor a targeting zone selected.")
|
||||
else
|
||||
target_zone = user.zone_selected
|
||||
|
||||
|
||||
if(PIERCEIMMUNE in dna.species.species_traits)
|
||||
. = 0
|
||||
. = FALSE
|
||||
|
||||
var/obj/item/organ/external/affecting = get_organ(target_zone)
|
||||
var/fail_msg
|
||||
if(!affecting)
|
||||
. = 0
|
||||
. = FALSE
|
||||
fail_msg = "[p_they(TRUE)] [p_are()] missing that limb."
|
||||
else if(affecting.is_robotic())
|
||||
. = 0
|
||||
. = FALSE
|
||||
fail_msg = "That limb is robotic."
|
||||
else
|
||||
switch(target_zone)
|
||||
if("head")
|
||||
if(head && head.flags & THICKMATERIAL && !penetrate_thick)
|
||||
. = 0
|
||||
. = FALSE
|
||||
else
|
||||
if(wear_suit && wear_suit.flags & THICKMATERIAL && !penetrate_thick)
|
||||
. = 0
|
||||
. = FALSE
|
||||
if(!. && error_msg && user)
|
||||
if(!fail_msg)
|
||||
fail_msg = "There is no exposed flesh or thin material [target_zone == "head" ? "on [p_their()] head" : "on [p_their()] body"] to inject into."
|
||||
|
||||
Reference in New Issue
Block a user