Skip to content

Commit

Permalink
implements most shit
Browse files Browse the repository at this point in the history
  • Loading branch information
KoboldCommando committed Oct 31, 2023
1 parent 4f38a69 commit e2c3f3d
Show file tree
Hide file tree
Showing 23 changed files with 143 additions and 132 deletions.
41 changes: 41 additions & 0 deletions code/datums/greyscale/config_types/greyscale_configs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1096,6 +1096,19 @@
name = "simian Hardsuit"
json_config = 'code/datums/greyscale/json_configs/simian_fallbacks/hardsuit.json'

/datum/greyscale_config/lizard
name = "lizard Clothing"
icon_file = 'monkestation/icons/mob/gags/clothing/lizard_fallbacks.dmi'
json_config = 'code/datums/greyscale/json_configs/lizard_fallbacks/shoes.json'

/datum/greyscale_config/lizard/shoes
name = "lizard Shoes"
json_config = 'code/datums/greyscale/json_configs/lizard_fallbacks/shoes.json'

/datum/greyscale_config/lizard/under
name = "lizard Under"
json_config = 'code/datums/greyscale/json_configs/lizard_fallbacks/under.json'


/datum/greyscale_config/polycloak
name = "cloak"
Expand Down Expand Up @@ -1141,3 +1154,31 @@
name = "Worn Fish Analyzer"
icon_file = 'icons/mob/clothing/belt.dmi'
json_config = 'code/datums/greyscale/json_configs/fish_analyzer_worn.json'

/*
* SUITS
*/

// JUMPSUITS

/datum/greyscale_config/jumpsuit_worn/digitigrade
name = "Worn Jumpsuit - Digitigrade"
icon_file = DIGITIGRADE_UNIFORM_FILE

/datum/greyscale_config/jumpsuit_prison_worn/digitigrade
name = "Worn Prison Jumpsuit - Digitigrade"
icon_file = DIGITIGRADE_UNIFORM_FILE

/*
* SHOES
*/

// SNEAKERS

/datum/greyscale_config/sneakers_worn/digitigrade
name = "Worn Sneakers - Digitigrade"
icon_file = DIGITIGRADE_SHOES_FILE

/datum/greyscale_config/sneakers_orange_worn/digitigrade
name = "Worn Orange Sneakers - Digitigrade"
icon_file = DIGITIGRADE_SHOES_FILE
10 changes: 10 additions & 0 deletions code/datums/greyscale/json_configs/lizard_fallbacks/shoes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"": [
{
"type": "icon_state",
"icon_state": "boots",
"blend_mode": "overlay",
"color_ids": [ 1 ]
}
]
}
16 changes: 16 additions & 0 deletions code/datums/greyscale/json_configs/lizard_fallbacks/under.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"": [
{
"type": "icon_state",
"icon_state": "jumpsuit",
"blend_mode": "overlay",
"color_ids": [ 1 ]
},
{
"type": "icon_state",
"icon_state": "jumpsuit_accessories",
"blend_mode": "overlay",
"color_ids": [ 2 ]
}
]
}
2 changes: 1 addition & 1 deletion code/modules/client/preferences/species_features/lizard.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
/datum/preference/choiced/lizard_body_markings/init_possible_values()
var/list/values = list()

var/icon/lizard = icon('icons/mob/species/lizard/bodyparts.dmi', "lizard_chest_m")
var/icon/lizard = icon('icons/mob/species/lizard/bodyparts.dmi', "lizard_chest")

for (var/name in GLOB.body_markings_list)
var/datum/sprite_accessory/sprite_accessory = GLOB.body_markings_list[name]
Expand Down
39 changes: 0 additions & 39 deletions code/modules/clothing/clothing.dm
Original file line number Diff line number Diff line change
Expand Up @@ -477,45 +477,6 @@ BLIND // can't see anything
female_clothing_icon = fcopy_rsc(female_clothing_icon)
GLOB.female_clothing_icons[index] = female_clothing_icon

