Refactors that mess of a code for alternate worn clothing sprites for digitigrade and taurs.

This commit is contained in:
Ghommie
2019-12-08 09:02:41 +01:00
parent 8bc5580a01
commit 8ec4bdaef5
52 changed files with 336 additions and 529 deletions

View File

@@ -27,28 +27,33 @@
extra2 = TRUE
center = TRUE
dimension_x = 64
var/taur_mode = NOT_TAURIC
var/taur_mode = NONE //Must be a single specific tauric suit variation bitflag. Don't do FLAG_1|FLAG_2
var/alt_taur_mode = NONE //Same as above.
color_src = MATRIXED
/datum/sprite_accessory/taur/none
dimension_x = 32
center = FALSE
name = "None"
icon_state = "None"
/datum/sprite_accessory/taur/cow
name = "Cow"
icon_state = "cow"
taur_mode = HOOF_TAURIC
taur_mode = STYLE_HOOF_TAURIC
alt_taur_mode = STYLE_PAW_TAURIC
/datum/sprite_accessory/taur/deer
name = "Deer"
icon_state = "deer"
taur_mode = HOOF_TAURIC
taur_mode = STYLE_HOOF_TAURIC
alt_taur_mode = STYLE_PAW_TAURIC
color_src = MUTCOLORS
/datum/sprite_accessory/taur/drake
name = "Drake"
icon_state = "drake"
taur_mode = PAW_TAURIC
taur_mode = STYLE_PAW_TAURIC
/datum/sprite_accessory/taur/drider
name = "Drider"
@@ -58,67 +63,68 @@
/datum/sprite_accessory/taur/eevee
name = "Eevee"
icon_state = "eevee"
taur_mode = PAW_TAURIC
taur_mode = STYLE_PAW_TAURIC
color_src = MUTCOLORS
/datum/sprite_accessory/taur/fox
name = "Fox"
icon_state = "fox"
taur_mode = PAW_TAURIC
taur_mode = STYLE_PAW_TAURIC
/datum/sprite_accessory/taur/husky
name = "Husky"
icon_state = "husky"
taur_mode = PAW_TAURIC
taur_mode = STYLE_PAW_TAURIC
/datum/sprite_accessory/taur/horse
name = "Horse"
icon_state = "horse"
taur_mode = HOOF_TAURIC
taur_mode = STYLE_HOOF_TAURIC
alt_taur_mode = STYLE_PAW_TAURIC
/datum/sprite_accessory/taur/lab
name = "Lab"
icon_state = "lab"
taur_mode = PAW_TAURIC
taur_mode = STYLE_PAW_TAURIC
/datum/sprite_accessory/taur/naga
name = "Naga"
icon_state = "naga"
taur_mode = SNEK_TAURIC
taur_mode = STYLE_SNEK_TAURIC
/datum/sprite_accessory/taur/otie
name = "Otie"
icon_state = "otie"
taur_mode = PAW_TAURIC
taur_mode = STYLE_PAW_TAURIC
/datum/sprite_accessory/taur/pede
name = "Scolipede"
icon_state = "pede"
taur_mode = PAW_TAURIC
taur_mode = STYLE_PAW_TAURIC
color_src = MUTCOLORS
/datum/sprite_accessory/taur/panther
name = "Panther"
icon_state = "panther"
taur_mode = PAW_TAURIC
taur_mode = STYLE_PAW_TAURIC
/datum/sprite_accessory/taur/shepherd
name = "Shepherd"
icon_state = "shepherd"
taur_mode = PAW_TAURIC
taur_mode = STYLE_PAW_TAURIC
/datum/sprite_accessory/taur/tentacle
name = "Tentacle"
icon_state = "tentacle"
taur_mode = SNEK_TAURIC
taur_mode = STYLE_SNEK_TAURIC
color_src = MUTCOLORS
/datum/sprite_accessory/taur/tiger
name = "Tiger"
icon_state = "tiger"
taur_mode = PAW_TAURIC
taur_mode = STYLE_PAW_TAURIC
/datum/sprite_accessory/taur/wolf
name = "Wolf"
icon_state = "wolf"
taur_mode = PAW_TAURIC
taur_mode = STYLE_PAW_TAURIC

View File

