Skip to content

Commit

Permalink
Merge pull request #1150 from ariaworld/custom-blood-color
Browse files Browse the repository at this point in the history
[SEMI-MODULAR] Adds custom blood color in character creator!
  • Loading branch information
MosleyTheMalO authored May 17, 2024
2 parents 094bfdd + b5d7da4 commit 1f8582f
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 2 deletions.
4 changes: 4 additions & 0 deletions code/datums/dna.dm
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@
destination.dna.features = features.Copy()
destination.set_species(species.type, icon_update=0)
destination.dna.species.say_mod = species.say_mod
// Added by SPLURT (Custom Blood Color)
destination.dna.species.exotic_blood_color = species.exotic_blood_color
destination.dna.species.exotic_blood_blend_mode = species.exotic_blood_blend_mode
// SPLURT Edit end
destination.dna.real_name = real_name
destination.dna.nameless = nameless
destination.dna.custom_species = custom_species
Expand Down
3 changes: 3 additions & 0 deletions code/game/area/areas.dm
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,9 @@ GLOBAL_LIST_EMPTY(teleportlocs)
if(!L.ckey)
return

if(!L.client)
return

// Ambience goes down here -- make sure to list each area separately for ease of adding things in later, thanks! Note: areas adjacent to each other should have the same sounds to prevent cutoff when possible.- LastyScratch
if(L.client && !L.client.ambience_playing && L.client.prefs.toggles & SOUND_SHIP_AMBIENCE)
L.client.ambience_playing = 1
Expand Down
25 changes: 25 additions & 0 deletions code/modules/client/preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ GLOBAL_LIST_EMPTY(preferences_datums)
var/pda_color = "#808000"
var/pda_skin = PDA_SKIN_ALT

// Added by SPLURT (Custom Blood Color)
var/custom_blood_color = FALSE
var/blood_color = BLOOD_COLOR_UNIVERSAL
///

var/uses_glasses_colour = 0

Expand Down Expand Up @@ -702,6 +706,12 @@ GLOBAL_LIST_EMPTY(preferences_datums)
dat += "<BR>"
dat += "<b>Species:</b><a style='display:block;width:100px' href='?_src_=prefs;preference=species;task=input'>[pref_species.name]</a><BR>"
dat += "<b>Custom Species Name:</b><a style='display:block;width:100px' href='?_src_=prefs;preference=custom_species;task=input'>[custom_species ? custom_species : "None"]</a><BR>"
//Added by SPLURT (Custom Blood Color)
dat += "<b>Custom Blood Color:</b>"
dat += "<a style='display:block;width:100px' href='?_src_=prefs;preference=toggle_custom_blood_color;task=input'>[custom_blood_color ? "Enabled" : "Disabled"]</a><BR>"
if(custom_blood_color)
dat += "<b>Blood Color:</b> <span style='border:1px solid #161616; background-color: [blood_color];'><font color='[color_hex2num(blood_color) < 200 ? "FFFFFF" : "000000"]'>[blood_color]</font></span> <a href='?_src_=prefs;preference=blood_color;task=input'>Change</a><BR>"
///
dat += "<b>Random Body:</b><a style='display:block;width:100px' href='?_src_=prefs;preference=all;task=random'>Randomize!</A><BR>"
dat += "<b>Always Random Body:</b><a href='?_src_=prefs;preference=all'>[be_random_body ? "Yes" : "No"]</A><BR>"
dat += "<br><b>Cycle background:</b><a style='display:block;width:100px' href='?_src_=prefs;preference=cycle_bg;task=input'>[bgstate]</a><BR>"
Expand Down Expand Up @@ -3239,6 +3249,18 @@ GLOBAL_LIST_EMPTY(preferences_datums)
QDEL_NULL(parent.mob.hud_used)
parent.mob.create_mob_hud()
parent.mob.hud_used.show_hud(1, parent.mob)
//Added by SPLURT (Custom Blood Color)
if("toggle_custom_blood_color")
custom_blood_color = !custom_blood_color
if("blood_color")
var/pickedBloodColor = input(user, "Choose your blood color.", "Character Preference", blood_color) as color|null
if(!pickedBloodColor)
return
if(pickedBloodColor)
blood_color = sanitize_hexcolor(pickedBloodColor, 6, 1, initial(blood_color))
if(!custom_blood_color)
custom_blood_color = TRUE
///
if("pda_style")
var/pickedPDAStyle = input(user, "Choose your PDA style.", "Character Preference", pda_style) as null|anything in GLOB.pda_styles
if(pickedPDAStyle)
Expand Down Expand Up @@ -4241,6 +4263,9 @@ GLOBAL_LIST_EMPTY(preferences_datums)
character.dna.real_name = character.real_name
character.dna.nameless = character.nameless
character.dna.custom_species = character.custom_species
// Added by SPLURT (Custom Blood Color)
if(custom_blood_color)
character.dna.species.exotic_blood_color = blood_color

