diff --git a/code/datums/datum.dm b/code/datums/datum.dm index e98f0941d646..bf2b1084d7f2 100644 --- a/code/datums/datum.dm +++ b/code/datums/datum.dm @@ -315,7 +315,7 @@ /// Reapplies all the filters. /datum/proc/update_filters() - ASSERT(isatom(src) || istype(src, /image)) + ASSERT(isatom(src) || isimage(src)) var/atom/atom_cast = src // filters only work with images or atoms. atom_cast.filters = null filter_data = sortTim(filter_data, GLOBAL_PROC_REF(cmp_filter_data_priority), TRUE) @@ -377,7 +377,7 @@ /// Returns the filter associated with the passed key /datum/proc/get_filter(name) - ASSERT(isatom(src) || istype(src, /image)) + ASSERT(isatom(src) || isimage(src)) if(filter_data && filter_data[name]) var/atom/atom_cast = src // filters only work with images or atoms. return atom_cast.filters[filter_data.Find(name)] @@ -400,7 +400,7 @@ update_filters() /datum/proc/clear_filters() - ASSERT(isatom(src) || istype(src, /image)) + ASSERT(isatom(src) || isimage(src)) var/atom/atom_cast = src // filters only work with images or atoms. filter_data = null atom_cast.filters = null @@ -417,4 +417,3 @@ return harddel_deets_dumped = TRUE return "Image icon: [icon] - icon_state: [icon_state] [loc ? "loc: [loc] ([loc.x],[loc.y],[loc.z])" : ""]" - diff --git a/code/modules/clothing/glasses/_glasses.dm b/code/modules/clothing/glasses/_glasses.dm index c1b8c277abf8..77eeb3c6ad84 100644 --- a/code/modules/clothing/glasses/_glasses.dm +++ b/code/modules/clothing/glasses/_glasses.dm @@ -485,27 +485,10 @@ var/colored_before = FALSE /obj/item/clothing/glasses/blindfold/white/visual_equipped(mob/living/carbon/human/user, slot) - if(ishuman(user) && (slot & ITEM_SLOT_EYES)) - update_icon(ALL, user) - user.update_worn_glasses() //Color might have been changed by update_icon. - . = ..() - -/obj/item/clothing/glasses/blindfold/white/update_icon(updates=ALL, mob/living/carbon/human/user) - . = ..() - if(ishuman(user) && !colored_before) + if(ishuman(user) && (slot & ITEM_SLOT_EYES) && !colored_before) add_atom_colour(BlendRGB(user.eye_color_left, user.eye_color_right, 0.5), FIXED_COLOUR_PRIORITY) colored_before = TRUE - -/obj/item/clothing/glasses/blindfold/white/worn_overlays(mutable_appearance/standing, isinhands = FALSE, file2use) - . = ..() - if(isinhands || !ishuman(loc) || colored_before) - return - - var/mob/living/carbon/human/H = loc - var/mutable_appearance/M = mutable_appearance('icons/mob/clothing/eyes.dmi', "blindfoldwhite") - M.appearance_flags |= RESET_COLOR - M.color = H.eye_color_left - . += M + return ..() /obj/item/clothing/glasses/sunglasses/big desc = "Strangely ancient technology used to help provide rudimentary eye cover. Larger than average enhanced shielding blocks flashes." diff --git a/code/modules/clothing/head/wig.dm b/code/modules/clothing/head/wig.dm index ad2759a137ce..1fcc66d1a27b 100644 --- a/code/modules/clothing/head/wig.dm +++ b/code/modules/clothing/head/wig.dm @@ -31,18 +31,6 @@ icon_state = hair_style.icon_state return ..() - -/obj/item/clothing/head/wig/build_worn_icon( - default_layer = 0, - default_icon_file = null, - isinhands = FALSE, - female_uniform = NO_FEMALE_UNIFORM, - override_state = null, - override_file = null, - use_height_offset = TRUE, -) - return ..(default_layer, default_icon_file, isinhands, female_uniform, override_state, override_file, use_height_offset = FALSE) - /obj/item/clothing/head/wig/worn_overlays(mutable_appearance/standing, isinhands = FALSE, file2use) . = ..() if(isinhands) diff --git a/code/modules/mob/living/carbon/carbon_update_icons.dm b/code/modules/mob/living/carbon/carbon_update_icons.dm index 12debabd60df..08e734a01f40 100644 --- a/code/modules/mob/living/carbon/carbon_update_icons.dm +++ b/code/modules/mob/living/carbon/carbon_update_icons.dm @@ -340,31 +340,36 @@ /mob/living/carbon/update_damage_overlays() remove_overlay(DAMAGE_LAYER) - var/mutable_appearance/damage_overlay = mutable_appearance('icons/mob/effects/dam_mob.dmi', "blank", -DAMAGE_LAYER) - overlays_standing[DAMAGE_LAYER] = damage_overlay - + var/mutable_appearance/damage_overlay for(var/obj/item/bodypart/iter_part as anything in bodyparts) - if(iter_part.dmg_overlay_type) - if(iter_part.brutestate) - // NON-MODULE CHANGE for blood - var/image/brute_overlay = image('icons/mob/effects/dam_mob.dmi', "[iter_part.dmg_overlay_type]_[iter_part.body_zone]_[iter_part.brutestate]0") - brute_overlay.color = iter_part.damage_color - damage_overlay.add_overlay(brute_overlay) //we're adding icon_states of the base image as overlays - if(iter_part.burnstate) - damage_overlay.add_overlay("[iter_part.dmg_overlay_type]_[iter_part.body_zone]_0[iter_part.burnstate]") + if(!iter_part.dmg_overlay_type) + continue + if(isnull(damage_overlay) && (iter_part.brutestate || iter_part.burnstate)) + damage_overlay = mutable_appearance('icons/mob/effects/dam_mob.dmi', "blank", -DAMAGE_LAYER, appearance_flags = KEEP_TOGETHER) + if(iter_part.brutestate) + damage_overlay.add_overlay("[iter_part.dmg_overlay_type]_[iter_part.body_zone]_[iter_part.brutestate]0") //we're adding icon_states of the base image as overlays + if(iter_part.burnstate) + damage_overlay.add_overlay("[iter_part.dmg_overlay_type]_[iter_part.body_zone]_0[iter_part.burnstate]") + + if(isnull(damage_overlay)) + return + overlays_standing[DAMAGE_LAYER] = damage_overlay apply_overlay(DAMAGE_LAYER) /mob/living/carbon/update_wound_overlays() remove_overlay(WOUND_LAYER) - var/mutable_appearance/wound_overlay = mutable_appearance('icons/mob/effects/bleed_overlays.dmi', "blank", -WOUND_LAYER) - overlays_standing[WOUND_LAYER] = wound_overlay - + var/mutable_appearance/wound_overlay for(var/obj/item/bodypart/iter_part as anything in bodyparts) if(iter_part.bleed_overlay_icon) + wound_overlay ||= mutable_appearance('icons/mob/effects/bleed_overlays.dmi', "blank", -WOUND_LAYER, appearance_flags = KEEP_TOGETHER) wound_overlay.add_overlay(iter_part.bleed_overlay_icon) + if(isnull(wound_overlay)) + return + + overlays_standing[WOUND_LAYER] = wound_overlay apply_overlay(WOUND_LAYER) /mob/living/carbon/update_worn_mask() diff --git a/code/modules/mob/living/carbon/human/_species.dm b/code/modules/mob/living/carbon/human/_species.dm index 722ca6f4da7a..273ba1e185d3 100644 --- a/code/modules/mob/living/carbon/human/_species.dm +++ b/code/modules/mob/living/carbon/human/_species.dm @@ -638,33 +638,32 @@ GLOBAL_LIST_EMPTY(features_by_species) var/obj/item/bodypart/leg/right/right_leg = species_human.get_bodypart(BODY_ZONE_R_LEG) var/obj/item/bodypart/leg/left/left_leg = species_human.get_bodypart(BODY_ZONE_L_LEG) var/datum/sprite_accessory/markings = GLOB.moth_markings_list[species_human.dna.features["moth_markings"]] + var/mutable_appearance/marking = mutable_appearance(layer = -BODY_LAYER, appearance_flags = KEEP_TOGETHER) if(noggin && (IS_ORGANIC_LIMB(noggin))) - var/mutable_appearance/markings_head_overlay = mutable_appearance(markings.icon, "[markings.icon_state]_head", -BODY_LAYER) - markings_head_overlay.pixel_y += height_offset - standing += markings_head_overlay + var/mutable_appearance/markings_head_overlay = mutable_appearance(markings.icon, "[markings.icon_state]_head") + marking.overlays += markings_head_overlay if(chest && (IS_ORGANIC_LIMB(chest))) - var/mutable_appearance/markings_chest_overlay = mutable_appearance(markings.icon, "[markings.icon_state]_chest", -BODY_LAYER) - markings_chest_overlay.pixel_y += height_offset - standing += markings_chest_overlay + var/mutable_appearance/markings_chest_overlay = mutable_appearance(markings.icon, "[markings.icon_state]_chest") + marking.overlays += markings_chest_overlay if(right_arm && (IS_ORGANIC_LIMB(right_arm))) - var/mutable_appearance/markings_r_arm_overlay = mutable_appearance(markings.icon, "[markings.icon_state]_r_arm", -BODY_LAYER) - markings_r_arm_overlay.pixel_y += height_offset - standing += markings_r_arm_overlay + var/mutable_appearance/markings_r_arm_overlay = mutable_appearance(markings.icon, "[markings.icon_state]_r_arm") + marking.overlays += markings_r_arm_overlay if(left_arm && (IS_ORGANIC_LIMB(left_arm))) - var/mutable_appearance/markings_l_arm_overlay = mutable_appearance(markings.icon, "[markings.icon_state]_l_arm", -BODY_LAYER) - markings_l_arm_overlay.pixel_y += height_offset - standing += markings_l_arm_overlay + var/mutable_appearance/markings_l_arm_overlay = mutable_appearance(markings.icon, "[markings.icon_state]_l_arm") + marking.overlays += markings_l_arm_overlay if(right_leg && (IS_ORGANIC_LIMB(right_leg))) - var/mutable_appearance/markings_r_leg_overlay = mutable_appearance(markings.icon, "[markings.icon_state]_r_leg", -BODY_LAYER) - standing += markings_r_leg_overlay + var/mutable_appearance/markings_r_leg_overlay = mutable_appearance(markings.icon, "[markings.icon_state]_r_leg") + marking.overlays += markings_r_leg_overlay if(left_leg && (IS_ORGANIC_LIMB(left_leg))) - var/mutable_appearance/markings_l_leg_overlay = mutable_appearance(markings.icon, "[markings.icon_state]_l_leg", -BODY_LAYER) - standing += markings_l_leg_overlay + var/mutable_appearance/markings_l_leg_overlay = mutable_appearance(markings.icon, "[markings.icon_state]_l_leg") + marking.overlays += markings_l_leg_overlay + + standing += marking //Underwear, Undershirts & Socks if(!HAS_TRAIT(species_human, TRAIT_NO_UNDERWEAR)) 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 1690a4394d19..3431e22150ac 100644 --- a/code/modules/mob/living/carbon/human/human_update_icons.dm +++ b/code/modules/mob/living/carbon/human/human_update_icons.dm @@ -173,7 +173,7 @@ There are several things that need to be remembered: if(isnull(gloves)) if(blood_in_hands && num_hands > 0) // When byond gives us filters that respect dirs we can just use an alpha mask for this but until then, two icons weeeee - var/mutable_appearance/hands_combined = mutable_appearance(layer = -GLOVES_LAYER) + var/mutable_appearance/hands_combined = mutable_appearance(layer = -GLOVES_LAYER, appearance_flags = KEEP_TOGETHER) hands_combined.color = get_blood_dna_color() if(has_left_hand(check_disabled = FALSE)) hands_combined.overlays += mutable_appearance('icons/effects/blood.dmi', "bloodyhands_left") @@ -658,7 +658,6 @@ generate/load female uniform sprites matching all previously decided variables female_uniform = NO_FEMALE_UNIFORM, override_state = null, override_file = null, - use_height_offset = TRUE, ) // NON-MODULE CHANGE // UPSTREAM ME @@ -680,26 +679,7 @@ generate/load female uniform sprites matching all previously decided variables //eg: ammo counters, primed grenade flashes, etc. var/list/worn_overlays = worn_overlays(standing, isinhands, file2use) if(length(worn_overlays)) // NON-MODULE CHANGE - if(!isinhands && default_layer && ishuman(loc) && use_height_offset) - var/mob/living/carbon/human/human_loc = loc - if(human_loc.get_mob_height() != HUMAN_HEIGHT_MEDIUM) - var/string_form_layer = num2text(default_layer) - var/offset_amount = GLOB.layers_to_offset[string_form_layer] - if(isnull(offset_amount)) - // Worn overlays don't get batched in with standing overlays because they are overlay overlays - // ...So we need to apply human height here as well - for(var/mutable_appearance/applied_appearance as anything in worn_overlays) - if(isnull(applied_appearance)) - continue - human_loc.apply_height_filters(applied_appearance) - - else - for(var/mutable_appearance/applied_appearance in worn_overlays) - if(isnull(applied_appearance)) - continue - human_loc.apply_height_offsets(applied_appearance, offset_amount) - - standing.overlays.Add(worn_overlays) + standing.overlays += worn_overlays standing = center_image(standing, isinhands ? inhand_x_dimension : worn_x_dimension, isinhands ? inhand_y_dimension : worn_y_dimension) @@ -784,23 +764,19 @@ generate/load female uniform sprites matching all previously decided variables var/raw_applied = overlays_standing[cache_index] var/string_form_index = num2text(cache_index) - var/offset_amount = GLOB.layers_to_offset[string_form_index] - if(isnull(offset_amount)) + var/offset_type = GLOB.layers_to_offset[string_form_index] + if(isnull(offset_type)) if(islist(raw_applied)) - for(var/mutable_appearance/applied_appearance as anything in raw_applied) - if(isnull(applied_appearance)) - continue + for(var/image/applied_appearance in raw_applied) apply_height_filters(applied_appearance) - else if(!isnull(raw_applied)) + else if(isimage(raw_applied)) apply_height_filters(raw_applied) else if(islist(raw_applied)) - for(var/mutable_appearance/applied_appearance as anything in raw_applied) - if(isnull(applied_appearance)) - continue - apply_height_offsets(applied_appearance, offset_amount) - else if(!isnull(raw_applied)) - apply_height_offsets(raw_applied, offset_amount) + for(var/image/applied_appearance in raw_applied) + apply_height_offsets(applied_appearance, offset_type) + else if(isimage(raw_applied)) + apply_height_offsets(raw_applied, offset_type) return ..() @@ -810,7 +786,7 @@ generate/load female uniform sprites matching all previously decided variables * upper_torso is to specify whether the appearance is locate in the upper half of the mob rather than the lower half, * higher up things (hats for example) need to be offset more due to the location of the filter displacement */ -/mob/living/carbon/human/proc/apply_height_offsets(mutable_appearance/appearance, upper_torso) +/mob/living/carbon/human/proc/apply_height_offsets(image/appearance, upper_torso) var/height_to_use = num2text(get_mob_height()) var/final_offset = 0 switch(upper_torso) @@ -827,7 +803,7 @@ generate/load female uniform sprites matching all previously decided variables /** * Applies a filter to an appearance according to mob height */ -/mob/living/carbon/human/proc/apply_height_filters(mutable_appearance/appearance) +/mob/living/carbon/human/proc/apply_height_filters(image/appearance) var/static/icon/cut_torso_mask = icon('icons/effects/cut.dmi', "Cut1") var/static/icon/cut_legs_mask = icon('icons/effects/cut.dmi', "Cut2") var/static/icon/lenghten_torso_mask = icon('icons/effects/cut.dmi', "Cut3") @@ -861,6 +837,12 @@ generate/load female uniform sprites matching all previously decided variables appearance.add_filter("Lenghten_Torso", 1, displacement_map_filter(lenghten_torso_mask, x = 0, y = 0, size = 1)) appearance.add_filter("Lenghten_Legs", 1, displacement_map_filter(lenghten_legs_mask, x = 0, y = 0, size = 2)) + // Kinda gross but because many humans overlays do not use KEEP_TOGETHER we need to manually propogate the filter + // Otherwise overlays, such as worn overlays on icons, won't have the filter "applied", and the effect kinda breaks + if(!(appearance.appearance_flags & KEEP_TOGETHER)) + for(var/image/overlay in list() + appearance.underlays + appearance.overlays) + apply_height_filters(overlay) + return appearance /obj/item/proc/apply_digitigrade_filters(mutable_appearance/appearance) diff --git a/maplestation_modules/code/modules/client/preferences/height.dm b/maplestation_modules/code/modules/client/preferences/height.dm index 8f754d6c768f..6df336f29f6a 100644 --- a/maplestation_modules/code/modules/client/preferences/height.dm +++ b/maplestation_modules/code/modules/client/preferences/height.dm @@ -137,12 +137,12 @@ . = ..() apply_height_filters(src, TRUE) -/mob/living/carbon/human/dummy/apply_height_filters(mutable_appearance/appearance, only_apply_in_prefs = FALSE) +/mob/living/carbon/human/dummy/apply_height_filters(image/appearance, only_apply_in_prefs = FALSE) if(only_apply_in_prefs) return ..() // Not necessary with above -/mob/living/carbon/human/dummy/apply_height_offsets(mutable_appearance/appearance, upper_torso) +/mob/living/carbon/human/dummy/apply_height_offsets(image/appearance, upper_torso) return /mob/living/carbon/human/get_mob_height()