@@ -21,7 +21,7 @@
flags_cover = MASKCOVERSEYES | MASKCOVERSMOUTH
layer = MOB_LAYER
max_integrity = 100
mutantrace_variation = MUTANTRACE_VARIATION
mutantrace_variation = STYLE_MUZZLE
var/stat = CONSCIOUS //UNCONSCIOUS is the idle state in this case

View File

@@ -610,22 +610,22 @@ GLOBAL_LIST_EMPTY(roundstart_race_names)
var/obj/item/bodypart/head/HD = H.get_bodypart(BODY_ZONE_HEAD)
if("tail_lizard" in mutant_bodyparts)
if(H.wear_suit && (H.wear_suit.flags_inv & HIDETAUR) || (!H.dna.features["taur"] == "None"))
if((H.wear_suit && (H.wear_suit.flags_inv & HIDETAUR)) || !H.dna.features["taur"] || H.dna.features["taur"] == "None")
bodyparts_to_add -= "tail_lizard"
if("waggingtail_lizard" in mutant_bodyparts)
if(H.wear_suit && (H.wear_suit.flags_inv & HIDETAUR) || (!H.dna.features["taur"] == "None"))
if((H.wear_suit && (H.wear_suit.flags_inv & HIDETAUR)) || !H.dna.features["taur"] || H.dna.features["taur"] == "None")
bodyparts_to_add -= "waggingtail_lizard"
else if ("tail_lizard" in mutant_bodyparts)
bodyparts_to_add -= "waggingtail_lizard"
if("tail_human" in mutant_bodyparts)
if(H.wear_suit && (H.wear_suit.flags_inv & HIDETAUR) || (!H.dna.features["taur"] == "None"))
if((H.wear_suit && (H.wear_suit.flags_inv & HIDETAUR)) || !H.dna.features["taur"] || H.dna.features["taur"] == "None")
bodyparts_to_add -= "tail_human"
if("waggingtail_human" in mutant_bodyparts)
if(H.wear_suit && (H.wear_suit.flags_inv & HIDETAUR) || (!H.dna.features["taur"] == "None"))
if((H.wear_suit && (H.wear_suit.flags_inv & HIDETAUR)) || !H.dna.features["taur"] || H.dna.features["taur"] == "None")
bodyparts_to_add -= "waggingtail_human"
else if ("tail_human" in mutant_bodyparts)
bodyparts_to_add -= "waggingtail_human"
@@ -685,11 +685,11 @@ GLOBAL_LIST_EMPTY(roundstart_race_names)
//Other Races
if("mam_tail" in mutant_bodyparts)
if(H.wear_suit && (H.wear_suit.flags_inv & HIDETAUR) || (!H.dna.features["taur"] == "None"))
if((H.wear_suit && (H.wear_suit.flags_inv & HIDETAUR)) || !H.dna.features["taur"] || H.dna.features["taur"] == "None")
bodyparts_to_add -= "mam_tail"
if("mam_waggingtail" in mutant_bodyparts)
if(H.wear_suit && (H.wear_suit.flags_inv & HIDETAUR) || (!H.dna.features["taur"] == "None"))
if((H.wear_suit && (H.wear_suit.flags_inv & HIDETAUR)) || !H.dna.features["taur"] || H.dna.features["taur"] == "None")
bodyparts_to_add -= "mam_waggingtail"
else if ("mam_tail" in mutant_bodyparts)
bodyparts_to_add -= "mam_waggingtail"
@@ -720,10 +720,10 @@ GLOBAL_LIST_EMPTY(roundstart_race_names)
species_traits += DIGITIGRADE
var/should_be_squished = FALSE
if(H.wear_suit)
if(H.wear_suit.mutantrace_variation == NO_MUTANTRACE_VARIATION) //we got digitigrade suits now fam
if(!(H.wear_suit.mutantrace_variation & STYLE_DIGITIGRADE)) //we got digitigrade suits now fam
should_be_squished = TRUE
if(H.w_uniform && !H.wear_suit)
if(H.w_uniform.mutantrace_variation == NO_MUTANTRACE_VARIATION)
if(!(H.w_uniform.mutantrace_variation & STYLE_DIGITIGRADE))
should_be_squished = TRUE
if(O.use_digitigrade == FULL_DIGITIGRADE && should_be_squished)
O.use_digitigrade = SQUISHED_DIGITIGRADE

