From 43ec902cd1242bfe1044fd25be418365da128a60 Mon Sep 17 00:00:00 2001
From: tralezab <40974010+tralezab@users.noreply.github.com>
Date: Fri, 6 Mar 2020 14:39:50 -0800
Subject: [PATCH] fixes unremovable mutations, fixes weird tail organ
shennanigans (#49771)
* THE mutations fix
* removes !owner
* removes redundant code (yay)
---
code/datums/mutations/_mutations.dm | 2 +-
code/datums/mutations/body.dm | 2 +-
.../mob/living/carbon/human/species.dm | 10 +++---
.../carbon/human/species_types/felinid.dm | 31 -------------------
4 files changed, 8 insertions(+), 37 deletions(-)
diff --git a/code/datums/mutations/_mutations.dm b/code/datums/mutations/_mutations.dm
index 144683e8303..58c882ded0a 100644
--- a/code/datums/mutations/_mutations.dm
+++ b/code/datums/mutations/_mutations.dm
@@ -93,7 +93,7 @@
return
/datum/mutation/human/proc/on_losing(mob/living/carbon/human/owner)
- if(owner && istype(owner) && (owner.dna.mutations.Remove(src)))
+ if(!istype(owner) || !(owner.dna.mutations.Remove(src)))
return TRUE
. = FALSE
if(text_lose_indication && owner.stat != DEAD)
diff --git a/code/datums/mutations/body.dm b/code/datums/mutations/body.dm
index 2346edaf847..a38bb2c6432 100644
--- a/code/datums/mutations/body.dm
+++ b/code/datums/mutations/body.dm
@@ -473,11 +473,11 @@
. = ..()
if(.)
return TRUE
+ UnregisterSignal(owner, COMSIG_LIVING_ATTACH_LIMB)
var/successful = owner.regenerate_limb(BODY_ZONE_HEAD, noheal = TRUE) //noheal needs to be TRUE to prevent weird adding and removing mutation healing
if(!successful)
stack_trace("HARS mutation head regeneration failed! (usually caused by headless syndrome having a head)")
return TRUE
- UnregisterSignal(owner, COMSIG_LIVING_ATTACH_LIMB)
owner.dna.species.regenerate_organs(owner, excluded_zones = list(BODY_ZONE_CHEST)) //only regenerate head
owner.apply_damage(damage = 50, damagetype = BRUTE, def_zone = BODY_ZONE_HEAD) //and this to DISCOURAGE organ farming, or at least not make it free.
owner.visible_message("[owner]'s head returns with a sickening crunch!", "Your head regrows with a sickening crack! Ouch.")
diff --git a/code/modules/mob/living/carbon/human/species.dm b/code/modules/mob/living/carbon/human/species.dm
index 7ba92ffced3..6588cd13cb6 100644
--- a/code/modules/mob/living/carbon/human/species.dm
+++ b/code/modules/mob/living/carbon/human/species.dm
@@ -189,7 +189,7 @@ GLOBAL_LIST_EMPTY(roundstart_races)
if(!oldorgan && should_have && !(initial(neworgan.zone) in excluded_zones))
used_neworgan = TRUE
- neworgan.Insert(C)
+ neworgan.Insert(C, TRUE, FALSE)
if(!used_neworgan)
qdel(neworgan)
@@ -201,9 +201,11 @@ GLOBAL_LIST_EMPTY(roundstart_races)
I.Remove(C)
QDEL_NULL(I)
- for(var/path in mutant_organs)
- var/obj/item/organ/I = new path()
- I.Insert(C)
+ for(var/thing in mutant_organs)
+ var/current_organ = C.getorgan(thing)
+ if(!current_organ || replace_current)
+ var/obj/item/organ/missed = new thing()
+ missed.Insert(C, TRUE, FALSE)
/datum/species/proc/on_species_gain(mob/living/carbon/C, datum/species/old_species, pref_load)
// Drop the items the new species can't wear
diff --git a/code/modules/mob/living/carbon/human/species_types/felinid.dm b/code/modules/mob/living/carbon/human/species_types/felinid.dm
index 0b646fab85d..87d31abb57c 100644
--- a/code/modules/mob/living/carbon/human/species_types/felinid.dm
+++ b/code/modules/mob/living/carbon/human/species_types/felinid.dm
@@ -64,37 +64,6 @@
mutant_organs = list()
return ..()
-/datum/species/human/felinid/on_species_loss(mob/living/carbon/H, datum/species/new_species, pref_load)
- var/obj/item/organ/ears/cat/ears = H.getorgan(/obj/item/organ/ears/cat)
-// var/obj/item/organ/tail/cat/tail = H.getorgan(/obj/item/organ/tail/cat)
-
- if(ears)
- var/obj/item/organ/ears/NE
- if(new_species && new_species.mutantears)
- // Roundstart cat ears override new_species.mutantears, reset it here.
- new_species.mutantears = initial(new_species.mutantears)
- if(new_species.mutantears)
- NE = new new_species.mutantears
- if(!NE)
- // Go with default ears
- NE = new /obj/item/organ/ears
- NE.Insert(H, drop_if_replaced = FALSE)
-
-/*
- if(tail)
- var/obj/item/organ/tail/NT
- NT = locate(/obj/item/organ/tail) in new_species.mutant_organs
- if(NT)
- // Roundstart cat tail overrides new_species tail, reset it here.
- new_species.mutanttail = initial(new_species.mutanttail)
- if(new_species.mutanttail)
- NT = new new_species.mutanttail
- if(NT)
- NT.Insert(H, drop_if_replaced = FALSE)
- else
- tail.Remove(H)
-*/
-
/proc/mass_purrbation()
for(var/M in GLOB.mob_list)
if(ishuman(M))