/**
* Generates a 'fallback' sprite from `fallback_colors` and `fallback_icon_state`, then adds it to `GLOB.fallback_clothing_icons`.
*
* The fallback sprite is created by getting each colour specified in [fallback_colors],
* then mapping each of them to the red, green, and blue sections of the sprite specified by [fallback_icon_state].
*
* Arguments:
* * file2use - The normal `icon` for this item.
* * state2use - The normal `icon_state` for this item.
* * species_file - The [/datum/species/var/fallback_clothing_path] of the species trying to wear this item.
* * list_key - The key that this icon will be saved under in the global list. (Either ["path/to/file.dmi-jumpsuit"], or ["#ffe14d-jumpsuit"] if GAGS is used)
*/
/obj/item/clothing/proc/generate_fallback_clothing(file2use, state2use, species_file, list_key)
var/icon/human_clothing_icon = icon(file2use, state2use) // Default human 'worn' sprite for this item.

if(greyscale_config_worn && greyscale_colors) // Get the coloured version if it's greyscale.
human_clothing_icon = icon(SSgreyscale.GetColoredIconByType(greyscale_config_worn, greyscale_colors), state2use)

if(!fallback_colors || !fallback_icon_state)
GLOB.fallback_clothing_icons[species_file][list_key] = human_clothing_icon
return // If no fallback data is set for this item, just use the human version.

var/icon/final_icon = icon(species_file, fallback_icon_state) // RGB fallback sprite.

var/list/final_list = list() // List of colours to map onto the RGB sprite.
for(var/i in 1 to 3)
if(length(fallback_colors) < i) // If less than 3 colours are specified, fill the remaining indices with black.
final_list += "#000000"
continue
var/color = fallback_colors[i]
if(islist(color)) // If `color` is a coordinates list, get the colour of the pixel at that location.
final_list += human_clothing_icon.GetPixel(color[1], color[2]) || "#000000"
else if(istext(color)) // Otherwise if it's a hex colour, use that instead.
final_list += color

final_icon.MapColors(final_list[1], final_list[2], final_list[3])
final_icon = fcopy_rsc(final_icon)
GLOB.fallback_clothing_icons[species_file][list_key] = final_icon

/obj/item/clothing/proc/weldingvisortoggle(mob/user) //proc to toggle welding visors on helmets, masks, goggles, etc.
if(!can_use(user))
return FALSE
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/human/_species.dm
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ GLOBAL_LIST_EMPTY(features_by_species)
var/datum/sprite_accessory/undershirt/undershirt = GLOB.undershirt_list[species_human.undershirt]
if(undershirt)
var/mutable_appearance/working_shirt
if(species_human.dna.species.sexes && species_human.physique == FEMALE)
if(species_human.dna.species.sexes && species_human.physique == FEMALE && species_human.get_bodypart(BODY_ZONE_CHEST)?.is_dimorphic)
working_shirt = wear_female_version(undershirt.icon_state, undershirt.icon, BODY_LAYER)
else
working_shirt = mutable_appearance(undershirt.icon, undershirt.icon_state, -BODY_LAYER)
Expand Down
46 changes: 10 additions & 36 deletions code/modules/mob/living/carbon/human/human_update_icons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ There are several things that need to be remembered:
icon_file = MONKEY_UNIFORM_FILE
else if((dna?.species.bodytype & BODYTYPE_DIGITIGRADE) && (uniform.supports_variations_flags & CLOTHING_DIGITIGRADE_VARIATION))
icon_file = uniform.worn_icon_digitigrade || DIGITIGRADE_UNIFORM_FILE
if(!(icon_exists(icon_file, RESOLVE_ICON_STATE(uniform)))) //if the digitigrade icon doesn't exist
var/species_icon_file = dna.species.generate_custom_worn_icon(LOADOUT_ITEM_UNIFORM, uniform)
if(species_icon_file)
icon_file = species_icon_file
//Female sprites have lower priority than digitigrade sprites
else if(dna.species.bodytype & BODYTYPE_CUSTOM)
icon_file = dna.species.generate_custom_worn_icon(LOADOUT_ITEM_UNIFORM, w_uniform)
Expand Down Expand Up @@ -326,8 +330,12 @@ There are several things that need to be remembered:
var/mutant_override = FALSE
if((dna.species.bodytype & BODYTYPE_DIGITIGRADE) && (worn_item.supports_variations_flags & CLOTHING_DIGITIGRADE_VARIATION))
var/obj/item/bodypart/leg/leg = src.get_bodypart(BODY_ZONE_L_LEG)
if(leg.limb_id == leg.digitigrade_id) //Snowflakey and bad. But it makes it look consistent.
if(leg.limb_id == leg.digitigrade_id) //make sure our legs are visually digitigrade
icon_file = shoes.worn_icon_digitigrade || DIGITIGRADE_SHOES_FILE
if(!(icon_exists(icon_file, RESOLVE_ICON_STATE(worn_item)))) //if the digitigrade icon doesn't exist
var/species_icon_file = dna.species.generate_custom_worn_icon(LOADOUT_ITEM_SHOES, shoes)
if(species_icon_file)
icon_file = species_icon_file
mutant_override = TRUE
else if(dna.species.bodytype & BODYTYPE_CUSTOM)
var/species_icon_file = dna.species.generate_custom_worn_icon(LOADOUT_ITEM_SHOES, shoes)
Expand Down Expand Up @@ -402,7 +410,7 @@ There are several things that need to be remembered:

