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

Fixes Lizard Customization At Long Last, Cleans Up Some Of My Prefs Shitcode #483

Merged
merged 6 commits into from
Dec 19, 2023
Merged
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
2 changes: 1 addition & 1 deletion code/modules/client/preferences/_preference.dm
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ GLOBAL_LIST_INIT(preference_entries_by_key, init_preference_entries_by_key())

abstract_type = /datum/preference/choiced

/// A list of the four co-ordinates to crop to, if `generate_icons` is enabled. Useful for icons whose main contents are smaller than 32x32. Please keep it square.
/// A list of the four co-ordinates to crop to, if `generate_icons` is enabled. Useful for icons whose main contents are smaller than 32x32. Please keep it square. (x1, y1, x2, y2)
var/list/crop_area
/// A color to apply to the icon if it's greyscale, and `generate_icons` is enabled.
var/greyscale_color
Expand Down
9 changes: 4 additions & 5 deletions code/modules/client/preferences/species_features/_mutant.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
var/color_feature_id
/// The global list containing the sprite accessories to use. Override New to set.
var/list/sprite_accessory
/// The typepath of the external organ to add.
var/organ_to_add
/// Direction to render the preview on. Can take NORTH, SOUTH, EAST, WEST.
var/sprite_direction = SOUTH
/// A list of types to exclude, including their subtypes.
Expand All @@ -24,13 +22,14 @@

/datum/preference/choiced/mutant/apply_to_human(mob/living/carbon/human/target, value, datum/preferences/preferences)
target.dna.features[relevant_mutant_bodypart] = value
if(organ_to_add)
var/datum/sprite_accessory/accessory = sprite_accessory[value]

var/datum/sprite_accessory/accessory = sprite_accessory[value]
if(accessory.organ_type_to_use)
if(!accessory)
CRASH("Accessory is null for [value]!")
if(accessory.name == "None" || !is_accessible(preferences))
return
var/obj/item/organ/external/new_organ_to_add = new organ_to_add(FALSE, accessory.type)
var/obj/item/organ/external/new_organ_to_add = new accessory.organ_type_to_use(FALSE, accessory.type)
new_organ_to_add.Insert(target, TRUE, FALSE)

/datum/preference/choiced/mutant/is_accessible(datum/preferences/preferences)
Expand Down
3 changes: 0 additions & 3 deletions code/modules/client/preferences/species_features/human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
greyscale_color = COLOR_DARK_BROWN
main_feature_name = "Tail"
color_feature_id = "tail_human_color"
organ_to_add = /obj/item/organ/external/tail
sprite_direction = NORTH
accessories_to_ignore = list(/datum/sprite_accessory/tails/lizard)

Expand All @@ -30,7 +29,6 @@ MUTANT_CHOICED_NEW(tail_human, GLOB.tails_list)
greyscale_color = COLOR_DARK_BROWN
main_feature_name = "Ears"
color_feature_id = "ears_color"
organ_to_add = /obj/item/organ/internal/ears
crop_area = list(11, 22, 21, 32) // We want just the head area.

MUTANT_CHOICED_NEW(ears, GLOB.ears_list)
Expand All @@ -53,7 +51,6 @@ MUTANT_CHOICED_NEW(ears, GLOB.ears_list)
greyscale_color = COLOR_DARK_BROWN
main_feature_name = "Horns"
color_feature_id = "horns_color"
organ_to_add = /obj/item/organ/external/horns
crop_area = list(11, 22, 21, 32) // We want just the head area.

MUTANT_CHOICED_NEW(horns, GLOB.horns_list)
Expand Down
71 changes: 50 additions & 21 deletions code/modules/client/preferences/species_features/lizard.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@
main_feature_name = "Body markings"
should_generate_icons = TRUE
relevant_mutant_bodypart = "body_markings"
var/sprite_accessory // Shitcode cause I don't want to write new code to do the same shit as mutant stuff

/datum/preference/choiced/lizard_body_markings/New()
. = ..()
sprite_accessory = GLOB.body_markings_list

/datum/preference/choiced/lizard_body_markings/compile_constant_data()
. = ..()
.[SUPPLEMENTAL_FEATURE_KEY] = "body_markings_color"

/datum/preference/choiced/lizard_body_markings/init_possible_values()
var/list/values = list()
Expand Down Expand Up @@ -36,13 +45,17 @@
/datum/preference/choiced/lizard_body_markings/apply_to_human(mob/living/carbon/human/target, value, datum/preferences/preferences)
target.dna.features["body_markings"] = value

/datum/preference/color/mutant/lizard_body_markings
savefile_key = "body_markings_color"
relevant_mutant_bodypart = "body_markings"
choiced_preference_datum = /datum/preference/choiced/lizard_body_markings

