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

Injector and Coagulator plates now function #7173

Merged
merged 1 commit into from
Sep 23, 2024
Merged
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
4 changes: 4 additions & 0 deletions code/__DEFINES/dcs/signals/atom/signals_obj.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 4 additions & 0 deletions code/datums/effects/bleeding.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down
25 changes: 12 additions & 13 deletions code/modules/cm_tech/implements/armor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand All @@ -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"
Expand Down
Loading