if(!(icon_exists(icon_file, RESOLVE_ICON_STATE(worn_item))))
mutant_override = FALSE
icon_file = 'icons/mob/clothing/head.dmi'
icon_file = 'icons/mob/clothing/head/default.dmi'

var/mutable_appearance/head_overlay = head.build_worn_icon(default_layer = HEAD_LAYER, default_icon_file = icon_file, override_file = mutant_override ? icon_file : null)
if(!mutant_override &&(OFFSET_HEAD in dna.species.offset_features))
Expand Down Expand Up @@ -645,40 +653,6 @@ There are several things that need to be remembered:
out += overlays_standing[i]
return out

/**
* Override with a fallback sprite for this item.
*
* Arguments:
* * file2use - The normal `icon` for this item.
* * state2use - The normal `icon_state` for this item.
* * layer - The layer that the final sprite should be rendered on.
* * species_file - The [/datum/species/var/fallback_clothing_path] of the species trying to wear this item.
*/
/obj/item/proc/wear_fallback_version(file2use, state2use, layer, species_file)
return

/**
* Returns a mutable_appearance of this clothing's fallback sprite.
*
* If a sprite for this item hasn't already been generated, a new one is made in [generate_fallback_clothing], and added to `GLOB.fallback_clothing_icons`.
*
* Arguments:
* * file2use - The normal `icon` for this item.
* * state2use - The normal `icon_state` for this item.
* * layer - The layer that the final sprite should be rendered on.
* * species_file - The [/datum/species/var/fallback_clothing_path] of the species trying to wear this item.
*/
/obj/item/clothing/wear_fallback_version(file2use, state2use, layer, species_file)
LAZYINITLIST(GLOB.fallback_clothing_icons[species_file])

// Either ["path/to/file.dmi-jumpsuit"] or ["#ffe14d-jumpsuit"]
var/list_key = "[(greyscale_colors && greyscale_config_worn) ? greyscale_colors : file2use]-[state2use]"

var/icon/species_clothing_icon = GLOB.fallback_clothing_icons[species_file][list_key]
if(!species_clothing_icon) // Create standing/laying icons if they don't exist
generate_fallback_clothing(file2use, state2use, species_file, list_key)
return mutable_appearance(GLOB.fallback_clothing_icons[species_file][list_key], layer = -layer)

//human HUD updates for items in our inventory

/mob/living/carbon/human/proc/update_hud_uniform(obj/item/worn_item)
Expand Down
58 changes: 3 additions & 55 deletions code/modules/surgery/bodyparts/species_parts/lizard_bodyparts.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/obj/item/bodypart/chest/lizard
icon_greyscale = 'icons/mob/species/lizard/bodyparts.dmi'
limb_id = SPECIES_LIZARD
is_dimorphic = TRUE
is_dimorphic = FALSE

