From 71aaf8a9684f09dcef1f91ab944945ea169ca380 Mon Sep 17 00:00:00 2001 From: Time-Green Date: Fri, 20 Aug 2021 19:31:51 +0200 Subject: [PATCH] Fixes lowered megamothwings not rendering (#60856) --- code/__DEFINES/traits.dm | 2 ++ code/_globalvars/traits.dm | 4 ++-- code/modules/mob/living/carbon/carbon_update_icons.dm | 3 ++- code/modules/mob/living/carbon/human/human_update_icons.dm | 7 ++++--- code/modules/reagents/chemistry/reagents/drug_reagents.dm | 2 ++ code/modules/surgery/bodyparts/_bodyparts.dm | 5 ++++- code/modules/surgery/bodyparts/head.dm | 2 +- code/modules/surgery/organs/external/_external_organs.dm | 3 +-- 8 files changed, 18 insertions(+), 10 deletions(-) diff --git a/code/__DEFINES/traits.dm b/code/__DEFINES/traits.dm index 8cfae1cf29b..5d2748f33d6 100644 --- a/code/__DEFINES/traits.dm +++ b/code/__DEFINES/traits.dm @@ -332,6 +332,8 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai #define TRAIT_AI_BAGATTACK "bagattack" /// This mobs bodyparts are invisible but still clickable. #define TRAIT_INVISIBLE_MAN "invisible_man" +/// Don't draw external organs/species features like wings, horns, frills and stuff +#define TRAIT_HIDE_EXTERNAL_ORGANS "hide_external_organs" ///When people are floating from zero-grav or something, we can move around freely! #define TRAIT_FREE_FLOAT_MOVEMENT "free_float_movement" // You can stare into the abyss, but it does not stare back. diff --git a/code/_globalvars/traits.dm b/code/_globalvars/traits.dm index c842effb3f9..0a87c8d71dc 100644 --- a/code/_globalvars/traits.dm +++ b/code/_globalvars/traits.dm @@ -162,8 +162,8 @@ GLOBAL_LIST_INIT(traits_by_type, list( "TRAIT_KISS_OF_DEATH" = TRAIT_KISS_OF_DEATH, "TRAIT_ANXIOUS" = TRAIT_ANXIOUS, "TRAIT_WEAK_SOUL" = TRAIT_WEAK_SOUL, - "TRAIT_INVISIBLE_MAN" = TRAIT_INVISIBLE_MAN - + "TRAIT_INVISIBLE_MAN" = TRAIT_INVISIBLE_MAN, + "TRAIT_HIDE_EXTERNAL_ORGANS" = TRAIT_HIDE_EXTERNAL_ORGANS, ), /obj/item/bodypart = list( "TRAIT_PARALYSIS" = TRAIT_PARALYSIS, diff --git a/code/modules/mob/living/carbon/carbon_update_icons.dm b/code/modules/mob/living/carbon/carbon_update_icons.dm index 6c95b8de6a4..3dd393d7be6 100644 --- a/code/modules/mob/living/carbon/carbon_update_icons.dm +++ b/code/modules/mob/living/carbon/carbon_update_icons.dm @@ -248,9 +248,10 @@ //GENERATE NEW LIMBS var/list/new_limbs = list() + var/draw_features = !HAS_TRAIT(src, TRAIT_INVISIBLE_MAN) for(var/X in bodyparts) var/obj/item/bodypart/BP = X - new_limbs += BP.get_limb_icon() + new_limbs += BP.get_limb_icon(draw_external_organs = draw_features) if(new_limbs.len) overlays_standing[BODYPARTS_LAYER] = new_limbs limb_icon_cache[icon_render_key] = new_limbs diff --git a/code/modules/mob/living/carbon/human/human_update_icons.dm b/code/modules/mob/living/carbon/human/human_update_icons.dm index cb71a91a6a0..f73fde58b15 100644 --- a/code/modules/mob/living/carbon/human/human_update_icons.dm +++ b/code/modules/mob/living/carbon/human/human_update_icons.dm @@ -590,9 +590,10 @@ generate/load female uniform sprites matching all previously decided variables var/obj/item/bodypart/BP = X . += "-[BP.body_zone]" - for(var/obj/item/organ/external/organ in BP.external_organs) - if(organ.can_draw_on_bodypart(src)) //make sure we're drawn before generating a key - . += "([organ.cache_key])" + if(!HAS_TRAIT(src, TRAIT_INVISIBLE_MAN)) + for(var/obj/item/organ/external/organ as anything in BP.external_organs) + if(organ.can_draw_on_bodypart(src)) //make sure we're drawn before generating a key + . += "([organ.cache_key])" if(BP.status == BODYPART_ORGANIC) . += "-organic" diff --git a/code/modules/reagents/chemistry/reagents/drug_reagents.dm b/code/modules/reagents/chemistry/reagents/drug_reagents.dm index c44e285f6e6..d59d0be24da 100644 --- a/code/modules/reagents/chemistry/reagents/drug_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/drug_reagents.dm @@ -680,6 +680,7 @@ return ADD_TRAIT(invisible_man, TRAIT_INVISIBLE_MAN, name) + ADD_TRAIT(invisible_man, TRAIT_HIDE_EXTERNAL_ORGANS, name) var/datum/dna/druggy_dna = invisible_man.has_dna() if(druggy_dna?.species) @@ -695,6 +696,7 @@ if(HAS_TRAIT(invisible_man, TRAIT_INVISIBLE_MAN)) invisible_man.add_to_all_human_data_huds() //Is this safe, what do you think, Floyd? REMOVE_TRAIT(invisible_man, TRAIT_INVISIBLE_MAN, name) + REMOVE_TRAIT(invisible_man, TRAIT_HIDE_EXTERNAL_ORGANS, name) to_chat(invisible_man, span_notice("As you sober up, opacity once again returns to your body meats.")) var/datum/dna/druggy_dna = invisible_man.has_dna() diff --git a/code/modules/surgery/bodyparts/_bodyparts.dm b/code/modules/surgery/bodyparts/_bodyparts.dm index 52a7b859fb5..a04051966f0 100644 --- a/code/modules/surgery/bodyparts/_bodyparts.dm +++ b/code/modules/surgery/bodyparts/_bodyparts.dm @@ -819,7 +819,7 @@ add_overlay(standing) //Gives you a proper icon appearance for the dismembered limb -/obj/item/bodypart/proc/get_limb_icon(dropped) +/obj/item/bodypart/proc/get_limb_icon(dropped, draw_external_organs) icon_state = "" //to erase the default sprite, we're building the visual aspects of the bodypart through overlays alone. . = list() @@ -921,6 +921,9 @@ aux_em_block.color = GLOB.em_block_color aux.overlays += aux_em_block + if(!draw_external_organs) + return + //Draw external organs like horns and frills for(var/obj/item/organ/external/external_organ in external_organs) if(!dropped && !external_organ.can_draw_on_bodypart(owner)) diff --git a/code/modules/surgery/bodyparts/head.dm b/code/modules/surgery/bodyparts/head.dm index 71d1ed59783..1eac7973d97 100644 --- a/code/modules/surgery/bodyparts/head.dm +++ b/code/modules/surgery/bodyparts/head.dm @@ -205,7 +205,7 @@ img.pixel_y = px_y add_overlay(standing) -/obj/item/bodypart/head/get_limb_icon(dropped) +/obj/item/bodypart/head/get_limb_icon(dropped, draw_external_organs) cut_overlays() . = ..() if(dropped) //certain overlays only appear when the limb is being detached from its owner. diff --git a/code/modules/surgery/organs/external/_external_organs.dm b/code/modules/surgery/organs/external/_external_organs.dm index 506eec16a7e..5e065f22a08 100644 --- a/code/modules/surgery/organs/external/_external_organs.dm +++ b/code/modules/surgery/organs/external/_external_organs.dm @@ -72,8 +72,7 @@ /obj/item/organ/external/proc/get_overlays(list/overlay_list, image_dir, image_layer, body_type, image_color) if(!sprite_datum) return - if(owner && HAS_TRAIT(owner, TRAIT_INVISIBLE_MAN)) - return + var/gender = (body_type == FEMALE) ? "f" : "m" var/finished_icon_state = (sprite_datum.gender_specific ? gender : "m") + "_" + preference + "_" + sprite_datum.icon_state + mutant_bodyparts_layertext(image_layer) var/mutable_appearance/appearance = mutable_appearance(sprite_datum.icon, finished_icon_state, layer = -image_layer)