mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-08-22 20:57:23 +01:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user