/obj/item/bodypart/arm/left/lizard
icon_greyscale = 'icons/mob/species/lizard/bodyparts.dmi'
Expand All @@ -33,63 +33,11 @@
/obj/item/bodypart/leg/left/lizard
icon_greyscale = 'icons/mob/species/lizard/bodyparts.dmi'
limb_id = SPECIES_LIZARD

/obj/item/bodypart/leg/right/lizard
icon_greyscale = 'icons/mob/species/lizard/bodyparts.dmi'
limb_id = SPECIES_LIZARD

/obj/item/bodypart/leg/left/digitigrade
icon_greyscale = 'icons/mob/species/lizard/bodyparts.dmi'
limb_id = BODYPART_ID_DIGITIGRADE
can_be_digitigrade = TRUE
digitigrade_id = "digitigrade"
bodytype = BODYTYPE_HUMANOID | BODYTYPE_ORGANIC | BODYTYPE_DIGITIGRADE

/obj/item/bodypart/leg/left/digitigrade/update_limb(dropping_limb = FALSE, is_creating = FALSE)
. = ..()
if(ishuman(owner))
var/mob/living/carbon/human/human_owner = owner
var/obj/item/clothing/shoes/worn_shoes = human_owner.get_item_by_slot(ITEM_SLOT_FEET)
var/uniform_compatible = FALSE
var/suit_compatible = FALSE
var/shoes_compatible = FALSE
if(!(human_owner.w_uniform) || (human_owner.w_uniform.supports_variations_flags & (CLOTHING_DIGITIGRADE_VARIATION|CLOTHING_DIGITIGRADE_VARIATION_NO_NEW_ICON))) //Checks uniform compatibility
uniform_compatible = TRUE
if((!human_owner.wear_suit) || (human_owner.wear_suit.supports_variations_flags & (CLOTHING_DIGITIGRADE_VARIATION|CLOTHING_DIGITIGRADE_VARIATION_NO_NEW_ICON)) || !(human_owner.wear_suit.body_parts_covered & LEGS)) //Checks suit compatability
suit_compatible = TRUE
if((worn_shoes == null) || (worn_shoes.supports_variations_flags & (CLOTHING_DIGITIGRADE_VARIATION|CLOTHING_DIGITIGRADE_VARIATION_NO_NEW_ICON)))
shoes_compatible = TRUE

if((uniform_compatible && suit_compatible && shoes_compatible) || (suit_compatible && shoes_compatible && human_owner.wear_suit?.flags_inv & HIDEJUMPSUIT)) //If the uniform is hidden, it doesnt matter if its compatible
limb_id = BODYPART_ID_DIGITIGRADE

else
limb_id = SPECIES_LIZARD

/obj/item/bodypart/leg/right/digitigrade
/obj/item/bodypart/leg/right/lizard
icon_greyscale = 'icons/mob/species/lizard/bodyparts.dmi'
limb_id = BODYPART_ID_DIGITIGRADE
limb_id = SPECIES_LIZARD
can_be_digitigrade = TRUE
digitigrade_id = "digitigrade"
bodytype = BODYTYPE_HUMANOID | BODYTYPE_ORGANIC | BODYTYPE_DIGITIGRADE

/obj/item/bodypart/leg/right/digitigrade/update_limb(dropping_limb = FALSE, is_creating = FALSE)
. = ..()
if(ishuman(owner))
var/mob/living/carbon/human/human_owner = owner
var/obj/item/clothing/shoes/worn_shoes = human_owner.get_item_by_slot(ITEM_SLOT_FEET)
var/uniform_compatible = FALSE
var/suit_compatible = FALSE
var/shoes_compatible = FALSE
if(!(human_owner.w_uniform) || (human_owner.w_uniform.supports_variations_flags & (CLOTHING_DIGITIGRADE_VARIATION|CLOTHING_DIGITIGRADE_VARIATION_NO_NEW_ICON))) //Checks uniform compatibility
uniform_compatible = TRUE
if((!human_owner.wear_suit) || (human_owner.wear_suit.supports_variations_flags & (CLOTHING_DIGITIGRADE_VARIATION|CLOTHING_DIGITIGRADE_VARIATION_NO_NEW_ICON)) || !(human_owner.wear_suit.body_parts_covered & LEGS)) //Checks suit compatability
suit_compatible = TRUE
if((worn_shoes == null) || (worn_shoes.supports_variations_flags & (CLOTHING_DIGITIGRADE_VARIATION|CLOTHING_DIGITIGRADE_VARIATION_NO_NEW_ICON)))
shoes_compatible = TRUE