View File

@@ -73,16 +73,12 @@
/datum/species/xeno/on_species_gain(mob/living/carbon/human/C, datum/species/old_species)
if(("legs" in C.dna.species.mutant_bodyparts) && (C.dna.features["legs"] == "Digitigrade" || C.dna.features["legs"] == "Avian"))
species_traits += DIGITIGRADE
if(DIGITIGRADE in species_traits)
C.Digitigrade_Leg_Swap(FALSE)
. = ..()
return ..()
/datum/species/xeno/on_species_loss(mob/living/carbon/human/C, datum/species/new_species)
if(("legs" in C.dna.species.mutant_bodyparts) && C.dna.features["legs"] == "Plantigrade")
species_traits -= DIGITIGRADE
if(DIGITIGRADE in species_traits)
C.Digitigrade_Leg_Swap(TRUE)
. = ..()
return ..()
//Praise the Omnissiah, A challange worthy of my skills - HS

View File

@@ -76,15 +76,12 @@
/datum/species/lizard/on_species_gain(mob/living/carbon/human/C, datum/species/old_species)
if(("legs" in C.dna.species.mutant_bodyparts) && (C.dna.features["legs"] == "Digitigrade" || C.dna.features["legs"] == "Avian"))
species_traits += DIGITIGRADE
if(DIGITIGRADE in species_traits)
C.Digitigrade_Leg_Swap(FALSE)
return ..()
/datum/species/lizard/on_species_loss(mob/living/carbon/human/C, datum/species/new_species)
if(("legs" in C.dna.species.mutant_bodyparts) && C.dna.features["legs"] == "Plantigrade")
species_traits -= DIGITIGRADE
if(DIGITIGRADE in species_traits)
C.Digitigrade_Leg_Swap(TRUE)
return ..()
/*
Lizard subspecies: ASHWALKERS

View File

@@ -104,45 +104,45 @@ There are several things that need to be remembered:
var/obj/screen/inventory/inv = hud_used.inv_slots[SLOT_W_UNIFORM]
inv.update_icon()
if(istype(w_uniform, /obj/item/clothing/under))
var/obj/item/clothing/under/U = w_uniform
U.screen_loc = ui_iclothing
if(client && hud_used && hud_used.hud_shown)
if(hud_used.inventory_shown)
client.screen += w_uniform
update_observer_view(w_uniform,1)
var/obj/item/clothing/under/U = w_uniform
U.screen_loc = ui_iclothing
if(client && hud_used && hud_used.hud_shown)
if(hud_used.inventory_shown)
client.screen += w_uniform
update_observer_view(w_uniform,1)
if(wear_suit && (wear_suit.flags_inv & HIDEJUMPSUIT))
return
if(wear_suit && (wear_suit.flags_inv & HIDEJUMPSUIT))
return
var/t_color = U.item_color
if(!t_color)
t_color = U.icon_state
if(U.suit_style == NORMAL_SUIT_STYLE)
if(U.adjusted == ALT_STYLE)
t_color = "[t_color]_d"
var/t_color = U.item_color
if(!t_color)
t_color = U.icon_state
if(U.adjusted == ALT_STYLE)
t_color = "[t_color]_d"
var/alt_worn = U.alternate_worn_icon
var/alt_worn = U.alternate_worn_icon
var/variant_flag = NONE
if(!U.force_alternate_icon && U.mutantrace_variation && U.suit_style == DIGITIGRADE_SUIT_STYLE)
alt_worn = 'icons/mob/uniform_digi.dmi'
if((DIGITIGRADE in dna.species.species_traits) && U.mutantrace_variation & STYLE_DIGITIGRADE)
alt_worn = 'icons/mob/uniform_digi.dmi'
variant_flag |= STYLE_DIGITIGRADE
var/mutable_appearance/uniform_overlay
var/mutable_appearance/uniform_overlay
if(dna && dna.species.sexes)
var/G = (gender == FEMALE) ? "f" : "m"
if(G == "f" && U.fitted != NO_FEMALE_UNIFORM)
uniform_overlay = U.build_worn_icon(state = "[t_color]", default_layer = UNIFORM_LAYER, default_icon_file = (alt_worn ? alt_worn : 'icons/mob/uniform.dmi'), isinhands = FALSE, femaleuniform = U.fitted)
if(dna && dna.species.sexes)
var/G = (gender == FEMALE) ? "f" : "m"
if(G == "f" && U.fitted != NO_FEMALE_UNIFORM)
uniform_overlay = U.build_worn_icon("[t_color]", UNIFORM_LAYER, alt_worn ? alt_worn : 'icons/mob/uniform.dmi', FALSE, U.fitted, variant_flag)
if(!uniform_overlay)
uniform_overlay = U.build_worn_icon(state = "[t_color]", default_layer = UNIFORM_LAYER, default_icon_file = (alt_worn ? alt_worn : 'icons/mob/uniform.dmi'), isinhands = FALSE)
if(!uniform_overlay)
uniform_overlay = U.build_worn_icon("[t_color]", UNIFORM_LAYER, alt_worn ? alt_worn : 'icons/mob/uniform.dmi', FALSE, style_flags = variant_flag)
if(OFFSET_UNIFORM in dna.species.offset_features)
uniform_overlay.pixel_x += dna.species.offset_features[OFFSET_UNIFORM][1]
uniform_overlay.pixel_y += dna.species.offset_features[OFFSET_UNIFORM][2]
overlays_standing[UNIFORM_LAYER] = uniform_overlay
if(OFFSET_UNIFORM in dna.species.offset_features)
uniform_overlay.pixel_x += dna.species.offset_features[OFFSET_UNIFORM][1]
uniform_overlay.pixel_y += dna.species.offset_features[OFFSET_UNIFORM][2]
overlays_standing[UNIFORM_LAYER] = uniform_overlay
apply_overlay(UNIFORM_LAYER)
update_mutant_bodyparts()
@@ -270,32 +270,6 @@ There are several things that need to be remembered:
if(client && hud_used)
var/obj/screen/inventory/inv = hud_used.inv_slots[SLOT_SHOES]
inv.update_icon()
/*
if(!shoes && bloody_feet)
var/mutable_appearance/bloody_overlay = mutable_appearance('icons/effects/blood.dmi', "bloodyfeet", -SHOES_LAYER, color = blood_DNA_to_color())
if(dna.features["taur"] != "None")
if(dna.features["taur"] in GLOB.noodle_taurs)
bloody_overlay = mutable_appearance('modular_citadel/icons/mob/64x32_effects.dmi', "snekbloodyfeet", -SHOES_LAYER, color = blood_DNA_to_color())
if(get_num_legs() < 2)
if(has_left_leg())
bloody_overlay.icon_state = "snekbloodyfeet_left"
else if(has_right_leg())
bloody_overlay.icon_state = "snekbloodyfeet_right"
else if(dna.features["taur"] in GLOB.paw_taurs)
bloody_overlay = mutable_appearance('modular_citadel/icons/mob/64x32_effects.dmi', "pawbloodyfeet", -SHOES_LAYER, color = blood_DNA_to_color())
if(get_num_legs() < 2)
if(has_left_leg())
bloody_overlay.icon_state = "pawbloodyfeet_left"
else if(has_right_leg())
bloody_overlay.icon_state = "pawbloodyfeet_right"
else
if(get_num_legs() < 2)
if(has_left_leg())
bloody_overlay.icon_state = "bloodyfeet_left"
else if(has_right_leg())
bloody_overlay.icon_state = "bloodyfeet_right"
overlays_standing[GLOVES_LAYER] = bloody_overlay*/
if(shoes)
var/obj/item/clothing/shoes/S = shoes
@@ -304,15 +278,17 @@ There are several things that need to be remembered:
if(hud_used.inventory_shown) //if the inventory is open
client.screen += shoes //add it to client's screen
update_observer_view(shoes,1)
if(S.mutantrace_variation)
if(S.adjusted == ALT_STYLE)
S.alternate_worn_icon = 'icons/mob/feet_digi.dmi'
else
S.alternate_worn_icon = null
var/alt_icon = S.alternate_worn_icon
var/variation_flag = NONE
if((DIGITIGRADE in dna.species.species_traits) && S.mutantrace_variation & STYLE_DIGITIGRADE)
alt_icon = 'icons/mob/feet_digi.dmi'
variation_flag |= STYLE_DIGITIGRADE
var/t_state = shoes.item_state
if (!t_state)
t_state = shoes.icon_state
overlays_standing[SHOES_LAYER] = shoes.build_worn_icon(state = t_state, default_layer = SHOES_LAYER, default_icon_file = ((shoes.alternate_worn_icon) ? shoes.alternate_worn_icon : 'icons/mob/feet.dmi'))
overlays_standing[SHOES_LAYER] = shoes.build_worn_icon(t_state, SHOES_LAYER, alt_icon ? alt_icon : 'icons/mob/feet.dmi', style_flags = variation_flag)
var/mutable_appearance/shoes_overlay = overlays_standing[SHOES_LAYER]
if(OFFSET_SHOES in dna.species.offset_features)
shoes_overlay.pixel_x += dna.species.offset_features[OFFSET_SHOES][1]
@@ -350,13 +326,18 @@ There are several things that need to be remembered:
if(head)
remove_overlay(HEAD_LAYER)
var/obj/item/clothing/head/H = head
if(H.mutantrace_variation)
if(H.muzzle_var == ALT_STYLE)
H.alternate_worn_icon = 'icons/mob/head_muzzled.dmi'
else
H.alternate_worn_icon = null
var/alt_icon = H.alternate_worn_icon
var/muzzled = FALSE
var/variation_flag = NONE
if(("mam_snouts" in dna.species.default_features) && dna.features["mam_snouts"] != "None")
muzzled = TRUE
if(!muzzled && ("snout" in dna.species.default_features) && dna.features["snout"] != "None")
muzzled = TRUE
if(muzzled && H.mutantrace_variation & STYLE_MUZZLE)
alt_icon = 'icons/mob/head_muzzled.dmi'
variation_flag |= STYLE_MUZZLE
overlays_standing[HEAD_LAYER] = H.build_worn_icon(state = H.icon_state, default_layer = HEAD_LAYER, default_icon_file = ((head.alternate_worn_icon) ? H.alternate_worn_icon : 'icons/mob/head.dmi'))
overlays_standing[HEAD_LAYER] = H.build_worn_icon(H.icon_state, HEAD_LAYER, alt_icon ? alt_icon : 'icons/mob/head.dmi', style_flags = variation_flag)
var/mutable_appearance/head_overlay = overlays_standing[HEAD_LAYER]
if(OFFSET_HEAD in dna.species.offset_features)
@@ -409,30 +390,40 @@ There are several things that need to be remembered:
client.screen += wear_suit
update_observer_view(wear_suit,1)
if(!item_level_support && !S.force_alternate_icon)
if(S.mutantrace_variation) //Just make sure we've got this checked too
if(S.taurmode == NOT_TAURIC && S.adjusted == ALT_STYLE) //are we not a taur, but we have Digitigrade legs? Run this check first, then.
S.alternate_worn_icon = 'icons/mob/suit_digi.dmi'
else
S.alternate_worn_icon = null
var/worn_icon = wear_suit.alternate_worn_icon || 'icons/mob/suit.dmi'
var/center = FALSE
var/dimension_x = 32
var/dimension_y = 32
var/variation_flag = NONE
var/datum/sprite_accessory/taur/T
if("taur" in dna.species.mutant_bodyparts)
T = GLOB.taur_list[dna.features["taur"]]
if(T)
center = T.center
dimension_x = T.dimension_x
dimension_y = T.dimension_y
if(S.tauric == TRUE) //Are we a suit with tauric mode possible?
if(S.taurmode == SNEK_TAURIC)
S.alternate_worn_icon = 'icons/mob/taur_naga.dmi'
if(S.taurmode == PAW_TAURIC)
S.alternate_worn_icon = 'icons/mob/taur_canine.dmi'
if(S.taurmode == NOT_TAURIC && S.adjusted == ALT_STYLE)
S.alternate_worn_icon = 'icons/mob/suit_digi.dmi'
else if(S.taurmode == NOT_TAURIC && S.adjusted == NORMAL_STYLE)
S.alternate_worn_icon = null
if(!item_level_support && S.mutantrace_variation)
if(T?.taur_mode)
variation_flag |= S.mutantrace_variation & T.taur_mode || S.mutantrace_variation & T.alt_taur_mode
switch(variation_flag)
if(STYLE_HOOF_TAURIC)
worn_icon = 'icons/mob/taur_hooved.dmi'
if(STYLE_SNEK_TAURIC)
worn_icon = 'icons/mob/taur_naga.dmi'
if(STYLE_PAW_TAURIC)
worn_icon = 'icons/mob/taur_canine.dmi'
else if((DIGITIGRADE in dna.species.species_traits) && S.mutantrace_variation & STYLE_DIGITIGRADE) //not a taur, but digitigrade legs.
worn_icon = 'icons/mob/suit_digi.dmi'
variation_flag |= STYLE_DIGITIGRADE
overlays_standing[SUIT_LAYER] = S.build_worn_icon(state = wear_suit.icon_state, default_layer = SUIT_LAYER, default_icon_file = ((wear_suit.alternate_worn_icon) ? S.alternate_worn_icon : 'icons/mob/suit.dmi'))
overlays_standing[SUIT_LAYER] = S.build_worn_icon(wear_suit.icon_state, SUIT_LAYER, worn_icon, style_flags = variation_flag)
var/mutable_appearance/suit_overlay = overlays_standing[SUIT_LAYER]
if(OFFSET_SUIT in dna.species.offset_features)
suit_overlay.pixel_x += dna.species.offset_features[OFFSET_SUIT][1]
suit_overlay.pixel_y += dna.species.offset_features[OFFSET_SUIT][2]
if(!item_level_support && S.center)
suit_overlay = center_image(suit_overlay, S.dimension_x, S.dimension_y)
if(center)
suit_overlay = center_image(suit_overlay, dimension_x, dimension_y)
overlays_standing[SUIT_LAYER] = suit_overlay
update_hair()
update_mutant_bodyparts()
@@ -468,13 +459,18 @@ There are several things that need to be remembered:
if(wear_mask)
var/obj/item/clothing/mask/M = wear_mask
remove_overlay(FACEMASK_LAYER)
if(M.mutantrace_variation)
if(M.muzzle_var == ALT_STYLE)
M.alternate_worn_icon = 'icons/mob/mask_muzzled.dmi'
else
M.alternate_worn_icon = null
var/alt_icon = M.alternate_worn_icon
var/muzzled = FALSE
var/variation_flag = NONE
if(("mam_snouts" in dna.species.default_features) && dna.features["mam_snouts"] != "None")
muzzled = TRUE
if(!muzzled && ("snout" in dna.species.default_features) && dna.features["snout"] != "None")
muzzled = TRUE
if(muzzled && M.mutantrace_variation & STYLE_MUZZLE)
alt_icon = 'icons/mob/head_muzzled.dmi'
variation_flag |= STYLE_MUZZLE
overlays_standing[FACEMASK_LAYER] = M.build_worn_icon(state = wear_mask.icon_state, default_layer = FACEMASK_LAYER, default_icon_file = ((wear_mask.alternate_worn_icon) ? M.alternate_worn_icon : 'icons/mob/mask.dmi'))
overlays_standing[FACEMASK_LAYER] = M.build_worn_icon(wear_mask.icon_state, FACEMASK_LAYER, alt_icon ? alt_icon : 'icons/mob/mask.dmi', style_flags = variation_flag)
var/mutable_appearance/mask_overlay = overlays_standing[FACEMASK_LAYER]
if(OFFSET_FACEMASK in dna.species.offset_features)
@@ -572,7 +568,7 @@ generate/load female uniform sprites matching all previously decided variables
*/
/obj/item/proc/build_worn_icon(var/state = "", var/default_layer = 0, var/default_icon_file = null, var/isinhands = FALSE, var/femaleuniform = NO_FEMALE_UNIFORM)
/obj/item/proc/build_worn_icon(state = "", default_layer = 0, default_icon_file = null, isinhands = FALSE, femaleuniform = NO_FEMALE_UNIFORM, style_flags = NONE)
//Find a valid icon file from variables+arguments
var/file2use
@@ -596,7 +592,7 @@ generate/load female uniform sprites matching all previously decided variables
//Get the overlays for this item when it's being worn
//eg: ammo counters, primed grenade flashes, etc.
var/list/worn_overlays = worn_overlays(isinhands, file2use)
var/list/worn_overlays = worn_overlays(isinhands, file2use, style_flags)
if(worn_overlays && worn_overlays.len)
standing.overlays.Add(worn_overlays)