From ad63f7ae2a9d8d039a90c8f4867dbc6bde7af655 Mon Sep 17 00:00:00 2001 From: MrMelbert <51863163+MrMelbert@users.noreply.github.com> Date: Sun, 15 Oct 2023 07:52:02 -0500 Subject: [PATCH] Gets some of the easy-bad species procs (#78993) ## About The Pull Request - Kills `spec_death`, everything that used it is now signalized. - Kills `spec_hitby`, nothing used it. Anything that did hypothetically can use the signal. - [x] I tested this PR ## Why It's Good For The Game These are all bad and using signals is superior. ## Changelog :cl: Melbert code: Removed species death and species hitby, replaced any uses with signals. /:cl: --- .../mob/living/carbon/human/_species.dm | 7 ----- code/modules/mob/living/carbon/human/death.dm | 3 -- .../mob/living/carbon/human/human_defense.dm | 4 --- .../carbon/human/species_types/jellypeople.dm | 28 +++++++++++-------- .../carbon/human/species_types/zombies.dm | 28 ++++++------------- code/modules/zombie/organs.dm | 16 +++++++++-- 6 files changed, 39 insertions(+), 47 deletions(-) diff --git a/code/modules/mob/living/carbon/human/_species.dm b/code/modules/mob/living/carbon/human/_species.dm index 5cf1a02a9aa..12e2bd7a053 100644 --- a/code/modules/mob/living/carbon/human/_species.dm +++ b/code/modules/mob/living/carbon/human/_species.dm @@ -874,9 +874,6 @@ GLOBAL_LIST_EMPTY(features_by_species) if(HAS_TRAIT(H, TRAIT_NOBREATH) && (H.health < H.crit_threshold) && !HAS_TRAIT(H, TRAIT_NOCRITDAMAGE)) H.adjustBruteLoss(0.5 * seconds_per_tick) -/datum/species/proc/spec_death(gibbed, mob/living/carbon/human/H) - return - /datum/species/proc/can_equip(obj/item/I, slot, disable_warning, mob/living/carbon/human/H, bypass_equip_delay_self = FALSE, ignore_equipped = FALSE, indirect_action = FALSE) if(no_equip_flags & slot) if(!I.species_exception || !is_type_in_list(src, I.species_exception)) @@ -1247,10 +1244,6 @@ GLOBAL_LIST_EMPTY(features_by_species) return FALSE user.disarm(target) - -/datum/species/proc/spec_hitby(atom/movable/AM, mob/living/carbon/human/H) - return - /datum/species/proc/spec_attack_hand(mob/living/carbon/human/owner, mob/living/carbon/human/target, datum/martial_art/attacker_style, modifiers) if(!istype(owner)) return diff --git a/code/modules/mob/living/carbon/human/death.dm b/code/modules/mob/living/carbon/human/death.dm index b451d86935b..f8cee3b4851 100644 --- a/code/modules/mob/living/carbon/human/death.dm +++ b/code/modules/mob/living/carbon/human/death.dm @@ -30,9 +30,6 @@ GLOBAL_LIST_EMPTY(dead_players_during_shift) if(client && !HAS_TRAIT(src, TRAIT_SUICIDED) && !(client in GLOB.dead_players_during_shift)) GLOB.dead_players_during_shift += client - if(!QDELETED(dna)) //The gibbed param is bit redundant here since dna won't exist at this point if they got deleted. - dna.species.spec_death(gibbed, src) - if(SSticker.HasRoundStarted()) SSblackbox.ReportDeath(src) log_message("has died (BRUTE: [src.getBruteLoss()], BURN: [src.getFireLoss()], TOX: [src.getToxLoss()], OXY: [src.getOxyLoss()], CLONE: [src.getCloneLoss()])", LOG_ATTACK) diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index fafc9b49a69..6a2bc8dc33d 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -148,10 +148,6 @@ return FALSE /mob/living/carbon/human/hitby(atom/movable/AM, skipcatch = FALSE, hitpush = TRUE, blocked = FALSE, datum/thrownthing/throwingdatum) - if(dna?.species) - var/spec_return = dna.species.spec_hitby(AM, src) - if(spec_return) - return spec_return var/obj/item/I var/damage_type = BRUTE var/throwpower = 30 diff --git a/code/modules/mob/living/carbon/human/species_types/jellypeople.dm b/code/modules/mob/living/carbon/human/species_types/jellypeople.dm index bd662d63ad1..cf581ac97ee 100644 --- a/code/modules/mob/living/carbon/human/species_types/jellypeople.dm +++ b/code/modules/mob/living/carbon/human/species_types/jellypeople.dm @@ -206,6 +206,7 @@ // so if someone mindswapped into them, they'd still be shared. bodies = null C.blood_volume = min(C.blood_volume, BLOOD_VOLUME_NORMAL) + UnregisterSignal(C, COMSIG_LIVING_DEATH) ..() /datum/species/jelly/slime/on_species_gain(mob/living/carbon/C, datum/species/old_species) @@ -221,20 +222,25 @@ else bodies |= C -/datum/species/jelly/slime/spec_death(gibbed, mob/living/carbon/human/H) - if(slime_split) - if(!H.mind || !H.mind.active) - return + RegisterSignal(C, COMSIG_LIVING_DEATH, PROC_REF(on_death_move_body)) - var/list/available_bodies = (bodies - H) - for(var/mob/living/L in available_bodies) - if(!swap_body.can_swap(L)) - available_bodies -= L +/datum/species/jelly/slime/proc/on_death_move_body(mob/living/carbon/human/source, gibbed) + SIGNAL_HANDLER - if(!LAZYLEN(available_bodies)) - return + if(!slime_split) + return + if(!source.mind?.active) + return - swap_body.swap_to_dupe(H.mind, pick(available_bodies)) + var/list/available_bodies = bodies - source + for(var/mob/living/other_body as anything in available_bodies) + if(!swap_body.can_swap(other_body)) + available_bodies -= other_body + + if(!length(available_bodies)) + return + + swap_body.swap_to_dupe(source.mind, pick(available_bodies)) //If you're cloned you get your body pool back /datum/species/jelly/slime/copy_properties_from(datum/species/jelly/slime/old_species) diff --git a/code/modules/mob/living/carbon/human/species_types/zombies.dm b/code/modules/mob/living/carbon/human/species_types/zombies.dm index d07badff51e..a9f7401247b 100644 --- a/code/modules/mob/living/carbon/human/species_types/zombies.dm +++ b/code/modules/mob/living/carbon/human/species_types/zombies.dm @@ -140,6 +140,14 @@ /datum/species/zombie/infectious/on_species_gain(mob/living/carbon/human/new_zombie, datum/species/old_species) . = ..() + // Deal with the source of this zombie corruption + // Infection organ needs to be handled separately from mutant_organs + // because it persists through species transitions + var/obj/item/organ/internal/zombie_infection/infection = new_zombie.get_organ_slot(ORGAN_SLOT_ZOMBIE) + if(isnull(infection)) + infection = new() + infection.Insert(new_zombie) + new_zombie.AddComponent(/datum/component/mutant_hands, mutant_hand_path = /obj/item/mutant_hand/zombie) /datum/species/zombie/infectious/on_species_loss(mob/living/carbon/human/was_zombie, datum/species/new_species, pref_load) @@ -179,26 +187,6 @@ if(!HAS_TRAIT(carbon_mob, TRAIT_CRITICAL_CONDITION) && SPT_PROB(2, seconds_per_tick)) playsound(carbon_mob, pick(spooks), 50, TRUE, 10) -//Congrats you somehow died so hard you stopped being a zombie -/datum/species/zombie/infectious/spec_death(gibbed, mob/living/carbon/C) - . = ..() - var/obj/item/organ/internal/zombie_infection/infection - infection = C.get_organ_slot(ORGAN_SLOT_ZOMBIE) - if(infection) - qdel(infection) - -/datum/species/zombie/infectious/on_species_gain(mob/living/carbon/C, datum/species/old_species) - . = ..() - - // Deal with the source of this zombie corruption - // Infection organ needs to be handled separately from mutant_organs - // because it persists through species transitions - var/obj/item/organ/internal/zombie_infection/infection - infection = C.get_organ_slot(ORGAN_SLOT_ZOMBIE) - if(!infection) - infection = new() - infection.Insert(C) - // Your skin falls off /datum/species/human/krokodil_addict name = "\improper Krokodil Human" diff --git a/code/modules/zombie/organs.dm b/code/modules/zombie/organs.dm index 3530146f1a2..43a6130c773 100644 --- a/code/modules/zombie/organs.dm +++ b/code/modules/zombie/organs.dm @@ -37,10 +37,22 @@ if(timer_id) deltimer(timer_id) +/obj/item/organ/internal/zombie_infection/on_insert(mob/living/carbon/organ_owner, special) + . = ..() + RegisterSignal(organ_owner, COMSIG_LIVING_DEATH, PROC_REF(organ_owner_died)) + +/obj/item/organ/internal/zombie_infection/on_remove(mob/living/carbon/organ_owner, special) + . = ..() + UnregisterSignal(organ_owner, COMSIG_LIVING_DEATH) + +/obj/item/organ/internal/zombie_infection/proc/organ_owner_died(mob/living/carbon/source, gibbed) + SIGNAL_HANDLER + qdel(src) // Congrats you somehow died so hard you stopped being a zombie + /obj/item/organ/internal/zombie_infection/on_find(mob/living/finder) - to_chat(finder, "Inside the head is a disgusting black \ + to_chat(finder, span_warning("Inside the head is a disgusting black \ web of pus and viscera, bound tightly around the brain like some \ - biological harness.") + biological harness.")) /obj/item/organ/internal/zombie_infection/process(seconds_per_tick, times_fired) if(!owner)