From f24d8a532dced7381d20a1a541f26e24b4f2eac0 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Sat, 23 Oct 2021 01:46:43 +0200 Subject: [PATCH] [MIRROR] Small implant code cleanup. [MDB IGNORE] (#8971) * Small implant code cleanup. (#62226) Co-authored-by: Mothblocks <35135081+Mothblocks@ users.noreply.github.com> * Small implant code cleanup. * Update mortis.dm Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com> Co-authored-by: Mothblocks <35135081+Mothblocks@ users.noreply.github.com> Co-authored-by: Gandalf --- code/datums/emotes.dm | 5 ----- code/game/objects/items/implants/implant.dm | 6 +----- .../objects/items/implants/implant_chem.dm | 18 +++++++++++++----- .../objects/items/implants/implant_clown.dm | 16 +++++++++++++--- .../items/implants/implant_explosive.dm | 5 +++++ .../objects/items/implants/implant_misc.dm | 19 ------------------- .../game/objects/items/implants/mortis.dm | 16 +++++++++++++--- 7 files changed, 45 insertions(+), 40 deletions(-) diff --git a/code/datums/emotes.dm b/code/datums/emotes.dm index c2617f15b23..da7a009b65d 100644 --- a/code/datums/emotes.dm +++ b/code/datums/emotes.dm @@ -101,11 +101,6 @@ msg = replace_pronoun(user, msg) - if(isliving(user)) - var/mob/living/sender = user - for(var/obj/item/implant/implant in sender.implants) - implant.trigger(key, sender) - if(!msg) return diff --git a/code/game/objects/items/implants/implant.dm b/code/game/objects/items/implants/implant.dm index 843800e0a8b..1c50132b1eb 100644 --- a/code/game/objects/items/implants/implant.dm +++ b/code/game/objects/items/implants/implant.dm @@ -18,10 +18,6 @@ var/uses = -1 item_flags = DROPDEL - -/obj/item/implant/proc/trigger(emote, mob/living/carbon/source) - return - /obj/item/implant/proc/activate() SEND_SIGNAL(src, COMSIG_IMPLANT_ACTIVATED) @@ -119,7 +115,7 @@ source.implants -= src for(var/X in actions) var/datum/action/implant_action = X - implant_action.Grant(source) + implant_action.Remove(source) if(ishuman(source)) var/mob/living/carbon/human/human_source = source human_source.sec_hud_set_implants() diff --git a/code/game/objects/items/implants/implant_chem.dm b/code/game/objects/items/implants/implant_chem.dm index 62214b6a6d9..bbb1e72027f 100644 --- a/code/game/objects/items/implants/implant_chem.dm +++ b/code/game/objects/items/implants/implant_chem.dm @@ -29,11 +29,19 @@ GLOB.tracked_chem_implants -= src return ..() -/obj/item/implant/chem/trigger(emote, mob/living/source) - if(emote == "deathgasp") - if(istype(source) && !(source.stat == DEAD)) - return - activate(reagents.total_volume) +/obj/item/implant/chem/implant(mob/living/target, mob/user, silent = FALSE, force = FALSE) + . = ..() + if(.) + RegisterSignal(target, COMSIG_LIVING_DEATH, .proc/on_death) + +/obj/item/implant/chem/removed(mob/target, silent = FALSE, special = FALSE) + . = ..() + if(.) + UnregisterSignal(target, COMSIG_LIVING_DEATH) + +/obj/item/implant/chem/proc/on_death(mob/living/source) + SIGNAL_HANDLER + activate(reagents.total_volume) /obj/item/implant/chem/activate(cause) . = ..() diff --git a/code/game/objects/items/implants/implant_clown.dm b/code/game/objects/items/implants/implant_clown.dm index 37dc27e21d6..001e6a35075 100644 --- a/code/game/objects/items/implants/implant_clown.dm +++ b/code/game/objects/items/implants/implant_clown.dm @@ -10,9 +10,19 @@ "} return dat -/obj/item/implant/sad_trombone/trigger(emote, mob/source) - if(emote == "deathgasp") - playsound(loc, 'sound/misc/sadtrombone.ogg', 50, FALSE) +/obj/item/implant/sad_trombone/implant(mob/living/target, mob/user, silent = FALSE, force = FALSE) + . = ..() + if(.) + RegisterSignal(target, COMSIG_MOB_EMOTED("deathgasp"), .proc/on_deathgasp) + +/obj/item/implant/sad_trombone/removed(mob/target, silent = FALSE, special = FALSE) + . = ..() + if(.) + UnregisterSignal(target, COMSIG_MOB_EMOTED("deathgasp")) + +/obj/item/implant/sad_trombone/proc/on_deathgasp(mob/source) + SIGNAL_HANDLER + playsound(loc, 'sound/misc/sadtrombone.ogg', 50, FALSE) ///Implanter that spawns with a sad trombone implant, as well as an appropriate name /obj/item/implanter/sad_trombone diff --git a/code/game/objects/items/implants/implant_explosive.dm b/code/game/objects/items/implants/implant_explosive.dm index 6e227fd8a30..d52c416faac 100644 --- a/code/game/objects/items/implants/implant_explosive.dm +++ b/code/game/objects/items/implants/implant_explosive.dm @@ -73,6 +73,11 @@ if(.) RegisterSignal(target, COMSIG_LIVING_DEATH, .proc/on_death) +/obj/item/implant/explosive/removed(mob/target, silent = FALSE, special = FALSE) + . = ..() + if(.) + UnregisterSignal(target, COMSIG_LIVING_DEATH) + /obj/item/implant/explosive/proc/timed_explosion() imp_in.visible_message(span_warning("[imp_in] starts beeping ominously!")) playsound(loc, 'sound/items/timer.ogg', 30, FALSE) diff --git a/code/game/objects/items/implants/implant_misc.dm b/code/game/objects/items/implants/implant_misc.dm index 53ec15646bd..f8119b296b9 100644 --- a/code/game/objects/items/implants/implant_misc.dm +++ b/code/game/objects/items/implants/implant_misc.dm @@ -31,25 +31,6 @@ special_desc_requirement = EXAMINE_CHECK_SYNDICATE // Skyrat edit special_desc = "A Syndicate implanter used for a EMP implant" // Skyrat edit - -//Health Tracker Implant - -/obj/item/implant/health - name = "health implant" - activated = FALSE - var/healthstring = "" - -/obj/item/implant/health/proc/sensehealth() - if (!imp_in) - return "ERROR" - else - if(isliving(imp_in)) - var/mob/living/L = imp_in - healthstring = "Oxygen Deprivation Damage => [round(L.getOxyLoss())]
Fire Damage => [round(L.getFireLoss())]
Toxin Damage => [round(L.getToxLoss())]
Brute Force Damage => [round(L.getBruteLoss())]
" - if (!healthstring) - healthstring = "ERROR" - return healthstring - /obj/item/implant/radio name = "internal radio implant" activated = TRUE diff --git a/modular_skyrat/modules/chaplain/code/game/objects/items/implants/mortis.dm b/modular_skyrat/modules/chaplain/code/game/objects/items/implants/mortis.dm index 8eca27a9eac..d2e0e5ebf27 100644 --- a/modular_skyrat/modules/chaplain/code/game/objects/items/implants/mortis.dm +++ b/modular_skyrat/modules/chaplain/code/game/objects/items/implants/mortis.dm @@ -9,9 +9,19 @@ "} return dat -/obj/item/implant/mortis/trigger(emote, mob/source) - if(emote == "deathgasp") - playsound(source.loc, 'modular_skyrat/modules/chaplain/sound/misc/mortis.ogg', 50, 0) +/obj/item/implant/mortis/implant(mob/living/target, mob/user, silent = FALSE, force = FALSE) + . = ..() + if(.) + RegisterSignal(target, COMSIG_MOB_EMOTED("deathgasp"), .proc/on_deathgasp) + +/obj/item/implant/mortis/removed(mob/target, silent = FALSE, special = FALSE) + . = ..() + if(.) + UnregisterSignal(target, COMSIG_MOB_EMOTED("deathgasp")) + +/obj/item/implant/mortis/proc/on_deathgasp(mob/source) + SIGNAL_HANDLER + playsound(source.loc, 'modular_skyrat/modules/chaplain/sound/misc/mortis.ogg', 50, 0) /obj/item/implanter/mortis name = "implanter (MORTIS)"