Skip to content

Commit

Permalink
Upstream species fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Nlaysi committed Jan 19, 2025
1 parent 69292cb commit a86be67
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 14 deletions.
21 changes: 21 additions & 0 deletions code/modules/mob/living/carbon/human/_species.dm
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,9 @@ GLOBAL_LIST_EMPTY(features_by_species)
species_human.overlays_standing[BODY_LAYER] = standing

species_human.apply_overlay(BODY_LAYER)
// BANDASTATION EDIT START - Удалить после фикса на апстриме
update_body_markings(species_human)
// BANDASTATION EDIT STOP

//This exists so sprite accessories can still be per-layer without having to include that layer's
//number in their sprite name, which causes issues when those numbers change.
Expand Down Expand Up @@ -2034,6 +2037,24 @@ GLOBAL_LIST_EMPTY(features_by_species)

qdel(markings)

// BANDASTATION EDIT START - Удалить после фикса на апстриме
/datum/species/proc/update_body_markings(mob/living/carbon/human/hooman)
if(HAS_TRAIT(hooman, TRAIT_INVISIBLE_MAN))
remove_body_markings(hooman)
return

var/needs_update = FALSE
for(var/datum/bodypart_overlay/simple/body_marking/marking as anything in body_markings)
if(initial(marking.dna_feature_key) == body_markings[marking]) // dna is same as our species (sort of mini-cache), so no update needed
continue
needs_update = TRUE
break

if(needs_update)
remove_body_markings(hooman)
add_body_markings(hooman)
// BANDASTATION EDIT STOP

/// Remove body markings
/datum/species/proc/remove_body_markings(mob/living/carbon/human/hooman)
for(var/obj/item/bodypart/part as anything in hooman.bodyparts)
Expand Down
19 changes: 5 additions & 14 deletions modular_bandastation/species/code/human/species_type/vulpkanin.dm
Original file line number Diff line number Diff line change
Expand Up @@ -214,29 +214,20 @@
/datum/species/vulpkanin/add_body_markings(mob/living/carbon/human/vulp) // OVERRIDE /datum/species/proc/add_body_markings
for(var/markings_type in body_markings)
var/datum/bodypart_overlay/simple/body_marking/markings = new markings_type()
var/accessory_name = vulp.dna.features[markings.dna_feature_key]
var/datum/sprite_accessory/vulpkanin_body_markings/accessory = markings.get_accessory(accessory_name)

if(isnull(accessory))
return

var/accessory_name = vulp.dna.features[markings.dna_feature_key] || body_markings[markings_type]
var/datum/sprite_accessory/vulpkanin_body_markings/accessory = markings.get_accessory(accessory_name)
for(var/obj/item/bodypart/part as anything in markings.applies_to)
var/obj/item/bodypart/people_part = vulp.get_bodypart(initial(part.body_zone))

if(!people_part || !istype(people_part, part))
if(isnull(people_part) || !istype(people_part, part))
continue

var/datum/bodypart_overlay/simple/body_marking/vulpkanin/overlay = new markings_type()

overlay.icon = accessory.icon
overlay.icon_state = accessory.icon_state
overlay.use_gender = accessory.gender_specific
overlay.draw_color = accessory.color_src ? vulp.dna.features["furcolor_first"] : null

if(istype(accessory, /datum/sprite_accessory/vulpkanin_body_markings) && accessory.colored_paws && (istype(people_part, /obj/item/bodypart/arm/left/vulpkanin) || istype(people_part, /obj/item/bodypart/arm/right/vulpkanin)))
overlay.aux_color_paw = accessory.color_src ? vulp.dna.features["furcolor_first"] : null
overlay.set_appearance(accessory_name, vulp.dna.features["furcolor_first"], people_part)

people_part.add_bodypart_overlay(overlay)
qdel(markings)

/obj/item/bodypart/head/get_hair_and_lips_icon(dropped)
. = ..()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,29 @@
a.color = aux_color_paw
return

/datum/bodypart_overlay/simple/body_marking/vulpkanin/set_appearance(name, set_color, bodypart)
var/datum/sprite_accessory/vulpkanin_body_markings/accessory = get_accessory(name)
if(isnull(accessory))
return

icon = accessory.icon
icon_state = accessory.icon_state
use_gender = accessory.gender_specific
draw_color = accessory.color_src ? set_color : null

if(istype(accessory, /datum/sprite_accessory/vulpkanin_body_markings) && accessory.colored_paws && (istype(bodypart, /obj/item/bodypart/arm/left/vulpkanin) || istype(bodypart, /obj/item/bodypart/arm/right/vulpkanin)))
aux_color_paw = accessory.color_src ? set_color : null

cache_key = jointext(generate_icon_cache(), "_")

/datum/bodypart_overlay/simple/body_marking/vulpkanin/generate_icon_cache()
. = ..()
. += use_gender
. += draw_color

/datum/bodypart_overlay/simple/body_marking/vulpkanin/can_draw_on_bodypart(mob/living/carbon/human/human)
return icon_state != SPRITE_ACCESSORY_NONE

/datum/sprite_accessory/vulpkanin_body_markings
icon = 'modular_bandastation/species/icons/mob/species/vulpkanin/sprite_accessories/body_markings.dmi'
name = "None"
Expand Down

0 comments on commit a86be67

Please sign in to comment.