Skip to content

Commit

Permalink
Improve mob overlay handling, add teshari damage/bloody sprites (#446)
Browse files Browse the repository at this point in the history
* move files around, improve code

* big icon logic cleanup
  • Loading branch information
Kapu1178 authored Jul 31, 2023
1 parent fa3e4c9 commit 6431700
Show file tree
Hide file tree
Showing 44 changed files with 204 additions and 113 deletions.
19 changes: 19 additions & 0 deletions code/__HELPERS/icons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1421,3 +1421,22 @@ GLOBAL_LIST_EMPTY(transformation_animation_objects)
temp.Blend(color, ICON_MULTIPLY)
local.Insert(temp, initial(name))
fcopy(local, "data/saved_icons.dmi")

/// This exists purely to import sprites from a codebase like Citadel RP.
/proc/pull_apart_damage_states(damage_states_file, species)
if(!fexists("data/saved_icons.dmi"))
fcopy("", "data/saved_icons.dmi")
var/mob/living/carbon/human/human = new()
human.set_species(species)
var/icon/local = icon("data/saved_icons.dmi")
for(var/obj/item/bodypart/BP as anything in human.bodyparts)
for(var/state in list("10", "20", "30", "01", "02", "03"))
var/icon/masked_icon = icon(damage_states_file, state)
var/icon/masker = UNLINT(icon(BP.icon_greyscale, BP.is_dimorphic ? "[BP.limb_id]_[BP.body_zone]_[BP.limb_gender]" : "[BP.limb_id]_[BP.body_zone]"))
masker.Blend("#FFFFFF")
masker.BecomeAlphaMask()
masked_icon.AddAlphaMask(masker)
masked_icon.Blend("#950A0A", ICON_MULTIPLY)
UNLINT(local.Insert(masked_icon, "[BP.body_zone]_[state]"))

fcopy(local, "data/saved_icons.dmi")
9 changes: 5 additions & 4 deletions code/datums/components/bloodysoles.dm
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,6 @@
parent_atom = parent
wielder = parent

if(!bloody_feet)
bloody_feet = mutable_appearance('icons/effects/blood.dmi', "shoeblood", SHOES_LAYER)

RegisterSignal(parent, COMSIG_COMPONENT_CLEAN_ACT, PROC_REF(on_clean))
RegisterSignal(parent, COMSIG_STEP_ON_BLOOD, PROC_REF(on_step_blood))
RegisterSignal(parent, COMSIG_CARBON_UNEQUIP_SHOECOVER, PROC_REF(unequip_shoecover))
Expand All @@ -267,9 +264,13 @@
var/mob/living/carbon/human/human = wielder
if(NOBLOODOVERLAY in human.dna.species.species_traits)
return
var/obj/item/bodypart/leg = human.get_bodypart(BODY_ZONE_R_LEG) || human.get_bodypart(BODY_ZONE_L_LEG)
if(!leg?.icon_bloodycover)
return

if(bloody_shoes[BLOOD_STATE_HUMAN] > 0 && !is_obscured())
human.remove_overlay(SHOES_LAYER)
human.overlays_standing[SHOES_LAYER] = bloody_feet
human.overlays_standing[SHOES_LAYER] = image(leg.icon_bloodycover, "shoeblood")
human.apply_overlay(SHOES_LAYER)
else
human.update_worn_shoes()
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/holy_weapons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@
/// The icon which appears over the mob holding the item
var/shield_icon = "shield-red"

/obj/item/nullrod/staff/worn_overlays(mutable_appearance/standing, isinhands)
/obj/item/nullrod/staff/worn_overlays(mob/living/carbon/human/wearer, mutable_appearance/standing, isinhands)
. = ..()
if(isinhands)
. += mutable_appearance('icons/effects/effects.dmi', shield_icon, MOB_SHIELD_LAYER)
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/items/stacks/tiles/tile_types.dm
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@
. += neon_overlay
. += emissive_appearance(neon_icon || icon, neon_icon_state || icon_state, alpha = emissive_alpha)

/obj/item/stack/tile/carpet/neon/worn_overlays(mutable_appearance/standing, isinhands, icon_file)
/obj/item/stack/tile/carpet/neon/worn_overlays(mob/living/carbon/human/wearer, mutable_appearance/standing, isinhands, icon_file)
. = ..()
if(!isinhands || !neon_inhand_icon_state)
return
Expand Down Expand Up @@ -1146,7 +1146,7 @@
. = ..()
. += emissive_appearance(icon, icon_state, alpha = alpha)

/obj/item/stack/tile/emissive_test/worn_overlays(mutable_appearance/standing, isinhands, icon_file)
/obj/item/stack/tile/emissive_test/worn_overlays(mob/living/carbon/human/wearer, mutable_appearance/standing, isinhands, icon_file)
. = ..()
. += emissive_appearance(standing.icon, standing.icon_state, alpha = standing.alpha)

Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/tanks/watertank.dm
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@
turn_on()

//Todo : cache these.
/obj/item/reagent_containers/chemtank/worn_overlays(mutable_appearance/standing, isinhands = FALSE) //apply chemcolor and level
/obj/item/reagent_containers/chemtank/worn_overlays(mob/living/carbon/human/wearer, mutable_appearance/standing, isinhands = FALSE) //apply chemcolor and level
. = ..()
//inhands + reagent_filling
if(isinhands || !reagents.total_volume)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/clothing/glasses/_glasses.dm
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@
add_atom_colour(user.eye_color_left, FIXED_COLOUR_PRIORITY) // I want this to be an average of the colors of both eyes, but that can be done later
colored_before = TRUE

/obj/item/clothing/glasses/blindfold/white/worn_overlays(mutable_appearance/standing, isinhands = FALSE, file2use)
/obj/item/clothing/glasses/blindfold/white/worn_overlays(mob/living/carbon/human/wearer, mutable_appearance/standing, isinhands = FALSE, file2use)
. = ..()
if(isinhands || !ishuman(loc) || colored_before)
return
Expand Down
10 changes: 8 additions & 2 deletions code/modules/clothing/gloves/_gloves.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,21 @@
user.visible_message(span_suicide("\the [src] are forcing [user]'s hands around [user.p_their()] neck! It looks like the gloves are possessed!"))
return OXYLOSS

/obj/item/clothing/gloves/worn_overlays(mutable_appearance/standing, isinhands = FALSE)
/obj/item/clothing/gloves/worn_overlays(mob/living/carbon/human/wearer, mutable_appearance/standing, isinhands = FALSE)
. = ..()
if(!isinhands)
return

if(damaged_clothes)
. += mutable_appearance('icons/effects/item_damage.dmi', "damagedgloves")
if(HAS_BLOOD_DNA(src))
. += mutable_appearance('icons/effects/blood.dmi', "bloodyhands")
if(istype(wearer))
var/obj/item/bodypart/arm = wearer.get_bodypart(BODY_ZONE_R_ARM) || wearer.get_bodypart(BODY_ZONE_L_ARM)
if(!arm?.icon_bloodycover)
return
. += image(arm.icon_bloodycover, "bloodyhands")
else
. += mutable_appearance('icons/effects/blood.dmi', "bloodyhands")

/obj/item/clothing/gloves/update_clothes_damaged_state(damaged_state = CLOTHING_DAMAGED)
..()
Expand Down
14 changes: 10 additions & 4 deletions code/modules/clothing/head/_head.dm
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,24 @@



/obj/item/clothing/head/worn_overlays(mutable_appearance/standing, isinhands = FALSE)
/obj/item/clothing/head/worn_overlays(mob/living/carbon/human/wearer, mutable_appearance/standing, isinhands = FALSE)
. = ..()
if(isinhands)
return

if(damaged_clothes)
. += mutable_appearance('icons/effects/item_damage.dmi', "damagedhelmet")
if(HAS_BLOOD_DNA(src))
if(clothing_flags & LARGE_WORN_ICON)
. += mutable_appearance('icons/effects/64x64.dmi', "helmetblood_large")
if(istype(wearer))
var/obj/item/bodypart/head = wearer.get_bodypart(BODY_ZONE_HEAD)
if(!head?.icon_bloodycover)
return
. += image(head.icon_bloodycover, "helmetblood")
else
. += mutable_appearance('icons/effects/blood.dmi', "helmetblood")
if(clothing_flags & LARGE_WORN_ICON)
. += mutable_appearance('icons/effects/64x64.dmi', "helmetblood_large")
else
. += mutable_appearance('icons/effects/blood.dmi', "helmetblood")

/obj/item/clothing/head/update_clothes_damaged_state(damaged_state = CLOTHING_DAMAGED)
..()
Expand Down
2 changes: 1 addition & 1 deletion code/modules/clothing/head/cone.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
supports_variations_flags = CLOTHING_TESHARI_VARIATION | CLOTHING_VOX_VARIATION


/obj/item/clothing/head/cone/worn_overlays(mutable_appearance/standing, isinhands, icon_file)
/obj/item/clothing/head/cone/worn_overlays(mob/living/carbon/human/wearer, mutable_appearance/standing, isinhands, icon_file)
. = ..()
if(!isinhands)
. += emissive_appearance(icon_file, "[icon_state]-emissive", alpha = src.alpha)
Expand Down
6 changes: 3 additions & 3 deletions code/modules/clothing/head/hardhat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
min_cold_protection_temperature = FIRE_HELM_MIN_TEMP_PROTECT
flags_cover = HEADCOVERSEYES | HEADCOVERSMOUTH | PEPPERPROOF

/obj/item/clothing/head/hardhat/atmos/worn_overlays(mutable_appearance/standing, isinhands, icon_file)
/obj/item/clothing/head/hardhat/atmos/worn_overlays(mob/living/carbon/human/wearer, mutable_appearance/standing, isinhands, icon_file)
. = ..()
if(!isinhands)
. += emissive_appearance(icon_file, "[icon_state]-emissive", alpha = src.alpha)
Expand Down Expand Up @@ -149,7 +149,7 @@
playsound(src, 'sound/mecha/mechmove03.ogg', 50, TRUE) //Visors don't just come from nothing
update_appearance()

/obj/item/clothing/head/hardhat/weldhat/worn_overlays(mutable_appearance/standing, isinhands)
/obj/item/clothing/head/hardhat/weldhat/worn_overlays(mob/living/carbon/human/wearer, mutable_appearance/standing, isinhands)
. = ..()
if(isinhands)
return
Expand Down Expand Up @@ -211,7 +211,7 @@
if(light_on)
. += emissive_appearance(icon, "carved_pumpkin-emissive", alpha = src.alpha)

/obj/item/clothing/head/hardhat/pumpkinhead/worn_overlays(mutable_appearance/standing, isinhands, icon_file)
/obj/item/clothing/head/hardhat/pumpkinhead/worn_overlays(mob/living/carbon/human/wearer, mutable_appearance/standing, isinhands, icon_file)
. = ..()
if(light_on && !isinhands)
. += emissive_appearance(icon_file, "carved_pumpkin-emissive", alpha = src.alpha)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/clothing/head/wig.dm
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
return ..()


/obj/item/clothing/head/wig/worn_overlays(mutable_appearance/standing, isinhands = FALSE, file2use)
/obj/item/clothing/head/wig/worn_overlays(mob/living/carbon/human/wearer, mutable_appearance/standing, isinhands = FALSE, file2use)
. = ..()
if(isinhands)
return
Expand Down
10 changes: 8 additions & 2 deletions code/modules/clothing/masks/_masks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
/obj/item/clothing/mask/proc/handle_speech()
SIGNAL_HANDLER

/obj/item/clothing/mask/worn_overlays(mutable_appearance/standing, isinhands = FALSE)
/obj/item/clothing/mask/worn_overlays(mob/living/carbon/human/wearer, mutable_appearance/standing, isinhands = FALSE)
. = ..()
if(isinhands)
return
Expand All @@ -52,7 +52,13 @@
if(damaged_clothes)
. += mutable_appearance('icons/effects/item_damage.dmi', "damagedmask")
if(HAS_BLOOD_DNA(src))
. += mutable_appearance('icons/effects/blood.dmi', "maskblood")
if(istype(wearer))
var/obj/item/bodypart/head = wearer.get_bodypart(BODY_ZONE_HEAD)
if(!head?.icon_bloodycover)
return
. += image(head.icon_bloodycover, "maskblood")
else
. += mutable_appearance('icons/effects/blood.dmi', "maskblood")

/obj/item/clothing/mask/update_clothes_damaged_state(damaged_state = CLOTHING_DAMAGED)
..()
Expand Down
10 changes: 8 additions & 2 deletions code/modules/clothing/neck/_neck.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
strip_delay = 40
equip_delay_other = 40

/obj/item/clothing/neck/worn_overlays(mutable_appearance/standing, isinhands = FALSE)
/obj/item/clothing/neck/worn_overlays(mob/living/carbon/human/wearer, mutable_appearance/standing, isinhands = FALSE)
. = ..()
if(isinhands)
return
Expand All @@ -17,7 +17,13 @@
if(damaged_clothes)
. += mutable_appearance('icons/effects/item_damage.dmi', "damagedmask")
if(HAS_BLOOD_DNA(src))
. += mutable_appearance('icons/effects/blood.dmi', "maskblood")
if(istype(wearer))
var/obj/item/bodypart/head = wearer.get_bodypart(BODY_ZONE_HEAD)
if(!head?.icon_bloodycover)
return
. += image(head.icon_bloodycover, "maskblood")
else
. += mutable_appearance('icons/effects/blood.dmi', "maskblood")

/obj/item/clothing/neck/tie
name = "tie"
Expand Down
14 changes: 10 additions & 4 deletions code/modules/clothing/shoes/_shoes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,24 @@
playsound(user, 'sound/weapons/genhit2.ogg', 50, TRUE)
return(BRUTELOSS)

/obj/item/clothing/shoes/worn_overlays(mutable_appearance/standing, isinhands = FALSE)
/obj/item/clothing/shoes/worn_overlays(mob/living/carbon/human/wearer, mutable_appearance/standing, isinhands = FALSE)
. = ..()
if(isinhands)
return

if(damaged_clothes)
. += mutable_appearance('icons/effects/item_damage.dmi', "damagedshoe")
if(HAS_BLOOD_DNA(src))
if(clothing_flags & LARGE_WORN_ICON)
. += mutable_appearance('icons/effects/64x64.dmi', "shoeblood_large")
if(istype(wearer))
var/obj/item/bodypart/leg = wearer.get_bodypart(BODY_ZONE_R_LEG) || wearer.get_bodypart(BODY_ZONE_L_LEG)
if(!leg?.icon_bloodycover)
return
. += image(leg.icon_bloodycover, "shoeblood")
else
. += mutable_appearance('icons/effects/blood.dmi', "shoeblood")
if(clothing_flags & LARGE_WORN_ICON)
. += mutable_appearance('icons/effects/64x64.dmi', "shoeblood_large")
else
. += image('icons/effects/blood.dmi', "shoeblood")

/obj/item/clothing/shoes/examine(mob/user)
. = ..()
Expand Down
4 changes: 2 additions & 2 deletions code/modules/clothing/spacesuits/plasmamen.dm
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,14 @@
hitting_clothing.forceMove(src)
update_appearance()

/obj/item/clothing/head/helmet/space/plasmaman/worn_overlays(mutable_appearance/standing, isinhands)
/obj/item/clothing/head/helmet/space/plasmaman/worn_overlays(mob/living/carbon/human/wearer, mutable_appearance/standing, isinhands)
. = ..()
if(!isinhands && smile)
var/mutable_appearance/M = mutable_appearance('icons/mob/clothing/head/plasmaman_head.dmi', smile_state)
M.color = smile_color
. += M
if(!isinhands && attached_hat)
. += attached_hat.build_worn_icon(default_layer = HEAD_LAYER, default_icon_file = 'icons/mob/clothing/head.dmi')
. += attached_hat.build_worn_icon(wearer, default_layer = HEAD_LAYER, default_icon_file = 'icons/mob/clothing/head.dmi')
if(!isinhands && !up)
. += mutable_appearance('icons/mob/clothing/head/plasmaman_head.dmi', visor_icon)
else
Expand Down
10 changes: 8 additions & 2 deletions code/modules/clothing/suits/_suits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,21 @@
. = ..()
setup_shielding()

/obj/item/clothing/suit/worn_overlays(mutable_appearance/standing, isinhands = FALSE)
/obj/item/clothing/suit/worn_overlays(mob/living/carbon/human/wearer, mutable_appearance/standing, isinhands = FALSE)
. = ..()
if(isinhands)
return

if(damaged_clothes)
. += mutable_appearance('icons/effects/item_damage.dmi', "damaged[blood_overlay_type]")
if(HAS_BLOOD_DNA(src))
. += mutable_appearance('icons/effects/blood.dmi', "[blood_overlay_type]blood")
if(istype(wearer))
var/obj/item/bodypart/chest = wearer.get_bodypart(BODY_ZONE_CHEST)
if(!chest?.icon_bloodycover)
return
. += image(chest.icon_bloodycover, "[blood_overlay_type]blood")
else
. += mutable_appearance('icons/effects/blood.dmi', "[blood_overlay_type]blood")

var/mob/living/carbon/human/M = loc
if(!ishuman(M) || !M.w_uniform)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/clothing/suits/jobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
species_exception = list(/datum/species/golem)
supports_variations_flags = CLOTHING_DIGITIGRADE_VARIATION_NO_NEW_ICON | CLOTHING_TESHARI_VARIATION | CLOTHING_VOX_VARIATION

/obj/item/clothing/suit/hazardvest/worn_overlays(mutable_appearance/standing, isinhands, icon_file)
/obj/item/clothing/suit/hazardvest/worn_overlays(mob/living/carbon/human/wearer, mutable_appearance/standing, isinhands, icon_file)
. = ..()
if(!isinhands)
. += emissive_appearance(icon_file, "[icon_state]-emissive", alpha = src.alpha)
Expand Down
4 changes: 2 additions & 2 deletions code/modules/clothing/suits/utility.dm
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
equip_delay_other = 60
resistance_flags = FIRE_PROOF

/obj/item/clothing/suit/fire/worn_overlays(mutable_appearance/standing, isinhands, icon_file)
/obj/item/clothing/suit/fire/worn_overlays(mob/living/carbon/human/wearer, mutable_appearance/standing, isinhands, icon_file)
. = ..()
if(!isinhands)
. += emissive_appearance(icon_file, "[icon_state]-emissive", alpha = src.alpha)
Expand Down Expand Up @@ -158,7 +158,7 @@
. = ..()
AddElement(/datum/element/radiation_protected_clothing)

/obj/item/clothing/suit/radiation/worn_overlays(mutable_appearance/standing, isinhands, icon_file)
/obj/item/clothing/suit/radiation/worn_overlays(mob/living/carbon/human/wearer, mutable_appearance/standing, isinhands, icon_file)
. = ..()
if(!isinhands)
. += emissive_appearance(icon_file, "[icon_state]-emissive", alpha = src.alpha)
4 changes: 2 additions & 2 deletions code/modules/clothing/suits/wintercoats.dm
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@
species_exception = list(/datum/species/golem/uranium)
supports_variations_flags = NONE

/obj/item/clothing/suit/hooded/wintercoat/engineering/worn_overlays(mutable_appearance/standing, isinhands, icon_file)
/obj/item/clothing/suit/hooded/wintercoat/engineering/worn_overlays(mob/living/carbon/human/wearer, mutable_appearance/standing, isinhands, icon_file)
. = ..()
if(!isinhands)
. += emissive_appearance(icon_file, "[icon_state]-emissive", alpha = src.alpha)
Expand All @@ -356,7 +356,7 @@
armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 0, BOMB = 0, BIO = 0, FIRE = 20, ACID = 0)
zmm_flags = ZMM_MANGLE_PLANES

