From da261e24d8f94f50d4142c3a39a668488958c182 Mon Sep 17 00:00:00 2001 From: Geeves Date: Sun, 11 Apr 2021 12:41:40 +0200 Subject: [PATCH] Syringe Tweak (#11622) --- code/__defines/items_clothing.dm | 17 ++++--- .../modules/clothing/spacesuits/spacesuits.dm | 4 +- code/modules/mob/living/carbon/human/human.dm | 51 +++++++++++++------ .../reagents/reagent_containers/syringes.dm | 9 ++-- html/changelogs/geeves-syringe_tweak.yml | 9 ++++ 5 files changed, 61 insertions(+), 29 deletions(-) create mode 100644 html/changelogs/geeves-syringe_tweak.yml diff --git a/code/__defines/items_clothing.dm b/code/__defines/items_clothing.dm index 35c45a0c1e9..3b16c9db8ac 100644 --- a/code/__defines/items_clothing.dm +++ b/code/__defines/items_clothing.dm @@ -32,14 +32,15 @@ #define PROXMOVE 0x80 // Does this object require proximity checking in Enter()? //Flags for items (equipment) -#define THICKMATERIAL 0x1 // Prevents syringes, parapens and hyposprays if equiped to slot_suit or slot_head. -#define STOPPRESSUREDAMAGE 0x2 // Counts towards pressure protection. Note that like temperature protection, body_parts_covered is considered here as well. -#define AIRTIGHT 0x4 // Functions with internals. -#define NOSLIP 0x8 // Prevents from slipping on wet floors, in space, etc. -#define BLOCK_GAS_SMOKE_EFFECT 0x10 // Blocks the effect that chemical clouds would have on a mob -- glasses, mask and helmets ONLY! (NOTE: flag shared with ONESIZEFITSALL) -#define FLEXIBLEMATERIAL 0x20 // At the moment, masks with this flag will not prevent eating even if they are covering your face. -#define SOUNDPROTECTION 0x40 // whether wearing this item will protect you from loud noises such as flashbangs | this only works for ear slots or the head slot -#define LIGHTSTEP 0x80 // When applied to footwear, this makes it so that they don't trigger things like landmines and mouse traps +#define THICKMATERIAL 0x1 // Prevents syringes, parapens and hyposprays if equiped to slot_suit or slot_head. +#define STOPPRESSUREDAMAGE 0x2 // Counts towards pressure protection. Note that like temperature protection, body_parts_covered is considered here as well. +#define AIRTIGHT 0x4 // Functions with internals. +#define NOSLIP 0x8 // Prevents from slipping on wet floors, in space, etc. +#define BLOCK_GAS_SMOKE_EFFECT 0x10 // Blocks the effect that chemical clouds would have on a mob -- glasses, mask and helmets ONLY! (NOTE: flag shared with ONESIZEFITSALL) +#define FLEXIBLEMATERIAL 0x20 // At the moment, masks with this flag will not prevent eating even if they are covering your face. +#define SOUNDPROTECTION 0x40 // whether wearing this item will protect you from loud noises such as flashbangs | this only works for ear slots or the head slot +#define LIGHTSTEP 0x80 // When applied to footwear, this makes it so that they don't trigger things like landmines and mouse traps +#define INJECTIONPORT 0x100 // Allows syringes and hyposprays to inject, even if the material is thick // Flags for pass_flags. #define PASSTABLE 0x1 diff --git a/code/modules/clothing/spacesuits/spacesuits.dm b/code/modules/clothing/spacesuits/spacesuits.dm index e16b519bc6e..ce7e2273b9b 100644 --- a/code/modules/clothing/spacesuits/spacesuits.dm +++ b/code/modules/clothing/spacesuits/spacesuits.dm @@ -6,7 +6,7 @@ name = "space helmet" icon_state = "space" desc = "A special helmet designed for work in a hazardous, low-pressure environment." - item_flags = STOPPRESSUREDAMAGE | THICKMATERIAL | AIRTIGHT + item_flags = STOPPRESSUREDAMAGE | THICKMATERIAL | INJECTIONPORT | AIRTIGHT item_state_slots = list( slot_l_hand_str = "s_helmet", slot_r_hand_str = "s_helmet" @@ -40,7 +40,7 @@ w_class = ITEMSIZE_LARGE//bulky item gas_transfer_coefficient = 0.01 permeability_coefficient = 0.02 - item_flags = STOPPRESSUREDAMAGE | THICKMATERIAL + item_flags = STOPPRESSUREDAMAGE|THICKMATERIAL|INJECTIONPORT body_parts_covered = UPPER_TORSO|LOWER_TORSO|LEGS|FEET|ARMS|HANDS allowed = list(/obj/item/device/flashlight,/obj/item/tank/emergency_oxygen,/obj/item/device/suit_cooling_unit) slowdown = 3 diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index d534453eb9c..2b336c0be14 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1519,15 +1519,12 @@ if(!target_zone) if(!user) - target_zone = pick(BP_CHEST,BP_CHEST,BP_CHEST,"left leg","right leg","left arm", "right arm", BP_HEAD) + target_zone = pick(BP_CHEST, BP_CHEST, BP_CHEST, BP_L_LEG, BP_R_LEG, BP_L_ARM, BP_R_ARM, BP_HEAD) else target_zone = user.zone_sel.selecting . *= species.get_injection_modifier() - if(isvaurca(src)) - user.visible_message(SPAN_WARNING("[user] begins hunting for an injection port on [src]'s carapace!")) - var/obj/item/organ/external/affecting = get_organ(target_zone) var/fail_msg if(!affecting) @@ -1537,22 +1534,46 @@ . = INJECTION_FAIL fail_msg = "That limb is robotic." else - switch(target_zone) - if(BP_HEAD) - if(head && head.item_flags & THICKMATERIAL) - . = INJECTION_FAIL - else - if(wear_suit && wear_suit.item_flags & THICKMATERIAL) - if(istype(wear_suit, /obj/item/clothing/suit/space)) - user.visible_message(SPAN_WARNING("[user] begins hunting for an injection port on [src]'s suit!")) - . *= SUIT_INJECTION_MOD - else - . = INJECTION_FAIL + . *= get_bp_coverage(target_zone) + if(isvaurca(src) && . == SUIT_INJECTION_MOD) + user.visible_message("[user] begins hunting for an injection port on \the [src]'s carapace.") + else if(. >= SUIT_INJECTION_MOD) + user.visible_message("[user] begins hunting for \the [src]'s injection port.") if(!. && error_msg && user) if(!fail_msg) fail_msg = "There is no exposed flesh or thin material [target_zone == BP_HEAD ? "on their head" : "on their body"] to inject into." to_chat(user, SPAN_ALERT("[fail_msg]")) +/mob/living/carbon/human/proc/get_bp_coverage(var/bp) + . = BASE_INJECTION_MOD + var/static/list/bp_to_coverage = list( + BP_HEAD = HEAD, + BP_EYES = EYES, + BP_MOUTH = FACE, + BP_CHEST = UPPER_TORSO, + BP_GROIN = LOWER_TORSO, + BP_L_ARM = (ARMS|ARM_LEFT), + BP_R_ARM = (ARMS|ARM_RIGHT), + BP_L_HAND = (HANDS|HAND_LEFT), + BP_R_HAND = (HANDS|HAND_RIGHT), + BP_L_LEG = (LEGS|LEG_LEFT), + BP_R_LEG = (LEGS|LEG_RIGHT), + BP_L_FOOT = (FEET|FOOT_LEFT), + BP_R_FOOT = (FEET|FOOT_RIGHT) + ) + for(var/obj/item/C in list(wear_suit, head, wear_mask, w_uniform, gloves, shoes)) + var/injection_modifier = BASE_INJECTION_MOD + if(C.item_flags & INJECTIONPORT) + injection_modifier = SUIT_INJECTION_MOD + else if(C.item_flags & THICKMATERIAL) + injection_modifier = INJECTION_FAIL + if(. == SUIT_INJECTION_MOD && injection_modifier != INJECTION_FAIL) // don't reset it back to the base, unless it completely blocks + continue + if(C.body_parts_covered & bp_to_coverage[bp]) + . = injection_modifier + if(. == INJECTION_FAIL) + return + #undef INJECTION_FAIL #undef BASE_INJECTION_MOD #undef SUIT_INJECTION_MOD diff --git a/code/modules/reagents/reagent_containers/syringes.dm b/code/modules/reagents/reagent_containers/syringes.dm index f33c0bed594..21266cf5982 100644 --- a/code/modules/reagents/reagent_containers/syringes.dm +++ b/code/modules/reagents/reagent_containers/syringes.dm @@ -219,17 +219,18 @@ return if(ismob(target) && target != user) + var/inject_time = time if(isliving(target)) var/mob/living/L = target - var/injtime = L.can_inject(user, TRUE, user.zone_sel.selecting) - if(!injtime) + var/inject_mod = L.can_inject(user, TRUE, user.zone_sel.selecting) + if(!inject_mod) return - time *= injtime + inject_time *= inject_mod user.setClickCooldown(DEFAULT_QUICK_COOLDOWN) user.do_attack_animation(target) - if(!do_mob(user, target, time)) + if(!do_mob(user, target, inject_time)) return user.visible_message(SPAN_WARNING("[user] injects [target] with the syringe!")) diff --git a/html/changelogs/geeves-syringe_tweak.yml b/html/changelogs/geeves-syringe_tweak.yml new file mode 100644 index 00000000000..007bc9757d5 --- /dev/null +++ b/html/changelogs/geeves-syringe_tweak.yml @@ -0,0 +1,9 @@ +author: Geeves + +delete-after: True + +changes: + - tweak: "Reworks how syringes figure out if they're blocked or looking for injection ports. It now checks for any piece of clothing that covers that specific bodypart." + - rscadd: "Spacesuit helmets now have injection ports too." + - tweak: "Made the species injection modifier stack with the clothing modifier, meaning a vaurca wearing a voidsuit will take much longer to inject." + - bugfix: "Fixed timers for syringe injection through in injection port increasing exponentially." \ No newline at end of file