From 0363324110dd3f2ad33bc0afa9c90f6044c8102c Mon Sep 17 00:00:00 2001 From: Elizabeth Lavenza Date: Thu, 28 Mar 2024 07:41:00 -0400 Subject: [PATCH] Fix mobs harddeling due to species actions --- code/datums/dna.dm | 4 ++++ code/modules/mob/living/carbon/human/species.dm | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/code/datums/dna.dm b/code/datums/dna.dm index a1754ef4d1..73e6f0cd60 100644 --- a/code/datums/dna.dm +++ b/code/datums/dna.dm @@ -27,12 +27,16 @@ /datum/dna/Destroy() if(iscarbon(holder)) var/mob/living/carbon/cholder = holder + // We do this because a lot of stuff keeps references on species, for some reason. + species.on_species_loss(holder) if(cholder.dna == src) cholder.dna = null holder = null if(delete_species) QDEL_NULL(species) + else + species = null mutations.Cut() //This only references mutations, just dereference. temporary_mutations.Cut() //^ diff --git a/code/modules/mob/living/carbon/human/species.dm b/code/modules/mob/living/carbon/human/species.dm index 3677efb2cf..1e18a73286 100644 --- a/code/modules/mob/living/carbon/human/species.dm +++ b/code/modules/mob/living/carbon/human/species.dm @@ -567,7 +567,7 @@ GLOBAL_LIST_EMPTY(roundstart_race_names) /datum/species/proc/on_species_loss(mob/living/carbon/human/C, datum/species/new_species, pref_load) if(C.dna.species.exotic_bloodtype) - if(!new_species.exotic_bloodtype) + if(!new_species?.exotic_bloodtype) C.dna.blood_type = random_blood_type() else C.dna.blood_type = new_species.exotic_bloodtype @@ -587,7 +587,7 @@ GLOBAL_LIST_EMPTY(roundstart_race_names) C.type_of_meat = initial(meat) //If their inert mutation is not the same, swap it out - if((inert_mutation != new_species.inert_mutation) && LAZYLEN(C.dna.mutation_index) && (inert_mutation in C.dna.mutation_index)) + if(new_species && (inert_mutation != new_species.inert_mutation) && LAZYLEN(C.dna.mutation_index) && (inert_mutation in C.dna.mutation_index)) C.dna.remove_mutation(inert_mutation) //keep it at the right spot, so we can't have people taking shortcuts var/location = C.dna.mutation_index.Find(inert_mutation) @@ -596,7 +596,7 @@ GLOBAL_LIST_EMPTY(roundstart_race_names) C.dna.mutation_index[new_species.inert_mutation] = create_sequence(new_species.inert_mutation) C.dna.default_mutation_genes[new_species.inert_mutation] = C.dna.mutation_index[new_species.inert_mutation] - if(!new_species.has_field_of_vision && has_field_of_vision && ishuman(C) && CONFIG_GET(flag/use_field_of_vision)) + if(new_species && !new_species.has_field_of_vision && has_field_of_vision && ishuman(C) && CONFIG_GET(flag/use_field_of_vision)) var/datum/component/field_of_vision/F = C.GetComponent(/datum/component/field_of_vision) if(F) qdel(F) @@ -1961,7 +1961,7 @@ GLOBAL_LIST_EMPTY(roundstart_race_names) target.adjustStaminaLoss(25) user.visible_message( span_notice("\The [user] slaps [target]'s butt!"), - target = target, + target = target, target_message = span_lewd("[user] smacks your big fat butt and sends it [pick("rippling","jiggling","sloshing","clapping","wobbling")]! It [pick("ripples","jiggles","sloshes","claps","wobbles")] about and throws you off balance!")) return FALSE //SPLURT ADDITION END