/datum/preference/choiced/mutant/lizard_frills
savefile_key = "feature_lizard_frills"
main_feature_name = "Frills"
relevant_mutant_bodypart = MUTANT_FRILLS
should_generate_icons = TRUE
color_feature_id = "lizard_frills_color"
organ_to_add = /obj/item/organ/external/frills
sprite_direction = EAST
greyscale_color = COLOR_VIBRANT_LIME
crop_area = list(11, 22, 21, 32) // We want just the head.
Expand Down Expand Up @@ -83,7 +96,6 @@ MUTANT_CHOICED_NEW(lizard_frills, GLOB.frills_list)
should_generate_icons = TRUE
relevant_mutant_bodypart = MUTANT_SNOUT
color_feature_id = "lizard_snout_color"
organ_to_add = /obj/item/organ/external/snout
sprite_direction = EAST
greyscale_color = COLOR_VIBRANT_LIME
crop_area = list(14, 22, 24, 32) // We want just the head.
Expand All @@ -101,30 +113,47 @@ MUTANT_CHOICED_NEW(lizard_snout, GLOB.snouts_list)
relevant_mutant_bodypart = MUTANT_SNOUT
choiced_preference_datum = /datum/preference/choiced/mutant/lizard_snout

/datum/preference/choiced/lizard_spines
/datum/preference/choiced/mutant/lizard_spines
savefile_key = "feature_lizard_spines"
savefile_identifier = PREFERENCE_CHARACTER
category = PREFERENCE_CATEGORY_APPEARANCE_LIST
relevant_mutant_bodypart = "spines"
main_feature_name = "Spines"
should_generate_icons = TRUE
relevant_mutant_bodypart = MUTANT_SPINES
color_feature_id = "lizard_spines_color"
sprite_direction = NORTH
greyscale_color = COLOR_VIBRANT_LIME

/datum/preference/choiced/lizard_spines/init_possible_values()
return assoc_to_keys(GLOB.spines_list)
MUTANT_CHOICED_NEW(lizard_spines, GLOB.spines_list)

/datum/preference/choiced/lizard_spines/apply_to_human(mob/living/carbon/human/target, value, datum/preferences/preferences)
target.dna.features["spines"] = value
/datum/preference/choiced/mutant/lizard_spines/generate_icon_state(datum/sprite_accessory/sprite_accessory, original_icon_state, suffix)
return "m_spines_[original_icon_state]_ADJ[suffix]"

/datum/preference/choiced/lizard_tail
/datum/preference/choiced/mutant/lizard_spines/create_default_value()
return pick(sprite_accessory)

/datum/preference/color/mutant/lizard_spines
savefile_key = "lizard_spines_color"
relevant_mutant_bodypart = MUTANT_SPINES
choiced_preference_datum = /datum/preference/choiced/mutant/lizard_spines

/datum/preference/choiced/mutant/lizard_tail
savefile_key = "feature_lizard_tail"
savefile_identifier = PREFERENCE_CHARACTER
category = PREFERENCE_CATEGORY_APPEARANCE_LIST
relevant_external_organ = /obj/item/organ/external/tail/lizard
main_feature_name = "Lizard Tail"
should_generate_icons = TRUE
relevant_mutant_bodypart = MUTANT_LIZARD_TAIL
color_feature_id = "lizard_tail_color"
sprite_direction = SOUTH
greyscale_color = COLOR_VIBRANT_LIME
crop_area = list(1, 1, 20, 20) // We want just the lower+mid left legs+torso area.

/datum/preference/choiced/lizard_tail/init_possible_values()
return assoc_to_keys(GLOB.tails_list_lizard)
MUTANT_CHOICED_NEW(lizard_tail, GLOB.tails_list_lizard)

/datum/preference/choiced/lizard_tail/apply_to_human(mob/living/carbon/human/target, value, datum/preferences/preferences)
target.dna.features["tail_lizard"] = value
/datum/preference/choiced/mutant/lizard_tail/generate_icon_state(datum/sprite_accessory/sprite_accessory, original_icon_state, suffix)
return "m_tail_lizard_[original_icon_state]_BEHIND[suffix]"

/datum/preference/choiced/mutant/lizard_tail/create_default_value()
return pick(sprite_accessory)

/datum/preference/choiced/lizard_tail/create_default_value()
var/datum/sprite_accessory/tails/lizard/smooth/tail = /datum/sprite_accessory/tails/lizard/smooth
return initial(tail.name)
/datum/preference/color/mutant/lizard_tail
savefile_key = "lizard_tail_color"
relevant_mutant_bodypart = MUTANT_LIZARD_TAIL
choiced_preference_datum = /datum/preference/choiced/mutant/lizard_tail
4 changes: 3 additions & 1 deletion code/modules/client/preferences/species_features/pod.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
should_generate_icons = TRUE
color_feature_id = "pod_hair_color"

MUTANT_CHOICED_NEW(pod_hair, GLOB.pod_hair_list)

/datum/preference/choiced/mutant/pod_hair/init_possible_values()
var/list/values = list()

Expand All @@ -28,7 +30,7 @@
return values

/datum/preference/choiced/mutant/pod_hair/create_default_value()
return pick(GLOB.pod_hair_list)
return "Cabbage"

