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

Vox Overlay Fix & Species Overlay Framework #3599

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
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
10 changes: 7 additions & 3 deletions code/datums/components/bloodysoles.dm
Original file line number Diff line number Diff line change
Expand Up @@ -213,16 +213,20 @@ Like its parent but can be applied to carbon mobs instead of clothing items
*/

/datum/component/bloodysoles/feet
var/static/mutable_appearance/bloody_feet
var/mutable_appearance/bloody_feet

/datum/component/bloodysoles/feet/Initialize()
if(!iscarbon(parent))
return COMPONENT_INCOMPATIBLE
parent_atom = parent
wielder = parent

if(!bloody_feet)
bloody_feet = mutable_appearance('icons/effects/blood.dmi', "shoeblood", SHOES_LAYER)
var/overlay_file = 'icons/effects/blood.dmi'
var/mob/living/carbon/parent_carbon = parent_atom
var/custom_overlay_icon = parent_carbon.dna.species.custom_overlay_icon
if(custom_overlay_icon)
overlay_file = custom_overlay_icon
bloody_feet = mutable_appearance(overlay_file, "shoeblood", SHOES_LAYER)

RegisterSignal(parent, COMSIG_COMPONENT_CLEAN_ACT, PROC_REF(on_clean))
RegisterSignal(parent, COMSIG_MOVABLE_MOVED, PROC_REF(on_moved))
Expand Down
9 changes: 6 additions & 3 deletions code/datums/components/forensics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@
return
if(!length(blood_DNA))
return
if(isitem(parent))
var/obj/item/I = parent
I.AddElement(/datum/element/decal/blood, I.icon, I.icon_state, _color = get_blood_dna_color(blood_DNA))
var/obj/item/parent_item = parent
var/icon_state_adj = parent_item.icon_state
if(isbodypart(parent))//betterlimbs moment
var/obj/item/bodypart/parent_part = parent
icon_state_adj = parent_part.stored_icon_state
parent_item.AddElement(/datum/element/decal/blood, parent_item.icon, icon_state_adj, _color = get_blood_dna_color(blood_DNA))
2 changes: 1 addition & 1 deletion code/datums/dna.dm
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@
if(icon_update)
update_hair()
update_mutations_overlay()// no lizard with human hulk overlay please.

AddComponent(/datum/component/bloodysoles/feet)

/mob/proc/has_dna()
return
Expand Down
6 changes: 5 additions & 1 deletion code/datums/elements/decals/blood.dm
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,8 @@

var/atom/bloodsource = source
Detach(source)
bloodsource.AddElement(/datum/element/decal/blood, bloodsource.icon, bloodsource.icon_state, _color = get_blood_dna_color(bloodsource.return_blood_DNA()))
var/icon_state_adj = bloodsource.icon_state
if(isbodypart(source))//bettericons :D
var/obj/item/bodypart/parent_part = source
icon_state_adj = parent_part.stored_icon_state
bloodsource.AddElement(/datum/element/decal/blood, bloodsource.icon, icon_state_adj, _color = get_blood_dna_color(bloodsource.return_blood_DNA()))
42 changes: 24 additions & 18 deletions code/modules/clothing/clothing.dm
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@

var/can_be_bloody = TRUE

//Var modification - PLEASE be careful with this I know who you are and where you live
var/list/user_vars_to_edit //VARNAME = VARVALUE eg: "name" = "butts"
var/list/user_vars_remembered //Auto built by the above + dropped() + equipped()
//set during equip_to_slot, removed when taking off.
//here lies some of the most batshit insane reference code I've ever seen. Look it up in the commit history
var/datum/weakref/wearer

var/pocket_storage_component_path

Expand All @@ -46,6 +46,9 @@
/// Trait modification, lazylist of traits to add/take away, on equipment/drop in the correct slot
var/list/clothing_traits

///sets the icon path of the onmob blood overlay created by this object. syntax is "[var]blood"
var/blood_overlay_type = "uniform"

