diff --git a/code/__DEFINES/inventory.dm b/code/__DEFINES/inventory.dm index c5819cdf62c1..aa1cf9baa18a 100644 --- a/code/__DEFINES/inventory.dm +++ b/code/__DEFINES/inventory.dm @@ -154,9 +154,11 @@ DEFINE_BITFIELD(no_equip_flags, list( #define CLOTHING_DIGITIGRADE_VARIATION_NO_NEW_ICON (1<<2) /// When worn by a mob with digitigrade, apply a filter #define CLOTHING_DIGITIGRADE_FILTER (1<<3) +/// Auto-generates the leg portion of the sprite with GAGS +#define CLOTHING_DIGITIGRADE_MASK (1<<4) -/// Any flag which has a variation for digi -#define DIGITIGRADE_VARIATIONS (CLOTHING_DIGITIGRADE_VARIATION|CLOTHING_DIGITIGRADE_VARIATION_NO_NEW_ICON|CLOTHING_DIGITIGRADE_FILTER) +/// All variation flags which render correctly on a digitigrade leg setup +#define DIGITIGRADE_VARIATIONS (CLOTHING_DIGITIGRADE_VARIATION|CLOTHING_DIGITIGRADE_VARIATION_NO_NEW_ICON|CLOTHING_DIGITIGRADE_FILTER|CLOTHING_DIGITIGRADE_MASK) //flags for covering body parts #define GLASSESCOVERSEYES (1<<0) diff --git a/code/_globalvars/bitfields.dm b/code/_globalvars/bitfields.dm index dde49e08ba5f..88f343395e2f 100644 --- a/code/_globalvars/bitfields.dm +++ b/code/_globalvars/bitfields.dm @@ -418,6 +418,7 @@ DEFINE_BITFIELD(supports_variations_flags, list( "CLOTHING_DIGITIGRADE_VARIATION" = CLOTHING_DIGITIGRADE_VARIATION, "CLOTHING_DIGITIGRADE_VARIATION_NO_NEW_ICON" = CLOTHING_DIGITIGRADE_VARIATION_NO_NEW_ICON, "CLOTHING_DIGITIGRADE_FILTER" = CLOTHING_DIGITIGRADE_FILTER, + "CLOTHING_DIGITIGRADE_MASK" = CLOTHING_DIGITIGRADE_MASK, )) DEFINE_BITFIELD(flora_flags, list( diff --git a/code/datums/greyscale/json_configs/_jumpsuit_worn_digi.json b/code/datums/greyscale/json_configs/_jumpsuit_worn_digi.json new file mode 100644 index 000000000000..9aa201cece3c --- /dev/null +++ b/code/datums/greyscale/json_configs/_jumpsuit_worn_digi.json @@ -0,0 +1,10 @@ +{ + "": [ + { + "type": "icon_state", + "icon_state": "jumpsuit", + "blend_mode": "overlay", + "color_ids": [ 1 ] + } + ] +} diff --git a/code/game/objects/structures/mannequin.dm b/code/game/objects/structures/mannequin.dm index 74127638d83d..7e41fe46decb 100644 --- a/code/game/objects/structures/mannequin.dm +++ b/code/game/objects/structures/mannequin.dm @@ -97,15 +97,15 @@ var/datum/sprite_accessory/underwear/underwear = GLOB.underwear_list[underwear_name] if(underwear) if(body_type == FEMALE && underwear.gender == MALE) - . += wear_female_version(underwear.icon_state, underwear.icon, BODY_LAYER, FEMALE_UNIFORM_FULL) + . += mutable_appearance(wear_female_version(underwear.icon_state, underwear.icon, FEMALE_UNIFORM_FULL), layer = -BODY_LAYER) else - . += mutable_appearance(underwear.icon, underwear.icon_state, -BODY_LAYER) + . += mutable_appearance(underwear.icon, underwear.icon_state, layer = -BODY_LAYER) var/datum/sprite_accessory/undershirt/undershirt = GLOB.undershirt_list[undershirt_name] if(undershirt) if(body_type == FEMALE) - . += wear_female_version(undershirt.icon_state, undershirt.icon, BODY_LAYER) + . += mutable_appearance(wear_female_version(undershirt.icon_state, undershirt.icon), layer = -BODY_LAYER) else - . += mutable_appearance(undershirt.icon, undershirt.icon_state, -BODY_LAYER) + . += mutable_appearance(undershirt.icon, undershirt.icon_state, layer = -BODY_LAYER) var/datum/sprite_accessory/socks/socks = GLOB.socks_list[socks_name] if(socks) . += mutable_appearance(socks.icon, socks.icon_state, -BODY_LAYER) diff --git a/code/modules/clothing/under/_under.dm b/code/modules/clothing/under/_under.dm index ebd3299e482b..868396f26b98 100644 --- a/code/modules/clothing/under/_under.dm +++ b/code/modules/clothing/under/_under.dm @@ -11,7 +11,6 @@ drop_sound = 'sound/items/handling/cloth_drop.ogg' pickup_sound = 'sound/items/handling/cloth_pickup.ogg' limb_integrity = 30 - supports_variations_flags = CLOTHING_DIGITIGRADE_FILTER blood_overlay_type = "uniform" // NON-MODULE CHANGE reworking clothing blood overlays /// Has this undersuit been freshly laundered and, as such, imparts a mood bonus for wearing diff --git a/code/modules/mob/living/carbon/human/_species.dm b/code/modules/mob/living/carbon/human/_species.dm index a2d966e7c975..550f0f0c1761 100644 --- a/code/modules/mob/living/carbon/human/_species.dm +++ b/code/modules/mob/living/carbon/human/_species.dm @@ -636,7 +636,7 @@ GLOBAL_LIST_EMPTY(features_by_species) var/mutable_appearance/underwear_overlay if(underwear) if(species_human.dna.species.sexes && species_human.physique == FEMALE && (underwear.gender == MALE)) - underwear_overlay = wear_female_version(underwear.icon_state, underwear.icon, BODY_LAYER, FEMALE_UNIFORM_FULL) + underwear_overlay = mutable_appearance(wear_female_version(underwear.icon_state, underwear.icon, FEMALE_UNIFORM_FULL), layer = -BODY_LAYER) else underwear_overlay = mutable_appearance(underwear.icon, underwear.icon_state, -BODY_LAYER) if(!underwear.use_static) @@ -648,9 +648,9 @@ GLOBAL_LIST_EMPTY(features_by_species) if(undershirt) var/mutable_appearance/working_shirt if(species_human.dna.species.sexes && species_human.physique == FEMALE) - working_shirt = wear_female_version(undershirt.icon_state, undershirt.icon, BODY_LAYER) + working_shirt = mutable_appearance(wear_female_version(undershirt.icon_state, undershirt.icon), layer = -BODY_LAYER) else - working_shirt = mutable_appearance(undershirt.icon, undershirt.icon_state, -BODY_LAYER) + working_shirt = mutable_appearance(undershirt.icon, undershirt.icon_state, layer = -BODY_LAYER) standing += working_shirt if(species_human.socks && species_human.num_legs >= 2 && !(species_human.bodytype & BODYTYPE_DIGITIGRADE)) 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 99d08f9c716d..5f13bc3b3c49 100644 --- a/code/modules/mob/living/carbon/human/human_update_icons.dm +++ b/code/modules/mob/living/carbon/human/human_update_icons.dm @@ -524,12 +524,72 @@ There are several things that need to be remembered: hands += hand_overlay return hands -/proc/wear_female_version(t_color, icon, layer, type, greyscale_colors) - var/index = "[t_color]-[greyscale_colors]" - var/icon/female_clothing_icon = GLOB.female_clothing_icons[index] - if(!female_clothing_icon) //Create standing/laying icons if they don't exist - generate_female_clothing(index, t_color, icon, type) - return mutable_appearance(GLOB.female_clothing_icons[index], layer = -layer) +/// Modifies a sprite slightly to conform to female body shapes +/proc/wear_female_version(icon_state, icon, type, greyscale_colors) + var/index = "[icon_state]-[greyscale_colors]" + var/static/list/female_clothing_icons = list() + var/icon/female_clothing_icon = female_clothing_icons[index] + if(!female_clothing_icon) //Create standing/laying icons if they don't exist + var/female_icon_state = "female[type == FEMALE_UNIFORM_FULL ? "_full" : ((!type || type & FEMALE_UNIFORM_TOP_ONLY) ? "_top" : "")][type & FEMALE_UNIFORM_NO_BREASTS ? "_no_breasts" : ""]" + var/icon/female_cropping_mask = icon('icons/mob/clothing/under/masking_helpers.dmi', female_icon_state) + female_clothing_icon = icon(icon, icon_state) + female_clothing_icon.Blend(female_cropping_mask, ICON_MULTIPLY) + female_clothing_icon = fcopy_rsc(female_clothing_icon) + female_clothing_icons[index] = female_clothing_icon + + return icon(female_clothing_icon) + +// These coordonates point to roughly somewhere in the middle of the left leg +// Used in approximating what color the pants of clothing should be +#define LEG_SAMPLE_X_LOWER 13 +#define LEG_SAMPLE_X_UPPER 14 + +#define LEG_SAMPLE_Y_LOWER 8 +#define LEG_SAMPLE_Y_UPPER 9 + +/// Modifies a sprite to conform to digitigrade body shapes +/proc/wear_digi_version(icon/base_icon, key, greyscale_config = /datum/greyscale_config/jumpsuit_worn_digi, greyscale_colors) + ASSERT(key, "wear_digi_version: no key passed") + ASSERT(ispath(greyscale_config, /datum/greyscale_config), "wear_digi_version: greyscale_config is not a valid path (got: [greyscale_config])") + // items with greyscale colors containing multiple colors are invalid + if(isnull(greyscale_colors) || length(SSgreyscale.ParseColorString(greyscale_colors)) > 1) + var/pant_color + // approximates the color of the pants by sampling a few pixels in the middle of the left leg + for(var/x in LEG_SAMPLE_X_LOWER to LEG_SAMPLE_X_UPPER) + for(var/y in LEG_SAMPLE_Y_LOWER to LEG_SAMPLE_Y_UPPER) + var/xy_color = base_icon.GetPixel(x, y) + pant_color = pant_color ? BlendRGB(pant_color, xy_color, 0.5) : xy_color + + greyscale_colors = pant_color || "#1d1d1d" // black pants always look good + + var/index = "[key]-[greyscale_config]-[greyscale_colors]" + var/static/list/digitigrade_clothing_icons = list() + var/icon/digitigrade_clothing_icon = digitigrade_clothing_icons[index] + if(!digitigrade_clothing_icon) + var/static/icon/torso_mask + if(!torso_mask) + torso_mask = icon('maplestation_modules/icons/mob/clothing/under/digi_mask.dmi', "torso_mask") + var/static/icon/leg_mask + if(!leg_mask) + leg_mask = icon('maplestation_modules/icons/mob/clothing/under/digi_mask.dmi', "leg_mask") + + base_icon.Blend(leg_mask, ICON_SUBTRACT) // cuts the legs off + + var/icon/leg_icon = SSgreyscale.GetColoredIconByType(greyscale_config, greyscale_colors) + leg_icon.Blend(torso_mask, ICON_SUBTRACT) // cuts the torso off + + base_icon.Blend(leg_icon, ICON_OVERLAY) // puts the new legs on + + digitigrade_clothing_icon = fcopy_rsc(base_icon) + digitigrade_clothing_icons[index] = digitigrade_clothing_icon + + return icon(digitigrade_clothing_icon) + +#undef LEG_SAMPLE_X_LOWER +#undef LEG_SAMPLE_X_UPPER + +#undef LEG_SAMPLE_Y_LOWER +#undef LEG_SAMPLE_Y_UPPER /mob/living/carbon/human/proc/get_overlays_copy(list/unwantedLayers) var/list/out = new @@ -658,20 +718,37 @@ generate/load female uniform sprites matching all previously decided variables override_file = null, ) - // NON-MODULE CHANGE // UPSTREAM ME //Find a valid icon_state from variables+arguments var/t_state = override_state || (isinhands ? inhand_icon_state : worn_icon_state) || icon_state //Find a valid icon file from variables+arguments var/file2use = override_file || (isinhands ? null : worn_icon) || default_icon_file //Find a valid layer from variables+arguments var/layer2use = alternate_worn_layer || default_layer - // NON-MODULE CHANGE END - var/mutable_appearance/standing + var/mob/living/carbon/wearer = loc + var/is_digi = istype(wearer) && (wearer.bodytype & BODYTYPE_DIGITIGRADE) && !wearer.is_digitigrade_squished() + + var/mutable_appearance/standing // this is the actual resulting MA + var/icon/building_icon // used to construct an icon across multiple procs before converting it to MA if(female_uniform) - standing = wear_female_version(t_state, file2use, layer2use, female_uniform, greyscale_colors) //should layer2use be in sync with the adjusted value below? needs testing - shiz - if(!standing) - standing = mutable_appearance(file2use, t_state, -layer2use) + building_icon = wear_female_version( + icon_state = t_state, + icon = file2use, + type = female_uniform, + greyscale_colors = greyscale_colors, + ) + if(!isinhands && is_digi && (supports_variations_flags & CLOTHING_DIGITIGRADE_MASK)) + building_icon = wear_digi_version( + base_icon = building_icon || icon(file2use, t_state), + key = "[t_state]-[file2use]-[female_uniform]", + greyscale_config = digitigrade_greyscale_config_worn || greyscale_config_worn, + greyscale_colors = digitigrade_greyscale_colors || greyscale_colors || color, + ) + if(building_icon) + standing = mutable_appearance(building_icon, layer = -layer2use) + + // no special handling done, default it + standing ||= mutable_appearance(file2use, t_state, layer = -layer2use) //Get the overlays for this item when it's being worn //eg: ammo counters, primed grenade flashes, etc. @@ -681,7 +758,7 @@ generate/load female uniform sprites matching all previously decided variables standing = center_image(standing, isinhands ? inhand_x_dimension : worn_x_dimension, isinhands ? inhand_y_dimension : worn_y_dimension) - if(!isinhands && (supports_variations_flags & CLOTHING_DIGITIGRADE_FILTER)) + if(!isinhands && is_digi && (supports_variations_flags & CLOTHING_DIGITIGRADE_FILTER)) apply_digitigrade_filters(standing) //Worn offsets diff --git a/code/modules/surgery/bodyparts/species_parts/lizard_bodyparts.dm b/code/modules/surgery/bodyparts/species_parts/lizard_bodyparts.dm index c389537d156f..e678135f7c33 100644 --- a/code/modules/surgery/bodyparts/species_parts/lizard_bodyparts.dm +++ b/code/modules/surgery/bodyparts/species_parts/lizard_bodyparts.dm @@ -70,7 +70,13 @@ /obj/item/bodypart/leg/left/digitigrade/update_limb(dropping_limb = FALSE, is_creating = FALSE) . = ..() - limb_id = owner.is_digitigrade_squished() ? SPECIES_LIZARD : BODYPART_ID_DIGITIGRADE + var/old_id = limb_id + limb_id = owner?.is_digitigrade_squished() ? SPECIES_LIZARD : BODYPART_ID_DIGITIGRADE + if(old_id != limb_id) + // Something unsquished / squished us so we need to go through and update everything that is affected + for(var/obj/item/thing as anything in owner?.get_equipped_items()) + if(thing.supports_variations_flags & DIGITIGRADE_VARIATIONS) + thing.update_slot_icon() /obj/item/bodypart/leg/right/digitigrade icon_greyscale = 'icons/mob/human/species/lizard/bodyparts.dmi' @@ -80,4 +86,10 @@ /obj/item/bodypart/leg/right/digitigrade/update_limb(dropping_limb = FALSE, is_creating = FALSE) . = ..() - limb_id = owner.is_digitigrade_squished() ? SPECIES_LIZARD : BODYPART_ID_DIGITIGRADE + var/old_id = limb_id + limb_id = owner?.is_digitigrade_squished() ? SPECIES_LIZARD : BODYPART_ID_DIGITIGRADE + if(old_id != limb_id) + // Something unsquished / squished us so we need to go through and update everything that is affected + for(var/obj/item/thing as anything in owner?.get_equipped_items()) + if(thing.supports_variations_flags & DIGITIGRADE_VARIATIONS) + thing.update_slot_icon() diff --git a/code/modules/unit_tests/screenshots/screenshot_humanoids__datum_species_lizard_ashwalker.png b/code/modules/unit_tests/screenshots/screenshot_humanoids__datum_species_lizard_ashwalker.png index 4329e0e0a0db..3437280e851b 100644 Binary files a/code/modules/unit_tests/screenshots/screenshot_humanoids__datum_species_lizard_ashwalker.png and b/code/modules/unit_tests/screenshots/screenshot_humanoids__datum_species_lizard_ashwalker.png differ diff --git a/code/modules/unit_tests/screenshots/screenshot_humanoids__datum_species_monkey_lizard.png b/code/modules/unit_tests/screenshots/screenshot_humanoids__datum_species_monkey_lizard.png index 581daeed9c69..97b765d47dfd 100644 Binary files a/code/modules/unit_tests/screenshots/screenshot_humanoids__datum_species_monkey_lizard.png and b/code/modules/unit_tests/screenshots/screenshot_humanoids__datum_species_monkey_lizard.png differ diff --git a/maplestation_modules/code/datums/greyscale/_greyscale_config.dm b/maplestation_modules/code/datums/greyscale/_greyscale_config.dm index 3d6fa4a52fe8..d1de9c485b48 100644 --- a/maplestation_modules/code/datums/greyscale/_greyscale_config.dm +++ b/maplestation_modules/code/datums/greyscale/_greyscale_config.dm @@ -25,15 +25,10 @@ /datum/greyscale_config/tablet/stripe_two_color json_config = 'code/datums/greyscale/json_configs/_pda_stripe_two_color.json' -// /datum/greyscale_config/jumpsuit_worn_digi -// name = "Digitigrate Jumpsuit Worn" -// icon_file = 'maplestation_modules/icons/mob/clothing/under/digi_under.dmi' -// json_config = 'code/datums/greyscale/json_configs/jumpsuit_worn.json' - -// /datum/greyscale_config/jumpsuit_prison_worn_digi -// name = "Digitigrade Prison Jumpsuit Worn" -// icon_file = 'maplestation_modules/icons/mob/clothing/under/digi_under.dmi' -// json_config = 'code/datums/greyscale/json_configs/jumpsuit_prison_worn.json' +/datum/greyscale_config/jumpsuit_worn_digi + name = "Digitigrate Jumpsuit Worn" + icon_file = 'maplestation_modules/icons/mob/clothing/under/digi_gags.dmi' + json_config = 'code/datums/greyscale/json_configs/_jumpsuit_worn_digi.json' /datum/greyscale_config/heels name = "Heels" @@ -47,7 +42,7 @@ /datum/greyscale_config/spacer_turtleneck name = "Spacer's Turtleneck" - icon_file = 'maplestation_modules/icons/mob/clothing/under/spacer_turtleneck.dmi' + icon_file = 'maplestation_modules/icons/obj/clothing/under/spacer_turtleneck.dmi' json_config = 'code/datums/greyscale/json_configs/spacer_turtleneck.json' /datum/greyscale_config/spacer_turtleneck_worn diff --git a/maplestation_modules/code/modules/clothing/digi_clothing.dm b/maplestation_modules/code/modules/clothing/digi_clothing.dm index 55aad88b02b6..c890f868a3b6 100644 --- a/maplestation_modules/code/modules/clothing/digi_clothing.dm +++ b/maplestation_modules/code/modules/clothing/digi_clothing.dm @@ -4,3 +4,5 @@ var/digitigrade_file /// Greyscale config for this worn on digi lizards var/digitigrade_greyscale_config_worn + /// Greyscale colors for this worn on digi lizards + var/digitigrade_greyscale_colors diff --git a/maplestation_modules/code/modules/clothing/under/digi_under.dm b/maplestation_modules/code/modules/clothing/under/digi_under.dm index 9cd8b14b49e5..e4768cbfa863 100644 --- a/maplestation_modules/code/modules/clothing/under/digi_under.dm +++ b/maplestation_modules/code/modules/clothing/under/digi_under.dm @@ -1,6 +1,22 @@ // Don't ask my why I tested these +/obj/item/clothing/under + supports_variations_flags = CLOTHING_DIGITIGRADE_MASK + digitigrade_greyscale_config_worn = /datum/greyscale_config/jumpsuit_worn_digi + /obj/item/clothing/under/rank/civilian/janitor/maid supports_variations_flags = CLOTHING_DIGITIGRADE_VARIATION_NO_NEW_ICON /obj/item/clothing/under/costume/maid supports_variations_flags = CLOTHING_DIGITIGRADE_FILTER + +/obj/item/clothing/under/rank/engineering/engineer + digitigrade_greyscale_colors = "#DEB63E" + +/obj/item/clothing/under/misc/psyche + digitigrade_greyscale_colors = "#3f3f3f" + +/obj/item/clothing/under/color/rainbow + digitigrade_greyscale_colors = "#3f3f3f" + +/obj/item/clothing/under/spacer_turtleneck + digitigrade_greyscale_colors = "#5e483c" diff --git a/maplestation_modules/icons/mob/clothing/under/digi_gags.dmi b/maplestation_modules/icons/mob/clothing/under/digi_gags.dmi new file mode 100644 index 000000000000..0c9db80eb1c8 Binary files /dev/null and b/maplestation_modules/icons/mob/clothing/under/digi_gags.dmi differ diff --git a/maplestation_modules/icons/mob/clothing/under/digi_mask.dmi b/maplestation_modules/icons/mob/clothing/under/digi_mask.dmi new file mode 100644 index 000000000000..19f7e9a18fa7 Binary files /dev/null and b/maplestation_modules/icons/mob/clothing/under/digi_mask.dmi differ