/datum/preference/color/mutant/pod_hair
savefile_key = "pod_hair_color"
Expand Down
2 changes: 0 additions & 2 deletions code/modules/client/preferences/species_features/synth.dm
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
relevant_mutant_bodypart = MUTANT_SYNTH_SCREEN
crop_area = list(11, 22, 21, 32) // We want just the head.
color_feature_id = "synth_screen_color"
organ_to_add = /obj/item/organ/external/screen

/datum/preference/choiced/mutant/synth_screen/New()
. = ..()
Expand Down Expand Up @@ -88,7 +87,6 @@
crop_area = list(11, 22, 21, 32) // We want just the head.
color_feature_id = "synth_antenna_color"
greyscale_color = DEFAULT_SYNTH_PART_COLOR
organ_to_add = /obj/item/organ/external/synth_antenna

MUTANT_CHOICED_NEW(synth_antenna, GLOB.synth_antennae)

Expand Down
1 change: 0 additions & 1 deletion code/modules/mob/dead/new_player/sprite_accessories.dm
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ GLOBAL_LIST_INIT(sprite_accessory_layers, list( \
/datum/sprite_accessory/New()
. = ..()
if(color_src == TRI_COLOR_LAYERS)
color_layer_names = list()
if(!GLOB.cached_sprite_accessory_sprites[icon])
GLOB.cached_sprite_accessory_sprites[icon] = icon_states(new /icon(icon))
for(var/layer in GLOB.sprite_accessory_layers)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
key = "ears"
em_block = TRUE
color_src = TRI_COLOR_LAYERS
organ_type_to_use = /obj/item/organ/internal/ears

/datum/sprite_accessory/ears/none
name = "None"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/datum/sprite_accessory/frills
icon = 'icons/mob/species/lizard/lizard_misc.dmi'
organ_type_to_use = /obj/item/organ/external/frills

/datum/sprite_accessory/frills/none
name = "None"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Oh man, these really are horny
/datum/sprite_accessory/horns
icon = 'icons/mob/species/lizard/lizard_misc.dmi'
em_block = TRUE
organ_type_to_use = /obj/item/organ/external/horns

/datum/sprite_accessory/horns/none
name = "None"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/datum/sprite_accessory/snouts
icon = 'icons/mob/species/lizard/lizard_misc.dmi'
em_block = TRUE
organ_type_to_use = /obj/item/organ/external/snout

/datum/sprite_accessory/snouts/sharp
name = "Sharp"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
/datum/sprite_accessory/spines
icon = 'icons/mob/species/lizard/lizard_spines.dmi'
em_block = TRUE
organ_type_to_use = /obj/item/organ/external/spines

/datum/sprite_accessory/spines_animated
icon = 'icons/mob/species/lizard/lizard_spines.dmi'
em_block = TRUE
// This shouldn't be needed... but shitcode has it's ways.
organ_type_to_use = /obj/item/organ/external/spines

/datum/sprite_accessory/spines/none
name = "None"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
/datum/sprite_accessory/tails/lizard
icon = 'icons/mob/species/lizard/lizard_tails.dmi'
key = "tail_lizard"
organ_type_to_use = /obj/item/organ/external/tail/lizard

/datum/sprite_accessory/tails/lizard/smooth
name = "Smooth"
Expand Down
2 changes: 2 additions & 0 deletions code/modules/mob/dead/new_player/synth_sprite_accessories.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
icon = 'icons/mob/species/synth/screens.dmi'
gender_specific = FALSE
color_src = null
organ_type_to_use = /obj/item/organ/external/screen

/datum/sprite_accessory/screen/none
name = "None"
Expand Down Expand Up @@ -148,6 +149,7 @@
/datum/sprite_accessory/antenna
icon = 'icons/mob/species/synth/synth_antennas.dmi'
key = "synth_antenna"
organ_type_to_use = /obj/item/organ/external/synth_antenna

/datum/sprite_accessory/antenna/none
name = "None"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@
MUTANT_HORNS = "None",
MUTANT_FRILLS = "None",
MUTANT_SNOUT = "Round",
MUTANT_SPINES = "Long",
MUTANT_LIZARD_TAIL = "Smooth",
)
external_organs = list(
/obj/item/organ/external/spines = "None",
/obj/item/organ/external/tail/lizard = "Smooth",
)
mutanttongue = /obj/item/organ/internal/tongue/lizard
coldmod = 1.5
heatmod = 0.67
Expand Down
2 changes: 1 addition & 1 deletion code/modules/surgery/organs/external/tails.dm
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,4 @@

/obj/item/organ/external/tail/lizard/fake
name = "fabricated lizard tail"
desc = "A fabricated severed lizard tail. This one's made of synthflesh. Probably not usable for lizard wine."
desc = "A fabricated severed lizard tail."
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,18 @@ export const lizard_snout_color: Feature<string> = {
name: 'Snout Color',
component: FeatureTriColorInput,
};

export const lizard_tail_color: Feature<string> = {
name: 'Tail Color',
component: FeatureTriColorInput,
};

export const lizard_spines_color: Feature<string> = {
name: 'Spines Color',
component: FeatureTriColorInput,
};

export const body_markings_color: Feature<string> = {
name: 'Body Markings Color',
component: FeatureTriColorInput,
};