From dbc48b9792ed26a98be0e422d64bed0f15078641 Mon Sep 17 00:00:00 2001 From: hazelrat <83198434+hazelrat@users.noreply.github.com> Date: Thu, 27 Feb 2025 13:34:23 +0000 Subject: [PATCH] Jabbing other people with overloaders (#20463) Allows you to jab other people with an overloader. Adds some more documentation to overloader code, and adjusts effect_time and effects so that overloaders last the same amount of time but provide more messages to the user than before. --------- Signed-off-by: hazelrat <83198434+hazelrat@users.noreply.github.com> Co-authored-by: Fluffy <65877598+FluffyGhoster@users.noreply.github.com> --- code/__DEFINES/items_clothing.dm | 5 ++ code/game/objects/items/ipc_overloaders.dm | 65 +++++++++++++++++-- code/modules/mob/living/carbon/human/human.dm | 8 --- html/changelogs/hazelmouse-overloaders.yml | 61 +++++++++++++++++ 4 files changed, 127 insertions(+), 12 deletions(-) create mode 100644 html/changelogs/hazelmouse-overloaders.yml diff --git a/code/__DEFINES/items_clothing.dm b/code/__DEFINES/items_clothing.dm index 6a43e2ae67d..864813ecb0f 100644 --- a/code/__DEFINES/items_clothing.dm +++ b/code/__DEFINES/items_clothing.dm @@ -207,3 +207,8 @@ #define SUIT_NO_SENSORS EMPTY_BITFIELD #define SUIT_HAS_SENSORS FLAG(0) #define SUIT_LOCKED_SENSORS FLAG(1) + +// Modifiers for injections, used for syringes, hyposprays, and overloaders. +#define INJECTION_FAIL 0 +#define BASE_INJECTION_MOD 1 // x1 multiplier with no effects +#define SUIT_INJECTION_MOD 2 // x2 multiplier if target is wearing spacesuit diff --git a/code/game/objects/items/ipc_overloaders.dm b/code/game/objects/items/ipc_overloaders.dm index fd36edd1619..2af4f1ea309 100644 --- a/code/game/objects/items/ipc_overloaders.dm +++ b/code/game/objects/items/ipc_overloaders.dm @@ -5,9 +5,12 @@ icon_state = "classic" w_class = WEIGHT_CLASS_TINY contained_sprite = TRUE + /// Total number of times an overloader can be used. var/uses = 2 - var/effect_time = 90 SECONDS - var/effects = 4 + /// Total length of time between effects. + var/effect_time = 30 SECONDS + /// Determines how many midway overloader effects are experienced. + var/effects = 12 var/static/list/step_up_effects = list( TRAIT_OVERLOADER_OD_INITIAL = TRAIT_OVERLOADER_OD_MEDIUM, @@ -39,12 +42,14 @@ else . += SPAN_WARNING("It's totally spent.") +// Jabbing yourself with an overloader. /obj/item/ipc_overloader/attack_self(mob/user) if(!uses) to_chat(user, SPAN_WARNING("\The [src] is totally spent.")) return if(isipc(user)) user.visible_message("[user] jabs themselves with \the [src].", SPAN_NOTICE("You jab yourself with \the [src].")) + user.do_attack_animation(user) handle_overloader_effect(user) if(effect_time) addtimer(CALLBACK(src, PROC_REF(midway_overloader_effect), user, effects), effect_time) @@ -53,21 +58,73 @@ return to_chat(user, SPAN_WARNING("\The [src] has no use for you!")) +// Jabbing someone else with an overloader. +// TODO: Clean up the common ground with attack_self, there's a lot of clunkily repeated code right now. +/obj/item/ipc_overloader/attack(mob/living/carbon/human/target_human, mob/user, target_zone) + if(!ishuman(target_human)) + return + + var/obj/item/organ/external/organ = target_human.get_organ(target_zone) + if (!organ) + to_chat(target_human, SPAN_NOTICE("\The [target_human] is missing that limb.")) + return + + if(!uses) + to_chat(user, SPAN_WARNING("\The [src] is totally spent.")) + return + + var/injection_modifier = target_human.get_bp_coverage(target_zone) + switch(injection_modifier) + if(INJECTION_FAIL) + to_chat(user, SPAN_WARNING("There is no exposed area on that body part.")) + return + + if(SUIT_INJECTION_MOD) + user.visible_message(SPAN_WARNING("\The [user] is searching for an injection port to jab \the [target_human] with \the [src]!"), SPAN_NOTICE("You are searching for an injection port to jab \the [target_human] with \the [src].")) + else + user.visible_message(SPAN_WARNING("\The [user] is trying to jab \the [target_human] with \the [src]!"), SPAN_NOTICE("You are trying to jab \the [target_human] with \the [src].")) + + if(do_mob(user, target_human, 2 SECONDS * injection_modifier)) + // Checking this again if the target put on armour after the injection began. + injection_modifier = target_human.get_bp_coverage(target_zone) + if(injection_modifier == INJECTION_FAIL) + to_chat(user, SPAN_WARNING("There is no exposed area on that body part.")) + return + + user.visible_message(SPAN_WARNING("\The [user] jabs \the [target_human] with \the [src]!"), SPAN_NOTICE("You jab \the [target_human] with \the [src].")) + user.do_attack_animation(target_human) + + // If synthetic, they receive the overloader effects. + // There are no overt indications to the user that the target mob is synthetic, so this can't be used to check for secret shells. + if(isipc(target_human)) + handle_overloader_effect(target_human) + if(effect_time) + addtimer(CALLBACK(src, PROC_REF(midway_overloader_effect), target_human, effects), effect_time) + uses-- + update_icon() + + // If not synthetic, and the targeted organ can feel pain, the target feels pain because they just got jabbed with a thumb drive. + else if (organ && ORGAN_CAN_FEEL_PAIN(organ)) + to_chat(target_human, SPAN_DANGER("You are sharply jabbed by \the [src]!")) + target_human.apply_damage(2, DAMAGE_PAIN, target_zone) + +/// Procs immediately after using the overloader. /obj/item/ipc_overloader/proc/handle_overloader_effect(var/mob/living/carbon/human/target) handle_overdose(target) +/// Procs as many times as the effect_amount variable, with a time between effects determined by effect_time. /obj/item/ipc_overloader/proc/midway_overloader_effect(var/mob/living/carbon/human/target, var/effect_amount) if(effect_amount) addtimer(CALLBACK(src, PROC_REF(midway_overloader_effect), target, effect_amount - 1), effect_time) return TRUE - addtimer(CALLBACK(src, PROC_REF(finish_overloader_effect), target), effect_time) finish_overloader_effect(target) return FALSE +/// Procs once all effects are expended. /obj/item/ipc_overloader/proc/finish_overloader_effect(var/mob/living/carbon/human/target) handle_overdose_stepdown(target) -// use traits to step up and down from the overdose effects +/// Uses traits to step up and down from the overdose effects. /obj/item/ipc_overloader/proc/handle_overdose(var/mob/living/carbon/human/target) var/added_trait = FALSE for(var/trait in step_up_effects) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 3b2dc5381b8..acde205e213 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1653,10 +1653,6 @@ W.message = message W.add_fingerprint(src) -#define INJECTION_FAIL 0 -#define BASE_INJECTION_MOD 1 // x1 multiplier with no effects -#define SUIT_INJECTION_MOD 2 // x2 multiplier if target is wearing spacesuit - /mob/living/carbon/human/can_inject(var/mob/user, var/error_msg, var/target_zone, var/handle_coverage = TRUE) . = BASE_INJECTION_MOD @@ -1717,10 +1713,6 @@ if(. == INJECTION_FAIL) return -#undef INJECTION_FAIL -#undef BASE_INJECTION_MOD -#undef SUIT_INJECTION_MOD - /mob/living/carbon/human/print_flavor_text(var/shrink = 1) var/list/equipment = list(src.head,src.wear_mask,src.glasses,src.w_uniform,src.wear_suit,src.gloves,src.shoes) var/head_exposed = 1 diff --git a/html/changelogs/hazelmouse-overloaders.yml b/html/changelogs/hazelmouse-overloaders.yml new file mode 100644 index 00000000000..1091cf4a654 --- /dev/null +++ b/html/changelogs/hazelmouse-overloaders.yml @@ -0,0 +1,61 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# - (fixes bugs) +# wip +# - (work in progress) +# qol +# - (quality of life) +# soundadd +# - (adds a sound) +# sounddel +# - (removes a sound) +# rscadd +# - (adds a feature) +# rscdel +# - (removes a feature) +# imageadd +# - (adds an image or sprite) +# imagedel +# - (removes an image or sprite) +# spellcheck +# - (fixes spelling or grammar) +# experiment +# - (experimental change) +# balance +# - (balance changes) +# code_imp +# - (misc internal code change) +# refactor +# - (refactors code) +# config +# - (makes a change to the config files) +# admin +# - (makes changes to administrator tools) +# server +# - (miscellaneous changes to server) +################################# + +# Your name. +author: hazelmouse + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, this gets changed to [] after reading. Just remove the brackets when you add new shit. +# Please surround your changes in double quotes ("). It works without them, but if you use certain characters it screws up compiling. The quotes will not show up in the changelog. +changes: + - rscadd: "You can now jab other people with overloaders, after a short delay." + - rscadd: "Overloaders now provide more messages to the user than before." + - code_imp: "Expanded documentation in overloader code." + - bugfix: "Overloaders should no longer play multiple messages while ending."