From fcbb09914fa0bd924a78876e1b24b06dcdda0047 Mon Sep 17 00:00:00 2001 From: private-tristan <54422837+private-tristan@users.noreply.github.com> Date: Mon, 23 Sep 2024 04:25:56 -0400 Subject: [PATCH] Injector and Coagulator plates now function (#7173) # About the pull request made the plates actually work. Fixes #7142 All code was made by kiVts, I just took the code and made a PR for them now because #7023 is on draft until it's done. # Explain why it's good for the game The things that research spends biomass points on should work??? # Testing Photographs and Procedure tested on a private server, stabbed myself a few times with a knife, no bloodloss, injector plate works (with all OD modes functional). # Changelog :cl: Private-Tristan, KiVts fix: Injector and Coagulator plates are now functional. /:cl: --- .../__DEFINES/dcs/signals/atom/signals_obj.dm | 4 +++ code/datums/effects/bleeding.dm | 4 +++ code/modules/cm_tech/implements/armor.dm | 25 +++++++++---------- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/code/__DEFINES/dcs/signals/atom/signals_obj.dm b/code/__DEFINES/dcs/signals/atom/signals_obj.dm index c850b2a52e03..35aa07a63563 100644 --- a/code/__DEFINES/dcs/signals/atom/signals_obj.dm +++ b/code/__DEFINES/dcs/signals/atom/signals_obj.dm @@ -2,6 +2,10 @@ // Sent after the limb has taken damage #define COMSIG_LIMB_TAKEN_DAMAGE "limb_taken_damage" +// From /datum/effects/bleeding/internal/process_mob() and /datum/effects/bleeding/external/process_mob() +#define COMSIG_BLEEDING_PROCESS "bleeding_process" + #define COMPONENT_BLEEDING_CANCEL (1<<0) + /// From /obj/effect/alien/weeds/Initialize() #define COMSIG_WEEDNODE_GROWTH_COMPLETE "weednode_growth_complete" /// From /obj/effect/alien/weeds/Initialize() diff --git a/code/datums/effects/bleeding.dm b/code/datums/effects/bleeding.dm index f56efbb3c69d..4509348b0ccf 100644 --- a/code/datums/effects/bleeding.dm +++ b/code/datums/effects/bleeding.dm @@ -81,6 +81,8 @@ if(affected_human.chem_effect_flags & CHEM_EFFECT_NO_BLEEDING) buffer_blood_loss = 0 return FALSE + if(SEND_SIGNAL(affected_human, COMSIG_BLEEDING_PROCESS, FALSE) & COMPONENT_BLEEDING_CANCEL) + return FALSE affected_mob.drip(buffer_blood_loss) buffer_blood_loss = 0 @@ -111,6 +113,8 @@ if(istype(affected_human)) if(affected_human.chem_effect_flags & CHEM_EFFECT_NO_BLEEDING) return FALSE + if(SEND_SIGNAL(affected_human, COMSIG_BLEEDING_PROCESS, TRUE) & COMPONENT_BLEEDING_CANCEL) + return FALSE blood_loss = max(blood_loss, 0) // Bleeding shouldn't give extra blood even if its only 1 tick affected_mob.blood_volume = max(affected_mob.blood_volume - blood_loss, 0) diff --git a/code/modules/cm_tech/implements/armor.dm b/code/modules/cm_tech/implements/armor.dm index 0e772567ea1a..5ed344a42d8b 100644 --- a/code/modules/cm_tech/implements/armor.dm +++ b/code/modules/cm_tech/implements/armor.dm @@ -271,26 +271,25 @@ /obj/item/clothing/accessory/health/research_plate/coagulator/on_attached(obj/item/clothing/S, mob/living/carbon/human/user) . = ..() - if (user.chem_effect_flags & CHEM_EFFECT_NO_BLEEDING) - return - user.chem_effect_flags |= CHEM_EFFECT_NO_BLEEDING + RegisterSignal(user, COMSIG_BLEEDING_PROCESS, PROC_REF(cancel_bleeding)) to_chat(user, SPAN_NOTICE("You feel tickling as you activate [src].")) +/obj/item/clothing/accessory/health/research_plate/coagulator/proc/cancel_bleeding() + SIGNAL_HANDLER + return COMPONENT_BLEEDING_CANCEL + /obj/item/clothing/accessory/health/research_plate/coagulator/on_removed(mob/living/carbon/human/user, obj/item/clothing/C) . = ..() - if (user.chem_effect_flags & CHEM_EFFECT_NO_BLEEDING) - user.chem_effect_flags &= CHEM_EFFECT_NO_BLEEDING - to_chat(user, SPAN_NOTICE("You feel [src] peeling off from your skin.")) - attached_uni = null + to_chat(user, SPAN_NOTICE("You feel [src] peeling off from your skin.")) + UnregisterSignal(user, COMSIG_BLEEDING_PROCESS) + attached_uni = null /obj/item/clothing/accessory/health/research_plate/coagulator/on_removed_sig(mob/living/carbon/human/user, slot) . = ..() if(. == FALSE) return - if(user.chem_effect_flags & CHEM_EFFECT_NO_BLEEDING) - to_chat(user, SPAN_NOTICE("You feel [src] peeling off from your skin.")) - user.chem_effect_flags &= CHEM_EFFECT_NO_BLEEDING - attached_uni = null + UnregisterSignal(user, COMSIG_BLEEDING_PROCESS) + attached_uni = null /obj/item/clothing/accessory/health/research_plate/emergency_injector name = "emergency chemical plate" @@ -350,7 +349,7 @@ /obj/item/clothing/accessory/health/research_plate/emergency_injector/on_attached(obj/item/clothing/S, mob/living/carbon/human/user) . = ..() wearer = user - activation = new /datum/action/item_action/emergency_plate/inject_chemicals(src, attached_uni) + activation = new /datum/action/item_action/toggle/emergency_plate/inject_chemicals(src, attached_uni) activation.give_to(wearer) /obj/item/clothing/accessory/health/research_plate/emergency_injector/on_removed(mob/living/user, obj/item/clothing/C) @@ -366,7 +365,7 @@ attached_uni = null //Action buttons -/datum/action/item_action/emergency_plate/inject_chemicals/New(Target, obj/item/holder) +/datum/action/item_action/toggle/emergency_plate/inject_chemicals/New(Target, obj/item/holder) . = ..() name = "Inject Emergency Plate" action_icon_state = "plate_research"