diff --git a/code/modules/mob/living/carbon/carbon_update_icons.dm b/code/modules/mob/living/carbon/carbon_update_icons.dm index 8724571e05f..2aa2b74f39b 100644 --- a/code/modules/mob/living/carbon/carbon_update_icons.dm +++ b/code/modules/mob/living/carbon/carbon_update_icons.dm @@ -401,6 +401,8 @@ . += "-[body_zone]" if(should_draw_greyscale && draw_color) . += "-[draw_color]" + if(is_invisible) + . += "-invisible" for(var/obj/item/organ/external/external_organ as anything in external_organs) if(!external_organ.can_draw_on_bodypart(owner)) continue diff --git a/code/modules/reagents/chemistry/reagents/drug_reagents.dm b/code/modules/reagents/chemistry/reagents/drug_reagents.dm index 22fd95820bc..de943173b7f 100644 --- a/code/modules/reagents/chemistry/reagents/drug_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/drug_reagents.dm @@ -674,13 +674,14 @@ animate(size = 0, time = 6 SECONDS, easing = CIRCULAR_EASING|EASE_IN) ///This proc turns the living mob passed as the arg "invisible_man"s invisible by giving him the invisible man trait and updating his body, this changes the sprite of all his organic limbs to a 1 alpha version. -/datum/reagent/drug/saturnx/proc/turn_man_invisible(mob/living/carbon/invisible_man) - if(!invisible_man.getorganslot(ORGAN_SLOT_LIVER)) - return - if(invisible_man.undergoing_liver_failure()) - return - if(HAS_TRAIT(invisible_man, TRAIT_NOMETABOLISM)) - return +/datum/reagent/drug/saturnx/proc/turn_man_invisible(mob/living/carbon/invisible_man, requires_liver = TRUE) + if(requires_liver) + if(!invisible_man.getorganslot(ORGAN_SLOT_LIVER)) + return + if(invisible_man.undergoing_liver_failure()) + return + if(HAS_TRAIT(invisible_man, TRAIT_NOMETABOLISM)) + return if(invisible_man.has_status_effect(/datum/status_effect/grouped/stasis)) return @@ -695,7 +696,7 @@ invisible_man.remove_from_all_data_huds() invisible_man.sound_environment_override = SOUND_ENVIROMENT_PHASED -/datum/reagent/drug/saturnx/on_mob_end_metabolize(mob/living/invisible_man) +/datum/reagent/drug/saturnx/on_mob_end_metabolize(mob/living/carbon/invisible_man) . = ..() if(HAS_TRAIT(invisible_man, TRAIT_INVISIBLE_MAN)) invisible_man.add_to_all_human_data_huds() //Is this safe, what do you think, Floyd? diff --git a/code/modules/surgery/bodyparts/_bodyparts.dm b/code/modules/surgery/bodyparts/_bodyparts.dm index a0a1a2c7b51..e1a602a2fd9 100644 --- a/code/modules/surgery/bodyparts/_bodyparts.dm +++ b/code/modules/surgery/bodyparts/_bodyparts.dm @@ -12,6 +12,8 @@ VAR_PROTECTED/icon_static = 'icons/mob/species/human/bodyparts.dmi' ///The icon for husked limbs VAR_PROTECTED/icon_husk = 'icons/mob/species/human/bodyparts.dmi' + ///The icon for invisible limbs + VAR_PROTECTED/icon_invisible = 'icons/mob/species/human/bodyparts.dmi' ///The type of husk for building an iconstate var/husk_type = "humanoid" layer = BELOW_MOB_LAYER //so it isn't hidden behind objects when on the floor @@ -25,7 +27,10 @@ ///Defines when a bodypart should not be changed. Example: BP_BLOCK_CHANGE_SPECIES prevents the limb from being overwritten on species gain var/change_exempt_flags + ///Whether the bodypart (and the owner) is husked. var/is_husked = FALSE + ///Whether the bodypart (and the owner) is invisible through invisibleman trait. + var/is_invisible = FALSE ///The ID of a species used to generate the icon. Needs to match the icon_state portion in the limbs file! var/limb_id = SPECIES_HUMAN //Defines what sprite the limb should use if it is also sexually dimorphic. @@ -624,12 +629,17 @@ /obj/item/bodypart/proc/update_limb(dropping_limb = FALSE, is_creating = FALSE) SHOULD_CALL_PARENT(TRUE) - if(HAS_TRAIT(owner, TRAIT_HUSK) && IS_ORGANIC_LIMB(src)) - dmg_overlay_type = "" //no damage overlay shown when husked - is_husked = TRUE - else - dmg_overlay_type = initial(dmg_overlay_type) - is_husked = FALSE + if(IS_ORGANIC_LIMB(src)) + if(HAS_TRAIT(owner, TRAIT_HUSK)) + dmg_overlay_type = "" //no damage overlay shown when husked + is_husked = TRUE + else if(HAS_TRAIT(owner, TRAIT_INVISIBLE_MAN)) + dmg_overlay_type = "" //no damage overlay shown when invisible since the wounds themselves are invisible. + is_invisible = TRUE + else + dmg_overlay_type = initial(dmg_overlay_type) + is_husked = FALSE + is_invisible = FALSE if(!dropping_limb && owner.dna?.check_mutation(/datum/mutation/human/hulk)) mutation_color = "#00aa00" @@ -723,7 +733,7 @@ limb.icon = 'icons/mob/species/monkey/bodyparts.dmi' else limb.icon = 'icons/mob/species/alien/bodyparts.dmi' - + if(limb_id == "husk") limb.icon_state = "[animal_origin]_husk_[body_zone]" else @@ -750,6 +760,12 @@ . += aux return . //END HUSK SHIIIIT + //invisibility + if(is_invisible) + limb.icon = icon_invisible + limb.icon_state = "invisible_[body_zone]" + . += limb + return . ////This is the MEAT of limb icon code limb.icon = icon_greyscale diff --git a/code/modules/surgery/bodyparts/hair.dm b/code/modules/surgery/bodyparts/hair.dm index 71f53549387..681ea719d51 100644 --- a/code/modules/surgery/bodyparts/hair.dm +++ b/code/modules/surgery/bodyparts/hair.dm @@ -25,6 +25,7 @@ if(mask.flags_inv & HIDEFACIALHAIR) facial_hair_hidden = TRUE ///FACIAL HAIR CHECKS END + ///HAIR CHECKS START hair_hidden = FALSE if(human_head_owner.head) @@ -42,6 +43,10 @@ if(mask.flags_inv & HIDEHAIR) hair_hidden = TRUE ///HAIR CHECKS END + //invisibility stuff + if(HAS_TRAIT(human_head_owner, TRAIT_INVISIBLE_MAN)) + hair_hidden = TRUE + facial_hair_hidden = TRUE if(!hair_hidden && !owner.getorganslot(ORGAN_SLOT_BRAIN) && !(NOBLOOD in species_flags_list)) show_debrained = TRUE diff --git a/code/modules/unit_tests/_unit_tests.dm b/code/modules/unit_tests/_unit_tests.dm index 6a675c43633..aa90492b15f 100644 --- a/code/modules/unit_tests/_unit_tests.dm +++ b/code/modules/unit_tests/_unit_tests.dm @@ -143,6 +143,7 @@ #include "screenshot_antag_icons.dm" #include "screenshot_basic.dm" #include "screenshot_humanoids.dm" +#include "screenshot_saturnx.dm" #include "security_officer_distribution.dm" #include "security_levels.dm" #include "serving_tray.dm" diff --git a/code/modules/unit_tests/screenshot_saturnx.dm b/code/modules/unit_tests/screenshot_saturnx.dm new file mode 100644 index 00000000000..1c7087bc784 --- /dev/null +++ b/code/modules/unit_tests/screenshot_saturnx.dm @@ -0,0 +1,23 @@ +/// A screenshot test for making sure invisible limbs function, keeping them clothed so we know they're there. +/datum/unit_test/screenshot_saturnx + +/datum/unit_test/screenshot_saturnx/Run() + var/mob/living/carbon/human/human = allocate(/mob/living/carbon/human/dummy/consistent) //we don't use a dummy as they have no organs + human.equipOutfit(/datum/outfit/job/assistant/consistent, visualsOnly = TRUE) + + var/datum/reagent/drug/saturnx/saturnx_reagent = new() + + saturnx_reagent.expose_atom(human, 15) + saturnx_reagent.turn_man_invisible(human, requires_liver = FALSE) //immediately turn us invisible + + test_screenshot("invisibility", get_flat_icon_for_all_directions(human)) + +/datum/unit_test/screenshot_saturnx/proc/get_flat_icon_for_all_directions(atom/thing) + var/icon/output = icon('icons/effects/effects.dmi', "nothing") + COMPILE_OVERLAYS(thing) + + for (var/direction in GLOB.cardinals) + var/icon/partial = getFlatIcon(thing, defdir = direction) + output.Insert(partial, dir = direction) + + return output diff --git a/code/modules/unit_tests/screenshots/screenshot_saturnx_invisibility.png b/code/modules/unit_tests/screenshots/screenshot_saturnx_invisibility.png new file mode 100644 index 00000000000..9e44937a1e7 Binary files /dev/null and b/code/modules/unit_tests/screenshots/screenshot_saturnx_invisibility.png differ