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

Добавляет второй цвет для рас #75

Merged
merged 9 commits into from
Feb 18, 2024
4 changes: 3 additions & 1 deletion code/__DEFINES/DNA.dm
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@
#define DNA_MOTH_MARKINGS_BLOCK 13
#define DNA_MUSHROOM_CAPS_BLOCK 14
#define DNA_POD_HAIR_BLOCK 15
#define DNA_MUTANT_COLOR_SECONDARY_BLOCK 16 //Add secondary color for species MASSMETA EDIT

#define DNA_FEATURE_BLOCKS 15
//#define DNA_FEATURE_BLOCKS 15
#define DNA_FEATURE_BLOCKS 16 // add +1 new DNA BLOCK

#define DNA_SEQUENCE_LENGTH 4
#define DNA_MUTATION_BLOCKS 8
Expand Down
2 changes: 2 additions & 0 deletions code/__DEFINES/sprite_accessories.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// ~color source defines for sprite accessories
/// Color of the sprite accessory will match the owner's mutant color, which is granted by certain species
#define MUTANT_COLOR "mutant_color"
///Secondary color of the sprite accessory will match the owner's mutant secondary color, which is granted by certain species
#define MUTANT_COLOR_SECONDARY "mutant_color_secondary" // MASSMETA EDIT
/// Color of the sprite accessory will match the owner's hair color
#define HAIR_COLOR "hair_color"
/// Color of the sprite accessory will match the owner's facial hair color
Expand Down
4 changes: 4 additions & 0 deletions code/__DEFINES/traits/declarations.dm
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,12 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
#define TRAIT_USES_SKINTONES "uses_skintones"
/// Species with this trait use mutant colors for coloration
#define TRAIT_MUTANT_COLORS "mutcolors"
/// Species with this trait use second mutant colors for coloration
#define TRAIT_MUTANT_COLORS_SECONDARY "mutcolors_secondary" // MASSMETA EDIT
/// Species with this trait have mutant colors that cannot be chosen by the player, nor altered ingame by external means
#define TRAIT_FIXED_MUTANT_COLORS "fixed_mutcolors"
/// Species with this trait have second mutant colors that cannot be chosen by the player, nor altered ingame by external means
#define TRAIT_FIXED_MUTANT_COLORS_SECONDARY "fixed_mutcolors_secondary" // MASSMETA EDIT
/// Species with this trait have a haircolor that cannot be chosen by the player, nor altered ingame by external means
#define TRAIT_FIXED_HAIRCOLOR "fixed_haircolor"
/// Humans with this trait won't get bloody hands, nor bloody feet
Expand Down
2 changes: 2 additions & 0 deletions code/_globalvars/traits/_traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ GLOBAL_LIST_INIT(traits_by_type, list(
"TRAIT_FIST_MINING" = TRAIT_FIST_MINING,
"TRAIT_FIXED_HAIRCOLOR" = TRAIT_FIXED_HAIRCOLOR,
"TRAIT_FIXED_MUTANT_COLORS" = TRAIT_FIXED_MUTANT_COLORS,
"TRAIT_FIXED_MUTANT_COLORS_SECONDARY" = TRAIT_FIXED_MUTANT_COLORS_SECONDARY, // MASSMETA EDIT
"TRAIT_FLESH_DESIRE" = TRAIT_FLESH_DESIRE,
"TRAIT_FLOORED" = TRAIT_FLOORED,
"TRAIT_FORBID_MINING_SHUTTLE_CONSOLE_OUTSIDE_STATION" = TRAIT_FORBID_MINING_SHUTTLE_CONSOLE_OUTSIDE_STATION,
Expand Down Expand Up @@ -287,6 +288,7 @@ GLOBAL_LIST_INIT(traits_by_type, list(
"TRAIT_MULTIZ_SUIT_SENSORS" = TRAIT_MULTIZ_SUIT_SENSORS,
"TRAIT_MUSICIAN" = TRAIT_MUSICIAN,
"TRAIT_MUTANT_COLORS" = TRAIT_MUTANT_COLORS,
"TRAIT_MUTANT_COLORS_SECONDARY" = TRAIT_MUTANT_COLORS_SECONDARY, // MASSMETA EDIT
"TRAIT_MUTE" = TRAIT_MUTE,
"TRAIT_NAIVE" = TRAIT_NAIVE,
"TRAIT_NEARSIGHTED_CORRECTED" = TRAIT_NEARSIGHTED_CORRECTED,
Expand Down
2 changes: 2 additions & 0 deletions code/_globalvars/traits/admin_tooling.dm
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ GLOBAL_LIST_INIT(admin_visible_traits, list(
"TRAIT_FIST_MINING" = TRAIT_FIST_MINING,
"TRAIT_FIXED_HAIRCOLOR" = TRAIT_FIXED_HAIRCOLOR,
"TRAIT_FIXED_MUTANT_COLORS" = TRAIT_FIXED_MUTANT_COLORS,
"TRAIT_FIXED_MUTANT_COLORS_SECONDARY" = TRAIT_FIXED_MUTANT_COLORS_SECONDARY, // MASSMETA EDIT
"TRAIT_FLOORED" = TRAIT_FLOORED,
"TRAIT_FORCED_STANDING" = TRAIT_FORCED_STANDING,
"TRAIT_FREERUNNING" = TRAIT_FREERUNNING,
Expand Down Expand Up @@ -120,6 +121,7 @@ GLOBAL_LIST_INIT(admin_visible_traits, list(
"TRAIT_MORBID" = TRAIT_MORBID,
"TRAIT_MUSICIAN" = TRAIT_MUSICIAN,
"TRAIT_MUTANT_COLORS" = TRAIT_MUTANT_COLORS,
"TRAIT_MUTANT_COLORS_SECONDARY" = TRAIT_MUTANT_COLORS_SECONDARY, // MASSMETA EDIT
"TRAIT_MUTE" = TRAIT_MUTE,
"TRAIT_NAIVE" = TRAIT_NAIVE,
"TRAIT_NEVER_WOUNDED" = TRAIT_NEVER_WOUNDED,
Expand Down
8 changes: 8 additions & 0 deletions code/datums/bodypart_overlays/bodypart_overlay.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@
. = get_image(layer, limb)
color_image(., layer, limb)

// Edit START (secondary color)

///Wrapper for getting the proper secondary image, colored and everything
/datum/bodypart_overlay/proc/get_extended_overlay(layer, obj/item/bodypart/limb) // MASSMETA EDIT
return

//Edit END

///Generate the image. Needs to be overriden
/datum/bodypart_overlay/proc/get_image(layer, obj/item/bodypart/limb)
CRASH("Get image needs to be overridden")
Expand Down
14 changes: 14 additions & 0 deletions code/datums/bodypart_overlays/mutant_bodypart_overlay.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,20 @@
draw_color = "#[random_color()]"
imprint_on_next_insertion = FALSE

// Edit START (secondary color)

/datum/bodypart_overlay/mutant/get_extended_overlay(layer, obj/item/bodypart/limb) // MASSMETA EDIT
layer = bitflag_to_layer(layer)
var/passed_color = sprite_datum.color_src ? draw_color : null
var/mob/living/carbon/human/owner = limb.owner
if(!owner)
return
var/datum/species/owner_species = owner.dna.species

return owner_species.return_accessory_layer(-layer, sprite_datum, owner, passed_color)

// Edit END

///Grab a random sprite
/datum/bodypart_overlay/mutant/proc/randomize_sprite()
sprite_datum = get_random_appearance()
Expand Down
22 changes: 21 additions & 1 deletion code/datums/dna.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ GLOBAL_LIST_INIT(identity_block_lengths, list(
*/
GLOBAL_LIST_INIT(features_block_lengths, list(
"[DNA_MUTANT_COLOR_BLOCK]" = DNA_BLOCK_SIZE_COLOR,
"[DNA_MUTANT_COLOR_SECONDARY_BLOCK]" = DNA_BLOCK_SIZE_COLOR, // MASSMETA EDIT
"[DNA_ETHEREAL_COLOR_BLOCK]" = DNA_BLOCK_SIZE_COLOR,
))

Expand Down Expand Up @@ -58,7 +59,7 @@ GLOBAL_LIST_INIT(total_uf_len_by_block, populate_total_uf_len_by_block())
var/datum/species/species = new /datum/species/human
/// Assoc list of feature keys to their value
/// Note if you set these manually, and do not update [unique_features] afterwards, it will likely be reset.
var/list/features = list("mcolor" = "#FFFFFF")
var/list/features = list("mcolor" = "#FFFFFF", "mcolor_secondary" = "#FFFFFF") // MASSMETA EDIT
///Stores the hashed values of the person's non-human features
var/unique_features
///Stores the real name of the person who originally got this dna datum. Used primarely for changelings,
Expand Down Expand Up @@ -200,6 +201,12 @@ GLOBAL_LIST_INIT(total_uf_len_by_block, populate_total_uf_len_by_block())

if(features["mcolor"])
L[DNA_MUTANT_COLOR_BLOCK] = sanitize_hexcolor(features["mcolor"], include_crunch = FALSE)

// Add secondary species color
if(features["mcolor_secondary"])
L[DNA_MUTANT_COLOR_SECONDARY_BLOCK] = sanitize_hexcolor(features["mcolor_secondary"], include_crunch = FALSE) // MASSMETA EDIT
// Edit End

if(features["ethcolor"])
L[DNA_ETHEREAL_COLOR_BLOCK] = sanitize_hexcolor(features["ethcolor"], include_crunch = FALSE)
if(features["body_markings"])
Expand Down Expand Up @@ -336,6 +343,12 @@ GLOBAL_LIST_INIT(total_uf_len_by_block, populate_total_uf_len_by_block())
switch(blocknumber)
if(DNA_MUTANT_COLOR_BLOCK)
set_uni_feature_block(blocknumber, sanitize_hexcolor(features["mcolor"], include_crunch = FALSE))

// Add secondary color for species
if(DNA_MUTANT_COLOR_SECONDARY_BLOCK)
set_uni_feature_block(blocknumber, sanitize_hexcolor(features["mcolor_secondary"], include_crunch = FALSE)) // MASSMETA EDIT
// Edit End

if(DNA_ETHEREAL_COLOR_BLOCK)
set_uni_feature_block(blocknumber, sanitize_hexcolor(features["ethcolor"], include_crunch = FALSE))
if(DNA_LIZARD_MARKINGS_BLOCK)
Expand Down Expand Up @@ -458,6 +471,7 @@ GLOBAL_LIST_INIT(total_uf_len_by_block, populate_total_uf_len_by_block())
features |= random_species.randomize_features()

features["mcolor"] = "#[random_color()]"
features["mcolor_secondary"] = "#[random_color()]" // MASSMETA EDIT

update_dna_identity()

Expand Down Expand Up @@ -630,6 +644,12 @@ GLOBAL_LIST_INIT(total_uf_len_by_block, populate_total_uf_len_by_block())
var/features = dna.unique_features
if(dna.features["mcolor"])
dna.features["mcolor"] = sanitize_hexcolor(get_uni_feature_block(features, DNA_MUTANT_COLOR_BLOCK))

// Add secondary color for species
if(dna.features["mcolor_secondary"])
dna.features["mcolor_secondary"] = sanitize_hexcolor(get_uni_feature_block(features, DNA_MUTANT_COLOR_SECONDARY_BLOCK)) // MASSMETA EDIT
// Edit End

if(dna.features["ethcolor"])
dna.features["ethcolor"] = sanitize_hexcolor(get_uni_feature_block(features, DNA_ETHEREAL_COLOR_BLOCK))
if(dna.features["body_markings"])
Expand Down
16 changes: 16 additions & 0 deletions code/modules/mob/living/carbon/human/_species.dm
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,15 @@ GLOBAL_LIST_EMPTY(features_by_species)
accessory_overlay.color = fixed_mut_color
else
accessory_overlay.color = source.dna.features["mcolor"]

// Edit START (secondary color)
if(MUTANT_COLOR_SECONDARY) // MASSMETA EDIT
if(fixed_mut_color)
accessory_overlay.color = fixed_mut_color
else
accessory_overlay.color = source.dna.features["mcolor_secondary"]
// Edit END

if(HAIR_COLOR)
if(hair_color == "mutcolor")
accessory_overlay.color = source.dna.features["mcolor"]
Expand All @@ -786,6 +795,13 @@ GLOBAL_LIST_EMPTY(features_by_species)
accessory_overlay.color = forced_colour
standing += accessory_overlay

// Edit START (secondary color)

if(length(accessory.external_slots)) // MASSMETA EDIT
standing += return_accessory_layer(layer, accessory, source, accessory_overlay.color)

// Edit END

if(accessory.hasinner)
var/mutable_appearance/inner_accessory_overlay = mutable_appearance(accessory.icon, layer = -layer)
if(accessory.gender_specific)
Expand Down
1 change: 1 addition & 0 deletions code/modules/mob/living/carbon/human/dummy.dm
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ INITIALIZE_IMMEDIATE(/mob/living/carbon/human/dummy)

/proc/create_consistent_human_dna(mob/living/carbon/human/target)
target.dna.features["mcolor"] = COLOR_VIBRANT_LIME
target.dna.features["mcolor_secondary"] = COLOR_VIBRANT_LIME // secondary color MASSMETA EDIT
target.dna.features["ethcolor"] = COLOR_WHITE
target.dna.features["body_markings"] = get_consistent_feature_entry(GLOB.body_markings_list)
target.dna.features["ears"] = get_consistent_feature_entry(GLOB.ears_list)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
id = SPECIES_LIZARD
inherent_traits = list(
TRAIT_MUTANT_COLORS,
TRAIT_MUTANT_COLORS_SECONDARY, // Add secondary color MASSMETA EDIT
TRAIT_TACKLING_TAILED_DEFENDER,
)
inherent_biotypes = MOB_ORGANIC|MOB_HUMANOID|MOB_REPTILE
Expand Down Expand Up @@ -140,6 +141,7 @@ Lizard subspecies: ASHWALKERS
mutantbrain = /obj/item/organ/internal/brain/primitive
inherent_traits = list(
TRAIT_MUTANT_COLORS,
TRAIT_MUTANT_COLORS_SECONDARY, // Add secondary color MASSMETA EDIT
TRAIT_VIRUSIMMUNE,
TRAIT_FORBID_MINING_SHUTTLE_CONSOLE_OUTSIDE_STATION,
)
Expand Down
8 changes: 8 additions & 0 deletions code/modules/surgery/bodyparts/_bodyparts.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1064,6 +1064,14 @@
if(overlay.layers & external_layer)
. += overlay.get_overlay(external_layer, src)

// Edit START (secondary color)

if(overlay.get_extended_overlay(external_layer, src)) // MASSMETA EDIT
for(var/mutable_appearance/item as anything in overlay.get_extended_overlay(external_layer, src))
. += item

// Edit END

return .

///Add a bodypart overlay and call the appropriate update procs
Expand Down
9 changes: 9 additions & 0 deletions code/modules/surgery/organs/external/tails.dm
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,15 @@
else
stop_wag(organ_owner)

// Edit START

owner.update_body_parts() // MASSMETA EDIT
if(ishuman(owner))
var/mob/living/carbon/human/human = owner
human.update_mutant_bodyparts()

// Edit END

///We need some special behaviour for accessories, wrapped here so we can easily add more interactions later
/obj/item/organ/external/tail/proc/start_wag(mob/living/carbon/organ_owner)
if(wag_flags & WAG_WAGGING) // we are already wagging
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/datum/preference/color/mutant_color_secondary
savefile_key = "feature_mcolor_secondary"
savefile_identifier = PREFERENCE_CHARACTER
category = PREFERENCE_CATEGORY_SECONDARY_FEATURES
relevant_inherent_trait = TRAIT_MUTANT_COLORS_SECONDARY

/datum/preference/color/mutant_color_secondary/is_accessible(datum/preferences/preferences)
if (!..(preferences))
return FALSE

var/species_type = preferences.read_preference(/datum/preference/choiced/species)
var/datum/species/species = new species_type
return !(TRAIT_FIXED_MUTANT_COLORS_SECONDARY in species.inherent_traits)

/datum/preference/color/mutant_color_secondary/create_default_value()
return sanitize_hexcolor("[pick("7F", "FF")][pick("7F", "FF")][pick("7F", "FF")]")

/datum/preference/color/mutant_color_secondary/apply_to_human(mob/living/carbon/human/target, value)
target.dna.features["mcolor_secondary"] = value

/datum/preference/color/mutant_color_secondary/is_valid(value)
if (!..(value))
return FALSE

if (is_color_dark(value, 15))
return FALSE

return TRUE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/datum/sprite_accessory
///the body slots outside of the main slot this accessory exists in, so we can draw to those spots seperately
var/list/body_slots = list()
/// the list of external organs covered
var/list/external_slots = list()

/datum/sprite_accessory/body_markings/cbelly
icon = 'massmeta/icons/mob/species/lizard/multipart.dmi'
name = "Color Belly"
external_slots = list(ORGAN_SLOT_EXTERNAL_TAIL, ORGAN_SLOT_EXTERNAL_SNOUT)
icon_state = "cbelly"
gender_specific = 1
color_src = MUTANT_COLOR_SECONDARY
53 changes: 53 additions & 0 deletions massmeta/code/modules/mob/living/carbon/human/accessory_helpers.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/datum/species/proc/return_accessory_layer(layer, datum/sprite_accessory/added_accessory, mob/living/carbon/human/host, passed_color)
var/list/return_list = list()
var/layertext = mutant_bodyparts_layertext(layer)
//var/g = (host.physique == FEMALE) ? "f" : "m"

// add overlay on "external_slots" like tail, head and other parts
for(var/list_item in added_accessory.external_slots)

var/can_hidden_render = return_exernal_render_state(list_item, host)
if(!can_hidden_render)
continue // we just don't need to render it

if(!host.get_organ_slot(list_item))
continue

var/obj/item/organ/external/external_organ = host.get_organ_slot(list_item)

if(!external_organ)
continue

var/external_sprite = external_organ.bodypart_overlay.sprite_datum.icon_state
var/mutable_appearance/new_overlay = mutable_appearance(added_accessory.icon, layer = -layer)

// we only use here m-gender icons because they are same as f-gender icons
if(istype(external_organ.bodypart_overlay, /datum/bodypart_overlay/mutant/tail))
var/datum/bodypart_overlay/mutant/tail/tail = external_organ.bodypart_overlay
if(tail.wagging)
list_item = "[list_item]_wagging"
if(external_sprite == "short")
new_overlay.icon_state = "m_[list_item]_[added_accessory.icon_state]_short_[layertext]"
else
new_overlay.icon_state = "m_[list_item]_[added_accessory.icon_state]_[layertext]"

if(istype(external_organ.bodypart_overlay, /datum/bodypart_overlay/mutant/snout))
new_overlay.icon_state = "m_[list_item]_[added_accessory.icon_state]_[layertext]"

new_overlay.color = passed_color
return_list += new_overlay

return return_list


// check for covered parts by something
/proc/return_exernal_render_state(external_slot, mob/living/carbon/human/human)
switch(external_slot)
if(ORGAN_SLOT_EXTERNAL_TAIL)
if(human.wear_suit && (human.wear_suit.flags_inv & HIDEJUMPSUIT))
return FALSE
return TRUE
if(ORGAN_SLOT_EXTERNAL_SNOUT)
if(!(human.wear_mask?.flags_inv & HIDESNOUT) && !(human.head?.flags_inv & HIDESNOUT))
return TRUE
return FALSE
Binary file added massmeta/icons/mob/species/lizard/multipart.dmi
Binary file not shown.
4 changes: 4 additions & 0 deletions massmeta/includes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@
#include "code\modules\vehicles\cars\cheburek.dm"
#include "code\modules\map_vote.dm"
#include "code\modules\hallucination\fake_chat.dm"
//species secondary color
#include "code\modules\client\preferences\species_features\mutants_color_secondary.dm"
#include "code\modules\mob\dead\new_player\sprite_accessories\multi_part.dm"
#include "code\modules\mob\living\carbon\human\accessory_helpers.dm"
//features
#include "features\additional_circuit\includes.dm"
#include "features\hardsuits\code\_jetpack.dm"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,16 @@ export const feature_lizard_tail: FeatureChoiced = {
},
};

// MASSMETA EDIT
// Add Secondary species color
export const feature_mcolor_secondary: Feature<string> = {
name: 'Mutant Secondary color',
description:
'Apply only on Colored Belly',
component: FeatureColorInput,
};
// End Edit

export const feature_mcolor: Feature<string> = {
name: 'Mutant color',
component: FeatureColorInput,
Expand Down
Loading