/datum/preferences
var/preferences_enabled = null
var/preferences_disabled = null
/datum/category_item/player_setup_item/player_global/settings
name = "Settings"
sort_order = 2
/datum/category_item/player_setup_item/player_global/settings/load_preferences(var/savefile/S)
S["lastchangelog"] >> pref.lastchangelog
S["lastnews"] >> pref.lastnews
S["lastlorenews"] >> pref.lastlorenews
S["default_slot"] >> pref.default_slot
S["preferences"] >> pref.preferences_enabled
S["preferences_disabled"] >> pref.preferences_disabled
/datum/category_item/player_setup_item/player_global/settings/save_preferences(var/savefile/S)
S["lastchangelog"] << pref.lastchangelog
S["lastnews"] << pref.lastnews
S["lastlorenews"] << pref.lastlorenews
S["default_slot"] << pref.default_slot
S["preferences"] << pref.preferences_enabled
S["preferences_disabled"] << pref.preferences_disabled
/datum/category_item/player_setup_item/player_global/settings/sanitize_preferences()
// Ensure our preferences are lists.
if(!istype(pref.preferences_enabled, /list))
pref.preferences_enabled = list()
if(!istype(pref.preferences_disabled, /list))
pref.preferences_disabled = list()
// Arrange preferences that have never been enabled/disabled.
var/list/client_preference_keys = list()
for(var/datum/client_preference/client_pref as anything in get_client_preferences())
client_preference_keys += client_pref.key
if((client_pref.key in pref.preferences_enabled) || (client_pref.key in pref.preferences_disabled))
continue
if(client_pref.enabled_by_default)
pref.preferences_enabled += client_pref.key
else
pref.preferences_disabled += client_pref.key
// Clean out preferences that no longer exist.
for(var/key in pref.preferences_enabled)
if(!(key in client_preference_keys))
pref.preferences_enabled -= key
for(var/key in pref.preferences_disabled)
if(!(key in client_preference_keys))
pref.preferences_disabled -= key
pref.lastchangelog = sanitize_text(pref.lastchangelog, initial(pref.lastchangelog))
pref.lastnews = sanitize_text(pref.lastnews, initial(pref.lastnews))
pref.default_slot = sanitize_integer(pref.default_slot, 1, CONFIG_GET(number/character_slots), initial(pref.default_slot)) // CHOMPEdit
/datum/category_item/player_setup_item/player_global/settings/content(var/mob/user)
. = list()
. += "Preferences
"
. += "
| [client_pref.description]: | " if(pref_mob.is_preference_enabled(client_pref.key)) . += "[client_pref.enabled_description] | [client_pref.disabled_description] | " else . += "[client_pref.enabled_description] | [client_pref.disabled_description] | " . += "