Fixes SaturnX (#69765)

This commit is contained in:
John Willard
2022-09-08 17:28:50 -07:00
committed by GitHub
parent 6e9ea15514
commit a02ae46bb4
7 changed files with 63 additions and 15 deletions
@@ -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
@@ -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?
+23 -7
View File
@@ -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
+5
View File
@@ -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
+1
View File
@@ -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"
@@ -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
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB