mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
Move preferences copy_to() new player mobs into the preference_setup datums.
* The /datum/category_item/player_setup_item datums did a good job of organizing the code for loading/saving/editing preferences data, but all of the code that applies preferences to newly created player mobs was still in a single function. * This change adds a new proc to player_setup_item datums: copy_to_mob() which is called from the traditional copy_to() proc, allowing each preferences datum to apply its own character data to the mob. * This allowes new preferences to easily compartmentalize their new code. * I also moved all the code for existing preferences from copy_to() into the copy_to_mob() on their respective preferences datums.
This commit is contained in:
@@ -40,6 +40,25 @@ datum/preferences/proc/set_biological_gender(var/gender)
|
||||
pref.spawnpoint = sanitize_inlist(pref.spawnpoint, spawntypes, initial(pref.spawnpoint))
|
||||
pref.be_random_name = sanitize_integer(pref.be_random_name, 0, 1, initial(pref.be_random_name))
|
||||
|
||||
// Moved from /datum/preferences/proc/copy_to()
|
||||
/datum/category_item/player_setup_item/general/basic/copy_to_mob(var/mob/living/carbon/human/character)
|
||||
if(config.humans_need_surnames)
|
||||
var/firstspace = findtext(pref.real_name, " ")
|
||||
var/name_length = length(pref.real_name)
|
||||
if(!firstspace) //we need a surname
|
||||
pref.real_name += " [pick(last_names)]"
|
||||
else if(firstspace == name_length)
|
||||
pref.real_name += "[pick(last_names)]"
|
||||
|
||||
character.real_name = pref.real_name
|
||||
character.name = character.real_name
|
||||
if(character.dna)
|
||||
character.dna.real_name = character.real_name
|
||||
|
||||
character.gender = pref.biological_gender
|
||||
character.identifying_gender = pref.identifying_gender
|
||||
character.age = pref.age
|
||||
|
||||
/datum/category_item/player_setup_item/general/basic/content()
|
||||
. = list()
|
||||
. += "<b>Name:</b> "
|
||||
|
||||
Reference in New Issue
Block a user