diff --git a/code/modules/surgery/organs/internal/eyes/_eyes.dm b/code/modules/surgery/organs/internal/eyes/_eyes.dm index 1195c15c56b..3262288b6cd 100644 --- a/code/modules/surgery/organs/internal/eyes/_eyes.dm +++ b/code/modules/surgery/organs/internal/eyes/_eyes.dm @@ -427,13 +427,13 @@ /// base icon state for eye overlays var/base_eye_state = "eyes_glow_gs" /// Whether or not to match the eye color to the light or use a custom selection - var/eye_color_mode = MATCH_LIGHT_COLOR + var/eye_color_mode = USE_CUSTOM_COLOR /// The selected color for the light beam itself - var/current_color_string = "#ffffff" + var/light_color_string = "#ffffff" /// The custom selected eye color for the left eye. Defaults to the mob's natural eye color - var/current_left_color_string + var/left_eye_color_string /// The custom selected eye color for the right eye. Defaults to the mob's natural eye color - var/current_right_color_string + var/right_eye_color_string /obj/item/organ/internal/eyes/robotic/glow/Initialize(mapload) . = ..() @@ -453,9 +453,9 @@ /// Set the initial color of the eyes on insert to be the mob's previous eye color. /obj/item/organ/internal/eyes/robotic/glow/Insert(mob/living/carbon/eye_recipient, special = FALSE, drop_if_replaced = FALSE) . = ..() - current_color_string = old_eye_color_left - current_left_color_string = old_eye_color_left - current_right_color_string = old_eye_color_right + left_eye_color_string = old_eye_color_left + right_eye_color_string = old_eye_color_right + update_mob_eye_color(eye_recipient) /obj/item/organ/internal/eyes/robotic/glow/on_insert(mob/living/carbon/eye_recipient) . = ..() @@ -464,7 +464,8 @@ /obj/item/organ/internal/eyes/robotic/glow/on_remove(mob/living/carbon/eye_owner) deactivate(eye_owner, close_ui = TRUE) - eye.forceMove(src) + if(!QDELETED(eye)) + eye.forceMove(src) return ..() /obj/item/organ/internal/eyes/robotic/glow/ui_state(mob/user) @@ -493,10 +494,10 @@ data["eyeColor"] = list( mode = eye_color_mode, hasOwner = owner ? TRUE : FALSE, - left = current_left_color_string, - right = current_right_color_string, + left = left_eye_color_string, + right = right_eye_color_string, ) - data["lightColor"] = current_color_string + data["lightColor"] = light_color_string data["range"] = eye.light_range return data @@ -516,7 +517,7 @@ usr, "Choose eye color color:", "High Luminosity Eyes Menu", - current_color_string + light_color_string ) as color|null if(new_color) var/to_update = params["to_update"] @@ -547,9 +548,10 @@ * Turns on the attached flashlight object, updates the mob overlay to be added. */ /obj/item/organ/internal/eyes/robotic/glow/proc/activate() - eye.light_on = TRUE - if(eye.light_range) // at range 0 we are just going to make the eyes glow emissively, no light overlay + if(eye.light_range) eye.set_light_on(TRUE) + else + eye.light_on = TRUE // at range 0 we are just going to make the eyes glow emissively, no light overlay update_mob_eye_color() /** @@ -611,12 +613,12 @@ newcolor_string = newcolor switch(to_update) if(UPDATE_LIGHT) - current_color_string = newcolor_string + light_color_string = newcolor_string eye.set_light_color(newcolor_string) if(UPDATE_EYES_LEFT) - current_left_color_string = newcolor_string + left_eye_color_string = newcolor_string if(UPDATE_EYES_RIGHT) - current_right_color_string = newcolor_string + right_eye_color_string = newcolor_string update_mob_eye_color() @@ -648,11 +650,11 @@ /obj/item/organ/internal/eyes/robotic/glow/proc/update_mob_eye_color(mob/living/carbon/eye_owner = owner) switch(eye_color_mode) if(MATCH_LIGHT_COLOR) - eye_color_left = current_color_string - eye_color_right = current_color_string + eye_color_left = light_color_string + eye_color_right = light_color_string if(USE_CUSTOM_COLOR) - eye_color_left = current_left_color_string - eye_color_right = current_right_color_string + eye_color_left = left_eye_color_string + eye_color_right = right_eye_color_string if(QDELETED(eye_owner) || !ishuman(eye_owner)) //Other carbon mobs don't have eye color. return diff --git a/code/modules/unit_tests/_unit_tests.dm b/code/modules/unit_tests/_unit_tests.dm index c14f807aa19..d9d163b8702 100644 --- a/code/modules/unit_tests/_unit_tests.dm +++ b/code/modules/unit_tests/_unit_tests.dm @@ -222,6 +222,7 @@ #include "screenshot_antag_icons.dm" #include "screenshot_basic.dm" #include "screenshot_dynamic_human_icons.dm" +#include "screenshot_high_luminosity_eyes.dm" #include "screenshot_humanoids.dm" #include "screenshot_husk.dm" #include "screenshot_saturnx.dm" diff --git a/code/modules/unit_tests/screenshot_high_luminosity_eyes.dm b/code/modules/unit_tests/screenshot_high_luminosity_eyes.dm new file mode 100644 index 00000000000..4b0c3a986f1 --- /dev/null +++ b/code/modules/unit_tests/screenshot_high_luminosity_eyes.dm @@ -0,0 +1,64 @@ +#define UPDATE_EYES_LEFT 1 +#define UPDATE_EYES_RIGHT 2 + +/// Tests to make sure no punks have broken high luminosity eyes +/datum/unit_test/screenshot_high_luminosity_eyes + var/mob/living/carbon/human/test_subject + var/obj/item/organ/internal/eyes/robotic/glow/test_eyes + +/datum/unit_test/screenshot_high_luminosity_eyes/Run() + // Create a mob with red and blue eyes. This is to test that high luminosity eyes properly default to the old eye color. + test_subject = allocate(/mob/living/carbon/human/consistent) + test_subject.equipOutfit(/datum/outfit/job/assistant/consistent) + test_subject.eye_color_left = COLOR_RED + test_subject.eye_color_right = COLOR_BLUE + + // Create our eyes, and insert them into the mob + test_eyes = allocate(/obj/item/organ/internal/eyes/robotic/glow) + test_eyes.Insert(test_subject) + + // This should be 4, but just in case it ever changes in the future + var/default_light_range = test_eyes.eye.light_range + + // Test the normal light on appearance + test_eyes.toggle_active() + var/icon/flat_icon = create_icon() + test_screenshot("light_on", flat_icon) + + // Change the eye color to pink and green + test_eyes.set_beam_color(COLOR_SCIENCE_PINK, to_update = UPDATE_EYES_LEFT) + test_eyes.set_beam_color(COLOR_SLIME_GREEN, to_update = UPDATE_EYES_RIGHT) + + // Make sure the light overlay goes away (but not the emissive overlays) when we go to light range 0 while still turned on + test_eyes.set_beam_range(0) + TEST_ASSERT_EQUAL(test_eyes.eye.light_on, TRUE, "[src]'s 'eye.light_on' is FALSE after setting range to 0 while on. 'eye.light_on' should = TRUE!") + flat_icon = create_icon() + test_screenshot("light_emissive", flat_icon) + + // turn it on and off again, it should look the same afterwards + test_eyes.toggle_active() + TEST_ASSERT_EQUAL(test_eyes.eye.light_on, FALSE, "[src]'s 'eye.light_on' is TRUE after being toggled off at range 0. 'eye.light_on' should = FALSE!") + test_eyes.toggle_active() + TEST_ASSERT_EQUAL(test_eyes.eye.light_on, TRUE, "[src]'s 'eye.light_on' is FALSE after being toggled on at range 0. 'eye.light_on' should = TRUE!") + flat_icon = create_icon() + test_screenshot("light_emissive", flat_icon) + + // Make sure the light comes back on when we go from range 0 to 1 + // Change left/right eye color back to red/blue. It should match the original screenshot + test_eyes.set_beam_range(default_light_range) + test_eyes.set_beam_color(COLOR_RED, to_update = UPDATE_EYES_LEFT) + test_eyes.set_beam_color(COLOR_BLUE, to_update = UPDATE_EYES_RIGHT) + flat_icon = create_icon() + test_screenshot("light_on", flat_icon) + +/// Create the mob icon with light cone underlay +/datum/unit_test/screenshot_high_luminosity_eyes/proc/create_icon() + var/icon/final_icon = get_flat_icon_for_all_directions(test_subject, no_anim = FALSE) + for(var/mutable_appearance/light_underlay as anything in test_subject.underlays) + if(light_underlay.icon == 'icons/effects/light_overlays/light_cone.dmi') + // The light cone icon is 96x96, so we have to shift it over to have it match our sprites. x = 1, y = 1 is the lower left corner so we shift 32 pixels opposite to that. + final_icon.Blend(get_flat_icon_for_all_directions(light_underlay, no_anim = FALSE), ICON_UNDERLAY, -world.icon_size + 1, -world.icon_size + 1) + return final_icon + +#undef UPDATE_EYES_LEFT +#undef UPDATE_EYES_RIGHT diff --git a/code/modules/unit_tests/screenshots/screenshot_high_luminosity_eyes_light_emissive.png b/code/modules/unit_tests/screenshots/screenshot_high_luminosity_eyes_light_emissive.png new file mode 100644 index 00000000000..e7f5a457c30 Binary files /dev/null and b/code/modules/unit_tests/screenshots/screenshot_high_luminosity_eyes_light_emissive.png differ diff --git a/code/modules/unit_tests/screenshots/screenshot_high_luminosity_eyes_light_on.png b/code/modules/unit_tests/screenshots/screenshot_high_luminosity_eyes_light_on.png new file mode 100644 index 00000000000..76c997c3318 Binary files /dev/null and b/code/modules/unit_tests/screenshots/screenshot_high_luminosity_eyes_light_on.png differ diff --git a/icons/mob/human/human_face.dmi b/icons/mob/human/human_face.dmi index 886f0bf793b..d96800c3a8b 100644 Binary files a/icons/mob/human/human_face.dmi and b/icons/mob/human/human_face.dmi differ diff --git a/modular_skyrat/modules/xenos_skyrat_redo/code/human_defense.dm b/modular_skyrat/modules/xenos_skyrat_redo/code/human_defense.dm index 5f71d1710ab..8fa51a05f7e 100644 --- a/modular_skyrat/modules/xenos_skyrat_redo/code/human_defense.dm +++ b/modular_skyrat/modules/xenos_skyrat_redo/code/human_defense.dm @@ -11,7 +11,7 @@ if(mob_held_item) - if(check_block(user, charge_damage = 0, name = "[user.name]")) + if(check_block(user, damage = 0, attack_text = "[user.name]")) playsound(loc, 'sound/weapons/parry.ogg', 25, TRUE, -1) //Audio feedback to the fact you just got blocked apply_damage(disarm_damage / 2, STAMINA) visible_message(span_danger("[user] attempts to touch [src]!"), \ diff --git a/tgui/packages/tgui/interfaces/HighLuminosityEyesMenu.tsx b/tgui/packages/tgui/interfaces/HighLuminosityEyesMenu.tsx index 5175cdbdb7f..93877783c43 100644 --- a/tgui/packages/tgui/interfaces/HighLuminosityEyesMenu.tsx +++ b/tgui/packages/tgui/interfaces/HighLuminosityEyesMenu.tsx @@ -91,11 +91,11 @@ const EyeColorDisplay = (props, context) => { const { eyeColor } = data; return ( <> - + act('toggle_eye_color')} - tooltip="Toggle the eye color mode." + tooltip="Toggles whether eyecolor matches the color of the light." /> {!eyeColor.mode && ( @@ -112,7 +112,7 @@ const EyeColorDisplay = (props, context) => { onClick={() => act('random_color', { to_update: ToUpdate.LeftEye }) } - tooltip="Randomizes the light color." + tooltip="Randomizes the eye color." /> { onClick={() => act('random_color', { to_update: ToUpdate.RightEye }) } - tooltip="Randomizes the light color." + tooltip="Randomizes the eye color." />