var/old_size = RESIZE_DEFAULT_SIZE
if(isdwarf(character))
Expand Down
4 changes: 4 additions & 0 deletions modular_splurt/code/modules/client/preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,10 @@
dat += "<BR>"
dat += "<b>Species:</b><a style='display:block;width:100px' href='?_src_=prefs;preference=species;task=input'>[pref_species.name]</a><BR>"
dat += "<b>Custom Species Name:</b><a style='display:block;width:100px' href='?_src_=prefs;preference=custom_species;task=input'>[custom_species ? custom_species : "None"]</a><BR>"
dat += "<b>Custom Blood Color:</b>"
dat += "<a href='?_src_=prefs;preference=custom_blood_color'>[custom_blood_color ? "Enabled" : "Disabled"]</a><BR>"
if(custom_blood_color)
dat += "<b>Blood Color:</b> <span style='border:1px solid #161616; background-color: [blood_color];'><font color='[color_hex2num(blood_color) < 200 ? "FFFFFF" : "000000"]'>[blood_color]</font></span> <a href='?_src_=prefs;preference=blood_color;task=input'>Change</a><BR>"
dat += "<b>Random Body:</b><a style='display:block;width:100px' href='?_src_=prefs;preference=all;task=random'>Randomize!</A><BR>"
dat += "<b>Always Random Body:</b><a href='?_src_=prefs;preference=all'>[be_random_body ? "Yes" : "No"]</A><BR>"
dat += "<br><b>Cycle background:</b><a style='display:block;width:100px' href='?_src_=prefs;preference=cycle_bg;task=input'>[bgstate]</a><BR>"
Expand Down
14 changes: 12 additions & 2 deletions modular_splurt/code/modules/client/preferences_savefile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,22 @@
// Get stomping preferences.
S["stomp_pref"] >> stomppref

//Fuzzy scaling
// Fuzzy scaling
S["feature_fuzzy"] >> fuzzy

// Custom blood color
S["custom_blood_color"] >> custom_blood_color // TRUE/FALSE - If custom blood color is enabled
S["blood_color"] >> blood_color // The custom blood color itself

//sanitize data
show_in_directory = sanitize_integer(show_in_directory, 0, 1, initial(show_in_directory))
directory_tag = sanitize_inlist(directory_tag, GLOB.char_directory_tags, initial(directory_tag))
directory_erptag = sanitize_inlist(directory_erptag, GLOB.char_directory_erptags, initial(directory_erptag))
directory_ad = strip_html_simple(directory_ad, MAX_FLAVOR_LEN)
stomppref = sanitize_integer(stomppref, 0, 1, initial(stomppref))
fuzzy = sanitize_integer(fuzzy, 0, 1, initial(fuzzy))
custom_blood_color = sanitize_integer(custom_blood_color, 0, 1, initial(custom_blood_color))
blood_color = sanitize_hexcolor(blood_color, 6, 1, initial(blood_color))

/datum/preferences/proc/splurt_character_pref_save(savefile/S) //TODO: modularize our other savefile edits... maybe?
//Character directory
Expand All @@ -29,9 +35,13 @@
// Stomping preferences.
WRITE_FILE(S["stomp_pref"], stomppref)

//Fuzzy scaling
// Fuzzy scaling
WRITE_FILE(S["feature_fuzzy"] , fuzzy)

// Custom blood color
WRITE_FILE(S["custom_blood_color"], custom_blood_color)
WRITE_FILE(S["blood_color"], blood_color)

/datum/preferences/update_preferences(current_version, savefile/S)
. = ..()
if(current_version < 57.01) //a
Expand Down

0 comments on commit 1f8582f

Please sign in to comment.