mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-13 09:05:11 +01:00
[MIRROR] Resolves mutant species keeping old organs they shouldn't have [MDB IGNORE] (#19958)
* Resolves mutant species keeping old organs they shouldn't have (#73728) ## About The Pull Request regenerate organs never removed invalid organs when regenerating ## Why It's Good For The Game Fixes https://github.com/tgstation/tgstation/issues/73640 adds a unit test to prevent regressions in the future ## Changelog 🆑 fix: Plasmamen don't have hearts, again /🆑 * Resolves mutant species keeping old organs they shouldn't have * https://github.com/tgstation/tgstation/pull/68168 * Now everything should pass, yes, even appendixes for synths --------- Co-authored-by: Zephyr <12817816+ZephyrTFA@users.noreply.github.com> Co-authored-by: GoldenAlpharex <jerego1234@hotmail.com> Co-authored-by: Coffee <CoffeeDragon16@gmail.com>
This commit is contained in:
@@ -172,9 +172,9 @@ GLOBAL_LIST_EMPTY(features_by_species)
|
||||
///What anim to use for gibbing
|
||||
var/gib_anim = "gibbed-h"
|
||||
|
||||
|
||||
//Do NOT remove by setting to null. use OR make an ASSOCIATED TRAIT.
|
||||
//why does it work this way? because traits also disable the downsides of not having an organ, removing organs but not having the trait will make your species die
|
||||
// Prefer anything other than setting these to null, such as TRAITS
|
||||
// why?
|
||||
// because traits also disable the downsides of not having an organ, removing organs but not having the trait or logic will make your species die
|
||||
|
||||
///Replaces default brain with a different organ
|
||||
var/obj/item/organ/internal/brain/mutantbrain = /obj/item/organ/internal/brain
|
||||
@@ -350,6 +350,9 @@ GLOBAL_LIST_EMPTY(features_by_species)
|
||||
var/obj/item/organ/oldorgan = C.getorganslot(slot) //used in removing
|
||||
var/obj/item/organ/neworgan = slot_mutantorgans[slot] //used in adding
|
||||
if(!neworgan) //these can be null, if so we shouldn't regenerate
|
||||
if(oldorgan) // although we also need to remove the old organ if it exists
|
||||
oldorgan.Remove(C, special=TRUE)
|
||||
qdel(oldorgan)
|
||||
continue
|
||||
|
||||
if(visual_only && !initial(neworgan.visual))
|
||||
@@ -367,7 +370,7 @@ GLOBAL_LIST_EMPTY(features_by_species)
|
||||
* - The replaced organ is not in an excluded zone
|
||||
* - The replaced organ is not unremovable or synthetic (an implant)
|
||||
*/
|
||||
if(oldorgan && (!should_have || replace_current) && !(oldorgan.zone in excluded_zones) && !(oldorgan.organ_flags & (ORGAN_UNREMOVABLE|ORGAN_SYNTHETIC)))
|
||||
if(oldorgan && (!should_have || replace_current) && !(oldorgan.zone in excluded_zones) && (!(oldorgan.organ_flags & (ORGAN_UNREMOVABLE|ORGAN_SYNTHETIC)) || (oldorgan.organ_flags & ORGAN_SYNTHETIC_FROM_SPECIES))) // SKYRAT EDIT - Customization - ORIGINAL: if(oldorgan && (!should_have || replace_current) && !(oldorgan.zone in excluded_zones) && !(oldorgan.organ_flags & (ORGAN_UNREMOVABLE|ORGAN_SYNTHETIC)))
|
||||
if(slot == ORGAN_SLOT_BRAIN)
|
||||
var/obj/item/organ/internal/brain/brain = oldorgan
|
||||
if(!brain.decoy_override)//"Just keep it if it's fake" - confucius, probably
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
mutantlungs = null
|
||||
inherent_biotypes = MOB_HUMANOID|MOB_MINERAL
|
||||
mutant_organs = list(/obj/item/organ/internal/adamantine_resonator)
|
||||
mutanttongue = /obj/item/organ/internal/vocal_cords/adamantine
|
||||
speedmod = 2
|
||||
payday_modifier = 0.75
|
||||
armor = 55
|
||||
@@ -88,8 +87,7 @@
|
||||
name = "Adamantine Golem"
|
||||
id = SPECIES_GOLEM_ADAMANTINE
|
||||
meat = /obj/item/food/meat/slab/human/mutant/golem/adamantine
|
||||
mutant_organs = list(/obj/item/organ/internal/adamantine_resonator)
|
||||
mutanttongue = /obj/item/organ/internal/vocal_cords/adamantine
|
||||
mutant_organs = list(/obj/item/organ/internal/adamantine_resonator, /obj/item/organ/internal/vocal_cords/adamantine)
|
||||
fixed_mut_color = "#44eedd"
|
||||
info_text = "As an <span class='danger'>Adamantine Golem</span>, you possess special vocal cords allowing you to \"resonate\" messages to all golems. Your unique mineral makeup makes you immune to most types of magic."
|
||||
prefix = "Adamantine"
|
||||
|
||||
@@ -168,7 +168,7 @@
|
||||
//Build the mob sprite and use it as our overlay
|
||||
for(var/external_layer in bodypart_overlay.all_layers)
|
||||
if(bodypart_overlay.layers & external_layer)
|
||||
. += bodypart_overlay.get_overlay(external_layer, limb = null)
|
||||
. += bodypart_overlay.get_overlay(external_layer, ownerlimb)
|
||||
|
||||
///The horns of a lizard!
|
||||
/obj/item/organ/external/horns
|
||||
@@ -366,8 +366,11 @@
|
||||
if(draw_layer != bitflag_to_layer(color_swapped_layer))
|
||||
return ..()
|
||||
|
||||
var/list/rgb_list = rgb2num(draw_color)
|
||||
overlay.color = rgb(color_inverse_base - rgb_list[1], color_inverse_base - rgb_list[2], color_inverse_base - rgb_list[3]) //inversa da color
|
||||
if(draw_color) // can someone explain to me why draw_color is allowed to EVER BE AN EMPTY STRING
|
||||
var/list/rgb_list = rgb2num(draw_color)
|
||||
overlay.color = rgb(color_inverse_base - rgb_list[1], color_inverse_base - rgb_list[2], color_inverse_base - rgb_list[3]) //inversa da color
|
||||
else
|
||||
overlay.color = null
|
||||
|
||||
/datum/bodypart_overlay/mutant/pod_hair/can_draw_on_bodypart(mob/living/carbon/human/human)
|
||||
if((human.head?.flags_inv & HIDEHAIR) || (human.wear_mask?.flags_inv & HIDEHAIR))
|
||||
|
||||
@@ -156,6 +156,7 @@
|
||||
#include "monkey_business.dm"
|
||||
#include "mouse_bite_cable.dm"
|
||||
#include "mutant_hands_consistency.dm"
|
||||
#include "mutant_organs.dm"
|
||||
#include "novaflower_burn.dm"
|
||||
#include "ntnetwork_tests.dm"
|
||||
#include "nuke_cinematic.dm"
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* Iterates over all species to ensure that organs are valid after being set to a mutant species
|
||||
*/
|
||||
/datum/unit_test/mutant_organs
|
||||
|
||||
/datum/unit_test/mutant_organs/Run()
|
||||
var/mob/living/carbon/human/consistent/dummy = allocate(/mob/living/carbon/human/consistent)
|
||||
var/list/ignore = list(
|
||||
/datum/species/dullahan,
|
||||
)
|
||||
var/list/species = subtypesof(/datum/species) - ignore
|
||||
var/static/list/organs_we_care_about = list(
|
||||
ORGAN_SLOT_BRAIN,
|
||||
ORGAN_SLOT_HEART,
|
||||
ORGAN_SLOT_LUNGS,
|
||||
ORGAN_SLOT_EYES,
|
||||
ORGAN_SLOT_EARS,
|
||||
ORGAN_SLOT_TONGUE,
|
||||
ORGAN_SLOT_LIVER,
|
||||
ORGAN_SLOT_STOMACH,
|
||||
ORGAN_SLOT_APPENDIX,
|
||||
)
|
||||
|
||||
for(var/datum/species/species_type as anything in species)
|
||||
// change them to the species
|
||||
dummy.set_species(species_type)
|
||||
|
||||
// check all their organs
|
||||
for(var/organ_slot in organs_we_care_about)
|
||||
var/expected_type = slot_to_species_organ_type(organ_slot, species_type)
|
||||
var/obj/item/organ/actual_organ = dummy.getorganslot(organ_slot)
|
||||
if(isnull(actual_organ))
|
||||
if(!isnull(expected_type))
|
||||
TEST_FAIL("[species_type] did not update their [organ_slot] organ to [expected_type], no organ was found")
|
||||
continue
|
||||
else
|
||||
if(isnull(expected_type))
|
||||
TEST_FAIL("[species_type] did not remove their [organ_slot] organ")
|
||||
continue
|
||||
|
||||
if(actual_organ.type != expected_type)
|
||||
TEST_FAIL("[species_type] did not update their [organ_slot] organ to [expected_type], instead it was [actual_organ.type]")
|
||||
continue
|
||||
|
||||
/datum/unit_test/mutant_organs/proc/slot_to_species_organ_type(slot, datum/species/species)
|
||||
switch(slot)
|
||||
if(ORGAN_SLOT_BRAIN)
|
||||
return initial(species.mutantbrain)
|
||||
if(ORGAN_SLOT_HEART)
|
||||
return initial(species.mutantheart)
|
||||
if(ORGAN_SLOT_LUNGS)
|
||||
return initial(species.mutantlungs)
|
||||
if(ORGAN_SLOT_EYES)
|
||||
return initial(species.mutanteyes)
|
||||
if(ORGAN_SLOT_EARS)
|
||||
return initial(species.mutantears)
|
||||
if(ORGAN_SLOT_TONGUE)
|
||||
return initial(species.mutanttongue)
|
||||
if(ORGAN_SLOT_LIVER)
|
||||
return initial(species.mutantliver)
|
||||
if(ORGAN_SLOT_STOMACH)
|
||||
return initial(species.mutantstomach)
|
||||
if(ORGAN_SLOT_APPENDIX)
|
||||
return initial(species.mutantappendix)
|
||||
CRASH("Invalid organ slot [slot]") // just incase someone adds an organ we care about and forgets to add it here
|
||||
Reference in New Issue
Block a user