From 412ec61234f69a7ca31f08a64826fa1bc20f0554 Mon Sep 17 00:00:00 2001 From: Kapu1178 <75460809+Kapu1178@users.noreply.github.com> Date: Fri, 24 May 2024 01:46:10 -0400 Subject: [PATCH] mutation bug (#958) --- code/datums/dna.dm | 2 +- code/datums/mutations/_mutations.dm | 14 ++++++++------ code/datums/mutations/body.dm | 3 +-- code/datums/mutations/hulk.dm | 1 + 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/code/datums/dna.dm b/code/datums/dna.dm index a3e0dd125b56..b17b7954cbbf 100644 --- a/code/datums/dna.dm +++ b/code/datums/dna.dm @@ -420,7 +420,7 @@ GLOBAL_LIST_INIT(total_uf_len_by_block, populate_total_uf_len_by_block()) /datum/dna/proc/force_lose(datum/mutation/human/HM) if(holder && (HM in mutations)) set_se(0, HM) - . = HM.on_losing(holder) + . = HM.remove_from_owner() update_instability(FALSE) return diff --git a/code/datums/mutations/_mutations.dm b/code/datums/mutations/_mutations.dm index 4f10b67a1d41..a27c95fbb7e5 100644 --- a/code/datums/mutations/_mutations.dm +++ b/code/datums/mutations/_mutations.dm @@ -124,12 +124,19 @@ /datum/mutation/human/proc/on_life(delta_time, times_fired) return -/datum/mutation/human/proc/on_losing(mob/living/carbon/human/owner) +/datum/mutation/human/proc/remove_from_owner() + . = on_losing(owner) + qdel(src) + +/datum/mutation/human/proc/on_losing() if(!istype(owner) || !(owner.dna.mutations.Remove(src))) return TRUE + . = FALSE + if(text_lose_indication && owner.stat != DEAD) to_chat(owner, text_lose_indication) + if(visual_indicators.len) var/list/mut_overlay = list() if(owner.overlays_standing[layer_used]) @@ -138,11 +145,6 @@ mut_overlay.Remove(get_visual_indicator()) owner.overlays_standing[layer_used] = mut_overlay owner.apply_overlay(layer_used) - if(power_path) - // Any powers we made are linked to our mutation datum, - // so deleting ourself will also delete it and remove it - // ...Why don't all mutations delete on loss? Not sure. - qdel(src) /mob/living/carbon/proc/update_mutations_overlay() return diff --git a/code/datums/mutations/body.dm b/code/datums/mutations/body.dm index c77fd9048349..e8bc1d3a3291 100644 --- a/code/datums/mutations/body.dm +++ b/code/datums/mutations/body.dm @@ -48,8 +48,7 @@ if(new_mob && ismob(new_mob)) owner = new_mob . = owner - on_losing(owner) - + remove_from_owner() //Cough gives you a chronic cough that causes you to drop items. /datum/mutation/human/cough diff --git a/code/datums/mutations/hulk.dm b/code/datums/mutations/hulk.dm index 223982a8d841..85829da1fec8 100644 --- a/code/datums/mutations/hulk.dm +++ b/code/datums/mutations/hulk.dm @@ -69,6 +69,7 @@ if(owner.health < owner.crit_threshold) on_losing(owner) to_chat(owner, span_danger("You suddenly feel very weak.")) + remove_from_owner() /datum/mutation/human/hulk/on_losing(mob/living/carbon/human/owner) if(..())