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:
Leshana
2016-06-11 16:56:57 -04:00
parent 398709309d
commit fd265861bc
9 changed files with 142 additions and 108 deletions

View File

@@ -30,6 +30,16 @@
pref.nanotrasen_relation = sanitize_inlist(pref.nanotrasen_relation, COMPANY_ALIGNMENTS, initial(pref.nanotrasen_relation))
// Moved from /datum/preferences/proc/copy_to()
/datum/category_item/player_setup_item/general/background/copy_to_mob(var/mob/living/carbon/human/character)
character.med_record = pref.med_record
character.sec_record = pref.sec_record
character.gen_record = pref.gen_record
character.home_system = pref.home_system
character.citizenship = pref.citizenship
character.personal_faction = pref.faction
character.religion = pref.religion
/datum/category_item/player_setup_item/general/background/content(var/mob/user)
. += "<b>Background Information</b><br>"
. += "[company_name] Relation: <a href='?src=\ref[src];nt_relation=1'>[pref.nanotrasen_relation]</a><br/>"