Fix mobs harddeling due to species actions

This commit is contained in:
Elizabeth Lavenza
2024-03-28 18:14:49 -04:00
parent 95f87dbc38
commit 0363324110
2 changed files with 8 additions and 4 deletions
+4
View File
@@ -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() //^
@@ -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