/obj/item/clothing/head/hooded/winterhood/engineering/worn_overlays(mutable_appearance/standing, isinhands, icon_file)
/obj/item/clothing/head/hooded/winterhood/engineering/worn_overlays(mob/living/carbon/human/wearer, mutable_appearance/standing, isinhands, icon_file)
. = ..()
if(!isinhands)
. += emissive_appearance(icon_file, "[icon_state]-emissive", alpha = src.alpha)
Expand Down
10 changes: 8 additions & 2 deletions code/modules/clothing/under/_under.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,21 @@
if(!(body_parts_covered & LEGS))
fallback_icon_state = "under_skirt"

/obj/item/clothing/under/worn_overlays(mutable_appearance/standing, isinhands = FALSE)
/obj/item/clothing/under/worn_overlays(mob/living/carbon/human/wearer, mutable_appearance/standing, isinhands = FALSE)
. = ..()
if(isinhands)
return

if(damaged_clothes)
. += mutable_appearance('icons/effects/item_damage.dmi', "damageduniform")
if(HAS_BLOOD_DNA(src))
. += mutable_appearance('icons/effects/blood.dmi', "uniformblood")
if(istype(wearer))
var/obj/item/bodypart/chest = wearer.get_bodypart(BODY_ZONE_CHEST)
if(!chest?.icon_bloodycover)
return
. += image(chest.icon_bloodycover, "uniformblood")
else
. += mutable_appearance('icons/effects/blood.dmi', "uniformblood")
if(accessory_overlay)
. += accessory_overlay

Expand Down
2 changes: 1 addition & 1 deletion code/modules/food_and_drinks/pizzabox.dm
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
tag_overlay.pixel_y = box_offset
. += tag_overlay

/obj/item/pizzabox/worn_overlays(mutable_appearance/standing, isinhands, icon_file)
/obj/item/pizzabox/worn_overlays(mob/living/carbon/human/wearer, mutable_appearance/standing, isinhands, icon_file)
. = ..()
var/current_offset = 2
if(!isinhands)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mining/equipment/kheiral_cuffs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
if(isliving(loc))
connect_kheiral_network(loc)

/obj/item/kheiral_cuffs/worn_overlays(mutable_appearance/standing, isinhands, icon_file)
/obj/item/kheiral_cuffs/worn_overlays(mob/living/carbon/human/wearer, mutable_appearance/standing, isinhands, icon_file)
. = ..()
if(!isinhands)
. += emissive_appearance(icon_file, "strandcuff_emissive", alpha = src.alpha)
Expand Down
Loading

0 comments on commit 6431700

Please sign in to comment.