mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 18:53:06 +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:
@@ -72,6 +72,10 @@
|
||||
for(var/datum/category_group/player_setup_category/PS in categories)
|
||||
PS.save_preferences(S)
|
||||
|
||||
/datum/category_collection/player_setup_collection/proc/copy_to_mob(var/mob/living/carbon/human/C)
|
||||
for(var/datum/category_group/player_setup_category/PS in categories)
|
||||
PS.copy_to_mob(C)
|
||||
|
||||
/datum/category_collection/player_setup_collection/proc/header()
|
||||
var/dat = ""
|
||||
for(var/datum/category_group/player_setup_category/PS in categories)
|
||||
@@ -143,6 +147,12 @@
|
||||
for(var/datum/category_item/player_setup_item/PI in items)
|
||||
PI.save_preferences(S)
|
||||
|
||||
/datum/category_group/player_setup_category/proc/copy_to_mob(var/mob/living/carbon/human/C)
|
||||
for(var/datum/category_item/player_setup_item/PI in items)
|
||||
PI.sanitize_character()
|
||||
for(var/datum/category_item/player_setup_item/PI in items)
|
||||
PI.copy_to_mob(C)
|
||||
|
||||
/datum/category_group/player_setup_category/proc/content(var/mob/user)
|
||||
. = "<table style='width:100%'><tr style='vertical-align:top'><td style='width:50%'>"
|
||||
var/current = 0
|
||||
@@ -201,6 +211,12 @@
|
||||
/datum/category_item/player_setup_item/proc/save_preferences(var/savefile/S)
|
||||
return
|
||||
|
||||
/*
|
||||
* Called when the item is asked to apply its per character settings to a new mob.
|
||||
*/
|
||||
/datum/category_item/player_setup_item/proc/copy_to_mob(var/mob/living/carbon/human/C)
|
||||
return
|
||||
|
||||
/datum/category_item/player_setup_item/proc/content()
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user