Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TG Mirror] Added a larger afro hairstyle [MDB IGNORE] #80

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions code/datums/sprite_accessories.dm
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
//////////////////////
/datum/sprite_accessory/hair
icon = 'icons/mob/human/human_face.dmi' // default icon for all hairs
var/y_offset = 0 // Y offset to apply so we can have hair that reaches above the player sprite's visual bounding box

// please make sure they're sorted alphabetically and, where needed, categorized
// try to capitalize the names please~
Expand All @@ -103,6 +104,11 @@
name = "Afro (Large)"
icon_state = "hair_bigafro"

/datum/sprite_accessory/hair/afro_huge
name = "Afro (Huge)"
icon_state = "hair_hugeafro"
y_offset = 6

/datum/sprite_accessory/hair/allthefuzz
name = "All The Fuzz"
icon_state = "hair_allthefuzz"
Expand Down
9 changes: 6 additions & 3 deletions code/modules/client/preferences/species_features/basic.dm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/proc/generate_icon_with_head_accessory(datum/sprite_accessory/sprite_accessory)
/proc/generate_icon_with_head_accessory(datum/sprite_accessory/sprite_accessory, y_offset = 0)
var/static/icon/head_icon
if (isnull(head_icon))
head_icon = icon('icons/mob/human/bodyparts_greyscale.dmi', "human_head_m")
Expand All @@ -7,8 +7,10 @@
var/icon/final_icon = new(head_icon)
if (!isnull(sprite_accessory))
ASSERT(istype(sprite_accessory))

var/icon/head_accessory_icon = icon(sprite_accessory.icon, sprite_accessory.icon_state)
if(y_offset)
head_accessory_icon.Shift(NORTH, y_offset)
head_accessory_icon.Blend(COLOR_DARK_BROWN, ICON_MULTIPLY)
final_icon.Blend(head_accessory_icon, ICON_OVERLAY)

Expand Down Expand Up @@ -138,7 +140,8 @@
return assoc_to_keys_features(GLOB.hairstyles_list)

/datum/preference/choiced/hairstyle/icon_for(value)
return generate_icon_with_head_accessory(GLOB.hairstyles_list[value])
var/datum/sprite_accessory/hair/hairstyle = GLOB.hairstyles_list[value]
return generate_icon_with_head_accessory(hairstyle, hairstyle?.y_offset)

/datum/preference/choiced/hairstyle/apply_to_human(mob/living/carbon/human/target, value)
target.set_hairstyle(value, update = FALSE)
Expand Down
5 changes: 3 additions & 2 deletions code/modules/clothing/head/wig.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
item_flags &= ~EXAMINE_SKIP

/obj/item/clothing/head/wig/update_icon_state()
var/datum/sprite_accessory/hair_style = GLOB.hairstyles_list[hairstyle]
var/datum/sprite_accessory/hair/hair_style = GLOB.hairstyles_list[hairstyle]
if(hair_style)
icon = hair_style.icon
icon_state = hair_style.icon_state
Expand All @@ -37,12 +37,13 @@
if(isinhands)
return

var/datum/sprite_accessory/hair = GLOB.hairstyles_list[hairstyle]
var/datum/sprite_accessory/hair/hair = GLOB.hairstyles_list[hairstyle]
if(!hair)
return

var/mutable_appearance/hair_overlay = mutable_appearance(hair.icon, hair.icon_state, layer = -HAIR_LAYER, appearance_flags = RESET_COLOR)
hair_overlay.color = color
hair_overlay.pixel_y = hair.y_offset
. += hair_overlay

// So that the wig actually blocks emissives.
Expand Down
6 changes: 3 additions & 3 deletions code/modules/mob/dead/observer/observer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -219,22 +219,22 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER)
setDir(2 )//reset the dir to its default so the sprites all properly align up

if(ghost_accs == GHOST_ACCS_FULL && (icon_state in GLOB.ghost_forms_with_accessories_list)) //check if this form supports accessories and if the client wants to show them
var/datum/sprite_accessory/S
if(facial_hairstyle)
S = GLOB.facial_hairstyles_list[facial_hairstyle]
var/datum/sprite_accessory/S = GLOB.facial_hairstyles_list[facial_hairstyle]
if(S)
facial_hair_overlay = mutable_appearance(S.icon, "[S.icon_state]", -HAIR_LAYER)
if(facial_hair_color)
facial_hair_overlay.color = facial_hair_color
facial_hair_overlay.alpha = 200
add_overlay(facial_hair_overlay)
if(hairstyle)
S = GLOB.hairstyles_list[hairstyle]
var/datum/sprite_accessory/hair/S = GLOB.hairstyles_list[hairstyle]
if(S)
hair_overlay = mutable_appearance(S.icon, "[S.icon_state]", -HAIR_LAYER)
if(hair_color)
hair_overlay.color = hair_color
hair_overlay.alpha = 200
hair_overlay.pixel_y = S.y_offset
add_overlay(hair_overlay)