/obj/item/clothing/Initialize()
if((clothing_flags & VOICEBOX_TOGGLABLE))
actions_types += /datum/action/item_action/toggle_voice_box
Expand Down Expand Up @@ -107,22 +110,14 @@
return TRUE
return ..()

/obj/item/clothing/Destroy()
user_vars_remembered = null //Oh god somebody put REFERENCES in here? not to worry, we'll clean it up
return ..()

/obj/item/clothing/dropped(mob/user)
..()
if(!istype(user))
return
for(var/trait in clothing_traits)
REMOVE_CLOTHING_TRAIT(user, trait)
if(LAZYLEN(user_vars_remembered))
for(var/variable in user_vars_remembered)
if(variable in user.vars)
if(user.vars[variable] == user_vars_to_edit[variable]) //Is it still what we set it to? (if not we best not change it)
user.vars[variable] = user_vars_remembered[variable]
user_vars_remembered = initial(user_vars_remembered) // Effectively this sets it to null.
if(wearer?.resolve())
wearer = null

/obj/item/clothing/equipped(mob/user, slot)
..()
Expand All @@ -131,11 +126,8 @@
if(slot_flags & slot) //Was equipped to a valid slot for this item?
for(var/trait in clothing_traits)
ADD_CLOTHING_TRAIT(user, trait)
if (LAZYLEN(user_vars_to_edit))
for(var/variable in user_vars_to_edit)
if(variable in user.vars)
LAZYSET(user_vars_remembered, variable, user.vars[variable])
user.vv_edit_var(variable, user_vars_to_edit[variable])
if(!wearer?.resolve())
wearer = WEAKREF(user)