if((uniform_compatible && suit_compatible && shoes_compatible) || (suit_compatible && shoes_compatible && human_owner.wear_suit?.flags_inv & HIDEJUMPSUIT)) //If the uniform is hidden, it doesnt matter if its compatible
limb_id = BODYPART_ID_DIGITIGRADE

else
limb_id = SPECIES_LIZARD
10 changes: 10 additions & 0 deletions code/modules/surgery/organs/_organ.dm
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,14 @@
var/list/layers
///Defines what kind of 'organ' we're looking at. Sprites have names like 'm_mothwings_firemoth'. 'mothwings' would then be feature_key
var/feature_key = ""
///Similar to feature key, but overrides it in the case you need more fine control over the iconstate, like with Tails.
var/render_key = ""
///Stores the dna.features[feature_key], used for external organs that can be surgically removed or inserted.
var/stored_feature_id = ""
/// The savefile_key of the preference this relates to. Used for the preferences UI.
var/preference
///Sprite datum we use to draw on the bodypart
var/datum/sprite_accessory/sprite_datum
///With what DNA block do we mutate in mutate_feature() ? For genetics
var/dna_block
///Does this organ have any bodytypes to pass to it's ownerlimb?
Expand Down Expand Up @@ -83,6 +89,10 @@ INITIALIZE_IMMEDIATE(/obj/item/organ)
if(!sprite_datum && stored_feature_id)
stack_trace("External organ has no valid sprite datum for name [sprite_name]")

///Return a dumb glob list for this specific feature (called from parse_sprite)
/obj/item/organ/proc/get_global_feature_list()
CRASH("External organ has no feature list, it will render invisible")

/*
* Insert the organ into the select mob.
*
Expand Down
Binary file modified icons/mob/species/lizard/bodyparts.dmi
Binary file not shown.
Binary file modified icons/mob/species/lizard/lizard_misc.dmi
Binary file not shown.
10 changes: 10 additions & 0 deletions monkestation/code/modules/mob/living/carbon/human/lizard_gags.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/obj/item
var/datum/greyscale_config/greyscale_config_worn_lizard_fallback

/obj/item/clothing/shoes
species_clothing_color_coords = list(list(UNDER_COLORPIXEL_X_1, UNDER_COLORPIXEL_Y_1), list(UNDER_COLORPIXEL_X_2, UNDER_COLORPIXEL_Y_2))
greyscale_config_worn_lizard_fallback = /datum/greyscale_config/lizard/shoes

/obj/item/clothing/under
species_clothing_color_coords = list(list(UNDER_COLORPIXEL_X_1, UNDER_COLORPIXEL_Y_1), list(UNDER_COLORPIXEL_X_2, UNDER_COLORPIXEL_Y_2))
greyscale_config_worn_lizard_fallback = /datum/greyscale_config/lizard/under
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,17 @@
if(prob(1))
return 'monkestation/sound/voice/weh.ogg'
return 'monkestation/sound/voice/laugh/lizard/lizard_laugh.ogg'

/datum/species/lizard/get_custom_worn_config_fallback(item_slot, obj/item/item)

return item.greyscale_config_worn_lizard_fallback

/datum/species/lizard/generate_custom_worn_icon(item_slot, obj/item/item)
. = ..()
if(.)
return

// Use the fancy fallback sprites.
. = generate_custom_worn_icon_fallback(item_slot, item)
if(.)
return
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified monkestation/icons/mob/species/lizard/multipart.dmi
Binary file not shown.
Binary file modified monkestation/icons/mob/species/misc/feet_digi.dmi
Binary file not shown.
Binary file modified monkestation/icons/mob/species/misc/uniform_digi.dmi
Binary file not shown.
Loading

0 comments on commit e2c3f3d

Please sign in to comment.