/*
Expand Down
3 changes: 2 additions & 1 deletion code/modules/mob/living/basic/space_fauna/ghost.dm
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,11 @@
ghost_facial_hair_color = ghost_hair_color

if(!isnull(ghost_hairstyle) && ghost_hairstyle != "Bald") //Bald hairstyle and the Shaved facial hairstyle lack an associated sprite and will not properly generate hair, and just cause runtimes.
var/datum/sprite_accessory/hair_style = GLOB.hairstyles_list[ghost_hairstyle] //We use the hairstyle name to get the sprite accessory, which we copy the icon_state from.
var/datum/sprite_accessory/hair/hair_style = GLOB.hairstyles_list[ghost_hairstyle] //We use the hairstyle name to get the sprite accessory, which we copy the icon_state from.
ghost_hair = mutable_appearance('icons/mob/human/human_face.dmi', "[hair_style.icon_state]", -HAIR_LAYER)
ghost_hair.alpha = 200
ghost_hair.color = ghost_hair_color
ghost_hair.pixel_y = hair_style.y_offset
add_overlay(ghost_hair)

if(!isnull(ghost_facial_hairstyle) && ghost_facial_hairstyle != "Shaved")
Expand Down
4 changes: 2 additions & 2 deletions code/modules/surgery/bodyparts/_bodyparts.dm
Original file line number Diff line number Diff line change
Expand Up @@ -969,8 +969,8 @@
icon_state = initial(icon_state)//no overlays found, we default back to initial icon.
return
for(var/image/img as anything in standing)
img.pixel_x = px_x
img.pixel_y = px_y
img.pixel_x += px_x
img.pixel_y += px_y
add_overlay(standing)

///Generates an /image for the limb to be used as an overlay
Expand Down
10 changes: 6 additions & 4 deletions code/modules/surgery/bodyparts/head_hair_and_lips.dm
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,12 @@

var/image/hair_overlay
if(!(show_debrained && (head_flags & HEAD_DEBRAIN)) && !hair_hidden && hairstyle && (head_flags & HEAD_HAIR))
sprite_accessory = GLOB.hairstyles_list[hairstyle]
if(sprite_accessory)
var/datum/sprite_accessory/hair/hair_sprite_accessory = GLOB.hairstyles_list[hairstyle]
if(hair_sprite_accessory)
//Overlay
hair_overlay = image(sprite_accessory.icon, sprite_accessory.icon_state, -HAIR_LAYER, image_dir)
hair_overlay = image(hair_sprite_accessory.icon, hair_sprite_accessory.icon_state, -HAIR_LAYER, image_dir)
hair_overlay.alpha = hair_alpha
hair_overlay.pixel_y = hair_sprite_accessory.y_offset
//Emissive blocker
if(blocks_emissive != EMISSIVE_BLOCK_NONE)
hair_overlay.overlays += emissive_blocker(hair_overlay.icon, hair_overlay.icon_state, location, alpha = hair_alpha)
Expand All @@ -139,12 +140,13 @@
var/hair_gradient_style = LAZYACCESS(gradient_styles, GRADIENT_HAIR_KEY)
if(hair_gradient_style)
var/hair_gradient_color = LAZYACCESS(gradient_colors, GRADIENT_HAIR_KEY)
var/image/hair_gradient_overlay = get_gradient_overlay(sprite_accessory.icon, sprite_accessory.icon_state, -HAIR_LAYER, GLOB.hair_gradients_list[hair_gradient_style], hair_gradient_color)
var/image/hair_gradient_overlay = get_gradient_overlay(hair_sprite_accessory.icon, hair_sprite_accessory.icon_state, -HAIR_LAYER, GLOB.hair_gradients_list[hair_gradient_style], hair_gradient_color)
// SKYRAT ADD - Hair offset
if(LAZYFIND(owner?.dna?.species?.offset_features, OFFSET_HAIR))
hair_gradient_overlay.pixel_x = owner.dna.species.offset_features[OFFSET_HAIR][INDEX_X]
hair_gradient_overlay.pixel_y = owner.dna.species.offset_features[OFFSET_HAIR][INDEX_Y]
// SKYRAT ADD END

. += hair_gradient_overlay

if(show_debrained && (head_flags & HEAD_DEBRAIN))
Expand Down
Binary file modified icons/mob/human/human_face.dmi
Binary file not shown.
Loading