/**
* Inserts a trait (or multiple traits) into the clothing traits list
Expand Down Expand Up @@ -514,3 +506,17 @@
deconstruct(FALSE)
else
..()

///sets up the proper bloody overlay for a clothing object, using species data
/obj/item/clothing/proc/setup_blood_overlay()
var/overlay_file = 'icons/effects/blood.dmi'

var/mob/living/carbon/human/wearing = wearer?.resolve()
var/custom_overlay_icon = wearing?.dna.species.custom_overlay_icon
if(custom_overlay_icon)
overlay_file = custom_overlay_icon

var/mutable_appearance/bloody_clothing = mutable_appearance(overlay_file, "[blood_overlay_type]blood")
bloody_clothing.color = get_blood_dna_color(return_blood_DNA())

return bloody_clothing
6 changes: 3 additions & 3 deletions code/modules/clothing/gloves/_gloves.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
clothamnt = 2
greyscale_colors = list(list(10, 13), list(11, 14), list(9, 12))
greyscale_icon_state = "gloves"
blood_overlay_type = "hands"

/obj/item/clothing/gloves/wash(clean_types)
. = ..()
Expand All @@ -30,9 +31,8 @@
if(damaged_clothes)
. += mutable_appearance('icons/effects/item_damage.dmi', "damagedgloves")
if(HAS_BLOOD_DNA(src))
var/mutable_appearance/bloody_hands = mutable_appearance('icons/effects/blood.dmi', "bloodyhands")
bloody_hands.color = get_blood_dna_color(return_blood_DNA())
. += bloody_hands
. += setup_blood_overlay()


/obj/item/clothing/gloves/update_clothes_damaged_state(damaging = TRUE)
..()
Expand Down
5 changes: 2 additions & 3 deletions code/modules/clothing/head/_head.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
greyscale_icon_state = "hat"
greyscale_colors = list(list(16,26))
supports_variations = VOX_VARIATION
blood_overlay_type = "helmet"

///Special throw_impact for hats to frisbee hats at people to place them on their heads/attempt to de-hat them.
/obj/item/clothing/head/throw_impact(atom/hit_atom, datum/thrownthing/thrownthing)
Expand Down Expand Up @@ -65,9 +66,7 @@
if(damaged_clothes)
. += mutable_appearance('icons/effects/item_damage.dmi', "damagedhelmet")
if(HAS_BLOOD_DNA(src))
var/mutable_appearance/bloody_helmet = mutable_appearance('icons/effects/blood.dmi', "helmetblood")
bloody_helmet.color = get_blood_dna_color(return_blood_DNA())
. += bloody_helmet
. += setup_blood_overlay()

/obj/item/clothing/head/update_clothes_damaged_state(damaging = TRUE)
..()
Expand Down
5 changes: 2 additions & 3 deletions code/modules/clothing/masks/_masks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
var/mask_adjusted = 0
var/adjusted_flags = null
supports_variations = VOX_VARIATION | KEPORI_VARIATION
blood_overlay_type = "mask"

/obj/item/clothing/mask/attack_self(mob/user)
if((clothing_flags & VOICEBOX_TOGGLABLE))
Expand Down Expand Up @@ -38,9 +39,7 @@
if(damaged_clothes)
. += mutable_appearance('icons/effects/item_damage.dmi', "damagedmask")
if(HAS_BLOOD_DNA(src))
var/mutable_appearance/bloody_mask = mutable_appearance('icons/effects/blood.dmi', "maskblood")
bloody_mask.color = get_blood_dna_color(return_blood_DNA())
. += bloody_mask
. += setup_blood_overlay()

/obj/item/clothing/mask/update_clothes_damaged_state(damaging = TRUE)
..()
Expand Down
6 changes: 2 additions & 4 deletions code/modules/clothing/shoes/_shoes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
permeability_coefficient = 0.5
slowdown = SHOES_SLOWDOWN
strip_delay = 1 SECONDS
blood_overlay_type = "shoe"

var/offset = 0
var/equipped_before_drop = FALSE
Expand All @@ -34,10 +35,7 @@
if(damaged_clothes)
. += mutable_appearance('icons/effects/item_damage.dmi', "damagedshoe")
if(HAS_BLOOD_DNA(src))
var/mutable_appearance/bloody_shoes
bloody_shoes = mutable_appearance('icons/effects/blood.dmi', "shoeblood")
bloody_shoes.color = get_blood_dna_color(return_blood_DNA())
. += bloody_shoes
. += setup_blood_overlay()

/obj/item/clothing/shoes/examine(mob/user)
. = ..()
Expand Down
7 changes: 3 additions & 4 deletions code/modules/clothing/suits/_suits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
drop_sound = 'sound/items/handling/cloth_drop.ogg'
pickup_sound = 'sound/items/handling/cloth_pickup.ogg'
slot_flags = ITEM_SLOT_OCLOTHING
var/blood_overlay_type = "suit"
blood_overlay_type = "suit"
var/togglename = null
var/suittoggled = FALSE
pocket_storage_component_path = /datum/component/storage/concrete/pockets/exo //WS Edit - Exowear Pockets
Expand All @@ -24,9 +24,8 @@
if(damaged_clothes)
. += mutable_appearance('icons/effects/item_damage.dmi', "damageduniform")
if(HAS_BLOOD_DNA(src))
var/mutable_appearance/bloody_armor = mutable_appearance('icons/effects/blood.dmi', "[blood_overlay_type]blood")
bloody_armor.color = get_blood_dna_color(return_blood_DNA())
. += bloody_armor
. += setup_blood_overlay()

var/mob/living/carbon/human/M = loc
if(ishuman(M) && M.w_uniform)
var/obj/item/clothing/under/U = M.w_uniform
Expand Down
7 changes: 4 additions & 3 deletions code/modules/clothing/under/_under.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
clothamnt = 3
greyscale_colors = list(list(15, 17), list(10, 19), list(15, 10))
greyscale_icon_state = "under"

var/has_sensor = HAS_SENSORS // For the crew computer
var/random_sensor = TRUE
var/sensor_mode = NO_SENSORS
Expand All @@ -24,17 +25,17 @@
var/obj/item/clothing/accessory/attached_accessory
var/mutable_appearance/accessory_overlay
var/freshly_laundered = FALSE

supports_variations = VOX_VARIATION
blood_overlay_type = "uniform"

/obj/item/clothing/under/worn_overlays(isinhands = FALSE)
. = ..()
if(!isinhands)
if(damaged_clothes)
. += mutable_appearance('icons/effects/item_damage.dmi', "damageduniform")
if(HAS_BLOOD_DNA(src))
var/mutable_appearance/bloody_uniform = mutable_appearance('icons/effects/blood.dmi', "uniformblood")
bloody_uniform.color = get_blood_dna_color(return_blood_DNA())
. += bloody_uniform
. += setup_blood_overlay()
if(accessory_overlay)
. += accessory_overlay

Expand Down
1 change: 0 additions & 1 deletion code/modules/mob/living/carbon/human/human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
RegisterSignal(src, COMSIG_COMPONENT_CLEAN_FACE_ACT, PROC_REF(clean_face))
AddComponent(/datum/component/personal_crafting)
AddComponent(/datum/component/footstep, FOOTSTEP_MOB_HUMAN, 1, -6)
AddComponent(/datum/component/bloodysoles/feet)
GLOB.human_list += src

/mob/living/carbon/human/proc/setup_human_dna()
Expand Down
8 changes: 6 additions & 2 deletions code/modules/mob/living/carbon/human/inventory.dm
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@
/mob/living/carbon/human/equip_to_slot(obj/item/I, slot, initial = FALSE, redraw_mob = FALSE, swap = FALSE)
if(!..()) //a check failed or the item has already found its slot
return

if(isclothing(I))//needs to be set very early, because clothing overlays need it assigned before update_inv calls
var/obj/item/clothing/ouritem = I
ouritem.wearer = WEAKREF(src)
var/current_equip
var/not_handled = FALSE //Added in case we make this type path deeper one day
switch(slot)
Expand Down Expand Up @@ -204,7 +206,9 @@
update_inv_s_store()
else
to_chat(src, "<span class='danger'>You are trying to equip this item to an unsupported inventory slot. Report this to a coder!</span>")

if(isclothing(I))//just in case
var/obj/item/clothing/ouritem = I
ouritem.wearer = null
if (current_equip)
put_in_active_hand(current_equip)

Expand Down
3 changes: 2 additions & 1 deletion code/modules/mob/living/carbon/human/species.dm
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ GLOBAL_LIST_EMPTY(roundstart_races)
var/siemens_coeff = 1
///What kind of damage overlays (if any) appear on our species when wounded? If this is "", does not add an overlay.
var/damage_overlay_type = "human"
///for species with a unique body size(above 32x32), who need a custom icon file for overlays
var/custom_overlay_icon
///To use MUTCOLOR with a fixed color that's independent of the mcolor feature in DNA.
var/fixed_mut_color = ""
///Special mutation that can be found in the genepool exclusively in this species. Dont leave empty or changing species will be a headache
Expand Down Expand Up @@ -190,7 +192,6 @@ GLOBAL_LIST_EMPTY(roundstart_races)
///What gas does this species breathe? Used by suffocation screen alerts, most of actual gas breathing is handled by mutantlungs. See [life.dm][code/modules/mob/living/carbon/human/life.dm]
var/breathid = "o2"


//Do NOT remove by setting to null. use OR make a RESPECTIVE TRAIT (removing stomach? add the NOSTOMACH trait to your species)
//why does it work this way? because traits also disable the downsides of not having an organ, removing organs but not having the trait will make your species die
//shut up you're not my mother
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
brutemod = 1.25 //They're weak to punches
attack_type = BURN //burn bish
exotic_bloodtype = "E"
damage_overlay_type = "" //We are too cool for regular damage overlays
species_age_max = 300
species_traits = list(DYNCOLORS, EYECOLOR, HAIR, FACEHAIR)
changesource_flags = MIRROR_BADMIN | WABBAJACK | MIRROR_PRIDE | MIRROR_MAGIC | RACE_SWAP | ERT_SPAWN
Expand Down
3 changes: 3 additions & 0 deletions code/modules/mob/living/carbon/human/species_types/kepori.dm
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@

robotic_eyes = /obj/item/organ/eyes/robotic/kepori

//I'm not emotionally prepared to spend ten more hours splicing overlays together
damage_overlay_type = ""

/datum/species/kepori/New()
. = ..()
// This is in new because "[HEAD_LAYER]" etc. is NOT a constant compile-time value. For some reason.
Expand Down
3 changes: 3 additions & 0 deletions code/modules/mob/living/carbon/human/species_types/vox.dm
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@

bodytype = BODYTYPE_VOX

custom_overlay_icon = 'icons/mob/species/vox/vox_overlays.dmi'
damage_overlay_type = "vox"

species_chest = /obj/item/bodypart/chest/vox
species_head = /obj/item/bodypart/head/vox
species_l_arm = /obj/item/bodypart/l_arm/vox
Expand Down
10 changes: 7 additions & 3 deletions code/modules/mob/living/carbon/human/update_icons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,16 @@ There are several things that need to be remembered:

//Bloody hands begin
if(!gloves && blood_in_hands && (num_hands > 0))
var/mutable_appearance/bloody_overlay = mutable_appearance('icons/effects/blood.dmi', "bloodyhands", -GLOVES_LAYER)
var/overlay_file = 'icons/effects/blood.dmi'
var/custom_overlay_icon = dna.species.custom_overlay_icon
if(custom_overlay_icon)
overlay_file = custom_overlay_icon
var/mutable_appearance/bloody_overlay = mutable_appearance(overlay_file, "handsblood", -GLOVES_LAYER)
if(num_hands < 2)
if(has_left_hand(FALSE))
bloody_overlay.icon_state = "bloodyhands_left"
bloody_overlay.icon_state = "handsblood_left"
else if(has_right_hand(FALSE))
bloody_overlay.icon_state = "bloodyhands_right"
bloody_overlay.icon_state = "handsblood_right"
var/list/blood_dna = return_blood_DNA()
if(length(blood_dna))
bloody_overlay.color = get_blood_dna_color(return_blood_DNA())
Expand Down
6 changes: 4 additions & 2 deletions code/modules/mob/living/carbon/update_icons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
apply_overlay(FIRE_LAYER)

/mob/living/carbon/update_damage_overlays()

remove_overlay(DAMAGE_LAYER)

var/mutable_appearance/damage_overlay = mutable_appearance('icons/mob/dam_mob.dmi', "blank", -DAMAGE_LAYER)
Expand All @@ -102,12 +103,13 @@
for(var/obj/item/bodypart/BP as anything in bodyparts)
if(BP.dmg_overlay_type)
if(BP.brutestate)
var/image/brute_overlay = image('icons/mob/dam_mob.dmi', "[BP.dmg_overlay_type]_[BP.body_zone]_[BP.brutestate]0")
var/image/brute_overlay = image(BP.dmg_overlay_icon, "[BP.dmg_overlay_type]_[BP.body_zone]_[BP.brutestate]0")
if(BP.use_damage_color)
brute_overlay.color = BP.damage_color
damage_overlay.add_overlay(brute_overlay)
if(BP.burnstate)
damage_overlay.add_overlay("[BP.dmg_overlay_type]_[BP.body_zone]_0[BP.burnstate]")
var/image/burn_overlay = image(BP.dmg_overlay_icon, "[BP.dmg_overlay_type]_[BP.body_zone]_[BP.burnstate]0")
damage_overlay.add_overlay(burn_overlay)

apply_overlay(DAMAGE_LAYER)

Expand Down
Loading
Loading