Reformats preferences to take a list, adds belch pref to emote

Preferences can now take a list instead of a singular datum (but will still accept a singular datum for legacy compat), and any arguments that check is_preference_enabled must return true on all prefs from the list, not just one.
This commit is contained in:
Rykka
2021-09-24 15:14:13 -07:00
parent 452067ec99
commit b75c306318
4 changed files with 14 additions and 10 deletions
@@ -83,9 +83,17 @@
return ..()
/**
* This can take either a single preference datum or a list of preferences, and will return true if *all* preferences in the arguments are enabled.
*/
/client/proc/is_preference_enabled(var/preference)
var/datum/client_preference/cp = get_client_preference(preference)
return cp && (cp.key in prefs.preferences_enabled)
if(!islist(preference))
preference = list(preference)
for(var/p in preference)
var/datum/client_preference/cp = get_client_preference(p)
if(!cp || !(cp.key in prefs.preferences_enabled))
return FALSE
return TRUE
/client/proc/set_preference(var/preference, var/set_preference)
var/datum/client_preference/cp = get_client_preference(preference)