From a02ae46bb403f19a05d5570d52f9266a4a3e7cd1 Mon Sep 17 00:00:00 2001 From: John Willard <53777086+JohnFulpWillard@users.noreply.github.com> Date: Thu, 8 Sep 2022 20:28:50 -0400 Subject: [PATCH] Fixes SaturnX (#69765) --- .../mob/living/carbon/carbon_update_icons.dm | 2 ++ .../chemistry/reagents/drug_reagents.dm | 17 +++++----- code/modules/surgery/bodyparts/_bodyparts.dm | 30 ++++++++++++++---- code/modules/surgery/bodyparts/hair.dm | 5 +++ code/modules/unit_tests/_unit_tests.dm | 1 + code/modules/unit_tests/screenshot_saturnx.dm | 23 ++++++++++++++ .../screenshot_saturnx_invisibility.png | Bin 0 -> 3503 bytes 7 files changed, 63 insertions(+), 15 deletions(-) create mode 100644 code/modules/unit_tests/screenshot_saturnx.dm create mode 100644 code/modules/unit_tests/screenshots/screenshot_saturnx_invisibility.png 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 0000000000000000000000000000000000000000..9e44937a1e7d37fcbb3115d11a1c3a818ef81f64 GIT binary patch literal 3503 zcmcha`9GB1|HrRkGL$W;EScfHr7SV%CbEXI6dIHeW6OSzB}}#%Ysi)*l5NP=ZK-6* zHY6m5gtCV)F_^KB+u(EQ+vC&cFZlj&UFV$l^?sdmo%i#c>%6ZRW5a74M+J@o0KlQA ztBnFn{NcsQ0^ZxyY`eh%8(?aFU)#~g-rL3Vz6<7W(2{kb^VQLCB=3<=N>oYddKQ;5 zilrz@?uR;bZ4_z|DQeCLgiZ9i$QsJjw)7_Wb)EH)b}LxCIvVhq>O1c?*nbl1@Q`lb{0}gOFy7!W!k;Kh(GANMN{<*yWK$E(MW*vagt{#l1L9 zUH9Ul#fYbw_^F7bfI(Zi(1MIq4VQeq;$pH;i6=Y%*>vs@QN!VVul1E>Y1rh-@(N)) z$SGqY*nfoDKwV$jZElc4gp=+uiw9Lp4W1N^yp;;rR$wId+IvIw63Q_Ki3%kq*?|M< zyuQZWHaD5>b6)p0>zi90^X)9l%Hep)%OHuny|UkpN*dG**z*ud|D@z;@|d_JqT$L3 zfR3bY-SRiQjKWqJK8wMAckz=FvTJVEDf*+I`!~SnqlM1?Yo00lzcVq6diz`bs6=6U z1GWhC4C=W-NrnQS#(hF(#XrBSB7115EZ1s~u9@?xnXP!}?7R zuGQ1)mK1fY1*P1QQgR79H(COSU_b6J%ci@>l%-o8iKRcXAm{L%->2o|OGK_AMv&hML5KhR0lxAYUxkU#EFizA(#3I zXf|`oc(!GDqatu=nX^%y2ER_>0feV6L9>9NT`r%Pd-73M(ki$-9@W#Z)s)vZ(}?1O zuriVhmQVwCC!W$f9M_|FGFBx0m?iFw@8o`ke|?g(!uR}ggH6#A@P+Mjw6xmloGCNg z*(wjtaFUVZ_O*}GpOqUhnad2<)eT=ua@T8FnFyq>kwz>ZXJh~^WAM=TB6(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