Makes it possible to have more than 16 preferences

This commit is contained in:
Yoshax
2016-03-21 18:56:27 +00:00
parent 996ce92f7f
commit 5d9596a72d
34 changed files with 305 additions and 310 deletions

View File

@@ -25,26 +25,6 @@
#define PROCESS_KILL 26 // Used to trigger removal from a processing list.
#define MAX_GEAR_COST 10 // Used in chargen for accessory loadout limit.
// Preference toggles.
#define SOUND_ADMINHELP 0x1
#define SOUND_MIDI 0x2
#define SOUND_AMBIENCE 0x4
#define SOUND_LOBBY 0x8
#define CHAT_OOC 0x10
#define CHAT_DEAD 0x20
#define CHAT_GHOSTEARS 0x40
#define CHAT_GHOSTSIGHT 0x80
#define CHAT_PRAYER 0x100
#define CHAT_RADIO 0x200
#define CHAT_ATTACKLOGS 0x400
#define CHAT_DEBUGLOGS 0x800
#define CHAT_LOOC 0x1000
#define CHAT_GHOSTRADIO 0x2000
#define SHOW_TYPING 0x4000
#define CHAT_NOICONS 0x8000
#define TOGGLES_DEFAULT (SOUND_ADMINHELP|SOUND_MIDI|SOUND_AMBIENCE|SOUND_LOBBY|CHAT_OOC|CHAT_DEAD|CHAT_GHOSTEARS|CHAT_GHOSTSIGHT|CHAT_PRAYER|CHAT_RADIO|CHAT_ATTACKLOGS|CHAT_LOOC)
// For secHUDs and medHUDs and variants. The number is the location of the image on the list hud_list of humans.
#define HEALTH_HUD 1 // A simple line rounding the mob's number health.
#define STATUS_HUD 2 // Alive, dead, diseased, etc.

View File

@@ -244,7 +244,7 @@
var/turf/ear = get_turf(M)
if(ear)
// Ghostship is magic: Ghosts can hear radio chatter from anywhere
if(speaker_coverage[ear] || (istype(M, /mob/observer/dead) && (M.client) && (M.client.prefs.toggles & CHAT_GHOSTRADIO)))
if(speaker_coverage[ear] || (istype(M, /mob/observer/dead) && M.is_preference_enabled(/datum/client_preference/ghost_radio)))
. |= M // Since we're already looping through mobs, why bother using |= ? This only slows things down.
return .

View File

@@ -31,7 +31,7 @@
diary << "\[[time_stamp()]]DEBUG: [text][log_end]"
for(var/client/C in admins)
if(C.prefs.toggles & CHAT_DEBUGLOGS)
if(C.is_preference_enabled(/datum/client_preference/admin/show_debug_logs))
C << "DEBUG: [text]"
@@ -91,7 +91,7 @@
if(dir & WEST) comps += "WEST"
if(dir & UP) comps += "UP"
if(dir & DOWN) comps += "DOWN"
return english_list(comps, nothing_text="0", and_text="|", comma_text="|")
//more or less a logging utility

View File

@@ -304,7 +304,7 @@ proc/TextPreview(var/string,var/len=40)
// to always create it and then throw it out.
/var/icon/text_tag_icons = new('./icons/chattags.dmi')
/proc/create_text_tag(var/tagname, var/tagdesc = tagname, var/client/C = null)
if(C && (C.prefs.toggles & CHAT_NOICONS))
if(!(C && C.is_preference_enabled(/datum/client_preference/chat_tags)))
return tagdesc
return "<IMG src='\ref[text_tag_icons.icon]' class='text_tag' iconstate='[tagname]'" + (tagdesc ? " alt='[tagdesc]'" : "") + ">"

View File

@@ -243,7 +243,7 @@ var/list/mob/living/forced_ambiance_list = new
/area/proc/play_ambience(var/mob/living/L)
// Ambience goes down here -- make sure to list each area seperately for ease of adding things in later, thanks! Note: areas adjacent to each other should have the same sounds to prevent cutoff when possible.- LastyScratch
if(!(L && L.client && (L.client.prefs.toggles & SOUND_AMBIENCE))) return
if(!(L && L.is_preference_enabled(/datum/client_preference/play_ambiance))) return
// If we previously were in an area with force-played ambiance, stop it.
if(L in forced_ambiance_list)

View File

@@ -286,19 +286,14 @@ var/message_delay = 0 // To make sure restarting the recentmessages list is kept
for (var/mob/R in receive)
/* --- Loop through the receivers and categorize them --- */
if (R.client)
if(R.client.prefs)
if(!(R.client.prefs.toggles & CHAT_RADIO)) //Adminning with 80 people on can be fun when you're trying to talk and all you can hear is radios.
continue
else
log_debug("Client prefs found to be null in /proc/Broadcast_Message() for mob [R] and client [R.ckey], this should be investigated.")
if (!R.is_preference_enabled(/datum/client_preference/holder/hear_radio))
continue
if(istype(R, /mob/new_player)) // we don't want new players to hear messages. rare but generates runtimes.
continue
// Ghosts hearing all radio chat don't want to hear syndicate intercepts, they're duplicates
if(data == 3 && istype(R, /mob/observer/dead) && R.client && R.client.prefs && (R.client.prefs.toggles & CHAT_GHOSTRADIO))
if(data == 3 && istype(R, /mob/observer/dead) && R.is_preference_enabled(/datum/client_preference/ghost_radio))
continue
// --- Check for compression ---
@@ -494,12 +489,8 @@ var/message_delay = 0 // To make sure restarting the recentmessages list is kept
/* --- Loop through the receivers and categorize them --- */
if (R.client)
if(R.client.prefs)
if(!(R.client.prefs.toggles & CHAT_RADIO)) //Adminning with 80 people on can be fun when you're trying to talk and all you can hear is radios.
continue
else
log_debug("Client prefs found to be null in /proc/Broadcast_SimpleMessage() for mob [R] and client [R.ckey], this should be investigated.")
if(!R.is_preference_enabled(/datum/client_preference/holder/hear_radio)) //Adminning with 80 people on can be fun when you're trying to talk and all you can hear is radios.
continue
// --- Check for compression ---

View File

@@ -990,7 +990,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
tnote.Add(list(list("sent" = 1, "owner" = "[P.owner]", "job" = "[P.ownjob]", "message" = "[t]", "target" = "\ref[P]")))
P.tnote.Add(list(list("sent" = 0, "owner" = "[owner]", "job" = "[ownjob]", "message" = "[t]", "target" = "\ref[src]")))
for(var/mob/M in player_list)
if(M.stat == DEAD && M.client && (M.client.prefs.toggles & CHAT_GHOSTEARS)) // src.client is so that ghosts don't have to listen to mice
if(M.stat == DEAD && M.client && (M.is_preference_enabled(/datum/client_preference/ghost_ears))) // src.client is so that ghosts don't have to listen to mice
if(istype(M, /mob/new_player))
continue
M.show_message("<span class='game say'>PDA Message - <span class='name'>[owner]</span> -> <span class='name'>[P.owner]</span>: <span class='message'>[t]</span></span>")

View File

@@ -157,7 +157,7 @@ var/const/FALLOFF_SOUNDS = 0.5
/client/proc/playtitlemusic()
if(!ticker || !ticker.login_music) return
if(prefs.toggles & SOUND_LOBBY)
if(is_preference_enabled(/datum/client_preference/play_lobby_music))
src << sound(ticker.login_music, repeat = 0, wait = 0, volume = 85, channel = 1) // MAD JAMS
/proc/get_rand_frequency()

View File

@@ -15,7 +15,7 @@
msg = sanitize(msg)
if(!msg) return
if(!(prefs.toggles & CHAT_OOC))
if(!is_preference_enabled(/datum/client_preference/show_ooc))
src << "<span class='warning'>You have OOC muted.</span>"
return
@@ -50,7 +50,7 @@
ooc_style = "admin"
for(var/client/target in clients)
if(target.prefs.toggles & CHAT_OOC)
if(target.is_preference_enabled(/datum/client_preference/show_ooc))
var/display_name = src.key
if(holder)
if(holder.fakekey)
@@ -83,7 +83,7 @@
if(!msg)
return
if(!(prefs.toggles & CHAT_LOOC))
if(!is_preference_enabled(/datum/client_preference/show_looc))
src << "<span class='danger'>You have LOOC muted.</span>"
return
@@ -117,7 +117,7 @@
display_name = mob.name
for(var/client/target in clients)
if(target.prefs.toggles & CHAT_LOOC)
if(target.is_preference_enabled(/datum/client_preference/show_looc))
var/prefix = ""
var/admin_stuff = ""
var/send = 0

View File

@@ -16,7 +16,7 @@ var/global/floorIsLava = 0
var/rendered = "<span class=\"log_message\"><span class=\"prefix\">ATTACK:</span> <span class=\"message\">[text]</span></span>"
for(var/client/C in admins)
if((R_ADMIN|R_MOD) & C.holder.rights)
if(C.prefs.toggles & CHAT_ATTACKLOGS)
if(C.is_preference_enabled(/datum/client_preference/admin/show_attack_logs))
var/msg = rendered
C << msg

View File

@@ -2,7 +2,6 @@
var/list/admin_verbs_default = list(
/datum/admins/proc/show_player_panel, /*shows an interface for individual players, with various links (links require additional flags*/
/client/proc/player_panel,
/client/proc/toggleadminhelpsound, /*toggles whether we hear a sound when adminhelps/PMs are used*/
/client/proc/deadmin_self, /*destroys our own admin datum so we can play as a regular player*/
/client/proc/hide_verbs, /*hides all our adminverbs*/
/client/proc/hide_most_verbs, /*hides all our hideable adminverbs*/
@@ -57,9 +56,7 @@ var/list/admin_verbs_admin = list(
/client/proc/check_antagonists,
/client/proc/admin_memo, /*admin memo system. show/delete/write. +SERVER needed to delete admin memos of others*/
/client/proc/dsay, /*talk in deadchat using our ckey/fakekey*/
/client/proc/toggleprayers, /*toggles prayers on/off*/
// /client/proc/toggle_hear_deadcast, /*toggles whether we hear deadchat*/
/client/proc/toggle_hear_radio, /*toggles whether we hear the radio*/
/client/proc/investigate_show, /*various admintools for investigation. Such as a singulo grief-log*/
/client/proc/secrets,
/datum/admins/proc/toggleooc, /*toggles ooc on/off for everyone*/
@@ -75,8 +72,6 @@ var/list/admin_verbs_admin = list(
/client/proc/free_slot, /*frees slot for chosen job*/
/client/proc/cmd_admin_change_custom_event,
/client/proc/cmd_admin_rejuvenate,
/client/proc/toggleattacklogs,
/client/proc/toggledebuglogs,
/client/proc/toggleghostwriters,
/client/proc/toggledrones,
/datum/admins/proc/show_skills,
@@ -187,7 +182,6 @@ var/list/admin_verbs_debug = list(
/client/proc/enable_debug_verbs,
/client/proc/callproc,
/client/proc/callproc_target,
/client/proc/toggledebuglogs,
/client/proc/SDQL_query,
/client/proc/SDQL2_query,
/client/proc/Jump,
@@ -218,8 +212,6 @@ var/list/admin_verbs_rejuv = list(
var/list/admin_verbs_hideable = list(
/client/proc/deadmin_self,
// /client/proc/deadchat,
/client/proc/toggleprayers,
/client/proc/toggle_hear_radio,
/datum/admins/proc/show_traitor_panel,
/datum/admins/proc/toggleenter,
/datum/admins/proc/toggleguests,
@@ -291,11 +283,9 @@ var/list/admin_verbs_mod = list(
/client/proc/cmd_admin_pm_context, /*right-click adminPM interface*/
/client/proc/cmd_admin_pm_panel, /*admin-pm list*/
/client/proc/debug_variables, /*allows us to -see- the variables of any instance in the game.*/
/client/proc/toggledebuglogs,
/datum/admins/proc/PlayerNotes,
/client/proc/admin_ghost, /*allows us to ghost/reenter body at will*/
/client/proc/cmd_mod_say,
/client/proc/toggleattacklogs,
/datum/admins/proc/show_player_info,
/client/proc/player_panel_new,
/client/proc/dsay,
@@ -903,17 +893,6 @@ var/list/admin_verbs_mentor = list(
message_admins("A job slot for [job] has been opened by [key_name_admin(usr)]")
return
/client/proc/toggleattacklogs()
set name = "Toggle Attack Log Messages"
set category = "Preferences"
prefs.toggles ^= CHAT_ATTACKLOGS
if (prefs.toggles & CHAT_ATTACKLOGS)
usr << "You now will get attack log messages"
else
usr << "You now won't get attack log messages"
/client/proc/toggleghostwriters()
set name = "Toggle ghost writers"
set category = "Server"
@@ -942,17 +921,6 @@ var/list/admin_verbs_mentor = list(
src << "<b>Enabled maint drones.</b>"
message_admins("Admin [key_name_admin(usr)] has enabled maint drones.", 1)
/client/proc/toggledebuglogs()
set name = "Toggle Debug Log Messages"
set category = "Preferences"
prefs.toggles ^= CHAT_DEBUGLOGS
if (prefs.toggles & CHAT_DEBUGLOGS)
usr << "You now will get debug log messages"
else
usr << "You now won't get debug log messages"
/client/proc/man_up(mob/T as mob in mob_list)
set category = "Fun"
set name = "Man Up"

View File

@@ -100,7 +100,7 @@ var/list/adminhelp_ignored_words = list("unknown","the","a","an","of","monkey","
if((R_ADMIN|R_MOD|R_MENTOR|R_SERVER) & X.holder.rights)
if(X.is_afk())
admin_number_afk++
if(X.prefs.toggles & SOUND_ADMINHELP)
if(X.is_preference_enabled(/datum/client_preference/holder/play_adminhelp_ping))
X << 'sound/effects/adminhelp.ogg'
if(X.holder.rights == R_MENTOR)
X << mentor_msg // Mentors won't see coloring of names on people with special_roles (Antags, etc.)

View File

@@ -104,7 +104,7 @@
//play the recieving admin the adminhelp sound (if they have them enabled)
//non-admins shouldn't be able to disable this
if(C.prefs && C.prefs.toggles & SOUND_ADMINHELP)
if(C.is_preference_enabled(/datum/client_preference/holder/play_adminhelp_ping))
C << 'sound/effects/adminhelp.ogg'
log_admin("PM: [key_name(src)]->[key_name(C)]: [msg]")

View File

@@ -8,11 +8,11 @@
if(!src.mob)
return
if(prefs.muted & MUTE_DEADCHAT)
src << "\red You cannot send DSAY messages (muted)."
src << "<spcan class='warning'>You cannot send DSAY messages (muted).</span>"
return
if(!(prefs.toggles & CHAT_DEAD))
src << "\red You have deadchat muted."
if(!is_preference_enabled(/datum/client_preference/show_dsay))
src << "<spcan class='warning'>You have deadchat muted.</span>"
return
if (src.handle_spam_prevention(msg,MUTE_DEADCHAT))

View File

@@ -16,7 +16,7 @@ var/list/sounds_cache = list()
log_admin("[key_name(src)] played sound [S]")
message_admins("[key_name_admin(src)] played sound [S]", 1)
for(var/mob/M in player_list)
if(M.client.prefs.toggles & SOUND_MIDI)
if(M.is_preference_enabled(/datum/client_preference/play_admin_midis))
M << uploaded_sound
feedback_add_details("admin_verb","PGS") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!

View File

@@ -21,7 +21,7 @@
for(var/client/C in admins)
if(R_ADMIN & C.holder.rights)
if(C.prefs.toggles & CHAT_PRAYER)
if(C.is_preference_enabled(/datum/client_preference/admin/show_chat_prayers))
C << msg
usr << "Your prayers have been received by the gods."

View File

@@ -21,7 +21,7 @@
/datum/category_item/player_setup_item/general/basic/sanitize_character()
if(!pref.species) pref.species = "Human"
var/datum/species/S = all_species[pref.species]
var/datum/species/S = all_species[pref.species ? pref.species : "Human"]
pref.age = sanitize_integer(pref.age, S.min_age, S.max_age, initial(pref.age))
pref.gender = sanitize_inlist(pref.gender, valid_player_genders, pick(valid_player_genders))
pref.real_name = sanitize_name(pref.real_name, pref.species)

View File

@@ -1,3 +1,6 @@
/datum/preferences
var/preferences = null
/datum/category_item/player_setup_item/player_global/settings
name = "Settings"
sort_order = 2
@@ -5,34 +8,101 @@
/datum/category_item/player_setup_item/player_global/settings/load_preferences(var/savefile/S)
S["lastchangelog"] >> pref.lastchangelog
S["default_slot"] >> pref.default_slot
S["toggles"] >> pref.toggles
S["preferences"] >> pref.preferences
/datum/category_item/player_setup_item/player_global/settings/save_preferences(var/savefile/S)
S["lastchangelog"] << pref.lastchangelog
S["default_slot"] << pref.default_slot
S["toggles"] << pref.toggles
S["preferences"] << pref.preferences
/datum/category_item/player_setup_item/player_global/settings/sanitize_preferences()
if(!istype(pref.preferences, /list))
pref.preferences = list()
var/mob/pref_mob = preference_mob()
for(var/cp in get_client_preferences())
var/datum/client_preference/client_pref = cp
if(!client_pref.enabled_by_default || !client_pref.may_toggle(pref_mob))
continue
pref.preferences += client_pref.key
for(var/preference in pref.preferences)
if(!get_client_preference_by_key(preference))
pref.preferences -= preference
pref.lastchangelog = sanitize_text(pref.lastchangelog, initial(pref.lastchangelog))
pref.default_slot = sanitize_integer(pref.default_slot, 1, config.character_slots, initial(pref.default_slot))
pref.toggles = sanitize_integer(pref.toggles, 0, 65535, initial(pref.toggles))
/datum/category_item/player_setup_item/player_global/settings/content(var/mob/user)
. += "<b>Play admin midis:</b> <a href='?src=\ref[src];toggle=[SOUND_MIDI]'><b>[(pref.toggles & SOUND_MIDI) ? "Yes" : "No"]</b></a><br>"
. += "<b>Play lobby music:</b> <a href='?src=\ref[src];toggle=[SOUND_LOBBY]'><b>[(pref.toggles & SOUND_LOBBY) ? "Yes" : "No"]</b></a><br>"
. += "<b>Ghost ears:</b> <a href='?src=\ref[src];toggle=[CHAT_GHOSTEARS]'><b>[(pref.toggles & CHAT_GHOSTEARS) ? "All Speech" : "Nearest Creatures"]</b></a><br>"
. += "<b>Ghost sight:</b> <a href='?src=\ref[src];toggle=[CHAT_GHOSTSIGHT]'><b>[(pref.toggles & CHAT_GHOSTSIGHT) ? "All Emotes" : "Nearest Creatures"]</b></a><br>"
. += "<b>Ghost radio:</b> <a href='?src=\ref[src];toggle=[CHAT_GHOSTRADIO]'><b>[(pref.toggles & CHAT_GHOSTRADIO) ? "All Chatter" : "Nearest Speakers"]</b></a><br>"
. = list()
. += "<b>Preferences</b><br>"
. += "<table>"
var/mob/pref_mob = preference_mob()
for(var/cp in get_client_preferences())
var/datum/client_preference/client_pref = cp
if(!client_pref.may_toggle(pref_mob))
continue
. += "<tr><td>[client_pref.description]: </td>"
if(pref_mob.is_preference_enabled(client_pref.key))
. += "<td><b>[client_pref.enabled_description]</b></td> <td><a href='?src=\ref[src];toggle_off=[client_pref.key]'>[client_pref.disabled_description]</a></td>"
else
. += "<td><a href='?src=\ref[src];toggle_on=[client_pref.key]'>[client_pref.enabled_description]</a></td> <td><b>[client_pref.disabled_description]</b></td>"
. += "</tr>"
. += "</table>"
return jointext(.)
/datum/category_item/player_setup_item/player_global/settings/OnTopic(var/href,var/list/href_list, var/mob/user)
if(href_list["toggle"])
var/toggle_flag = text2num(href_list["toggle"])
pref.toggles ^= toggle_flag
if(toggle_flag == SOUND_LOBBY && isnewplayer(user))
if(pref.toggles & SOUND_LOBBY)
user << sound(ticker.login_music, repeat = 0, wait = 0, volume = 85, channel = 1)
else
user << sound(null, repeat = 0, wait = 0, volume = 85, channel = 1)
var/mob/pref_mob = preference_mob()
if(href_list["toggle_on"])
. = pref_mob.set_preference(href_list["toggle_on"], TRUE)
else if(href_list["toggle_off"])
. = pref_mob.set_preference(href_list["toggle_off"], FALSE)
if(.)
return TOPIC_REFRESH
return ..()
/client/proc/is_preference_enabled(var/preference)
if(ispath(preference))
var/datum/client_preference/cp = get_client_preference_by_type(preference)
preference = cp.key
return (preference in prefs.preferences)
/client/proc/set_preference(var/preference, var/set_preference)
var/datum/client_preference/cp
if(ispath(preference))
cp = get_client_preference_by_type(preference)
else
cp = get_client_preference_by_key(preference)
if(!cp)
return FALSE
var/enabled
if(set_preference && !(preference in prefs.preferences))
prefs.preferences += preference
enabled = TRUE
. = TRUE
else if(!set_preference && (preference in prefs.preferences))
prefs.preferences -= preference
enabled = FALSE
. = TRUE
if(.)
cp.toggled(mob, enabled)
/mob/proc/is_preference_enabled(var/preference)
if(!client)
return FALSE
return client.is_preference_enabled(preference)
/mob/proc/set_preference(var/preference, var/set_preference)
if(!client)
return FALSE
if(!client.prefs)
log_debug("Client prefs found to be null for mob [src] and client [ckey], this should be investigated.")
return FALSE
return client.set_preference(preference, set_preference)

View File

@@ -0,0 +1,161 @@
var/list/_client_preferences
var/list/_client_preferences_by_key
var/list/_client_preferences_by_type
/proc/get_client_preferences()
if(!_client_preferences)
_client_preferences = list()
for(var/ct in subtypes(/datum/client_preference))
var/datum/client_preference/client_type = ct
if(initial(client_type.description))
_client_preferences += new client_type()
return _client_preferences
/proc/get_client_preference_by_key(var/preference)
if(!_client_preferences_by_key)
_client_preferences_by_key = list()
for(var/ct in get_client_preferences())
var/datum/client_preference/client_pref = ct
_client_preferences_by_key[client_pref.key] = client_pref
return _client_preferences_by_key[preference]
/proc/get_client_preference_by_type(var/preference)
if(!_client_preferences_by_type)
_client_preferences_by_type = list()
for(var/ct in get_client_preferences())
var/datum/client_preference/client_pref = ct
_client_preferences_by_type[client_pref.type] = client_pref
return _client_preferences_by_type[preference]
/datum/client_preference
var/description
var/key
var/enabled_by_default = TRUE
var/enabled_description = "Yes"
var/disabled_description = "No"
/datum/client_preference/proc/may_toggle(var/mob/preference_mob)
return TRUE
/datum/client_preference/proc/toggled(var/mob/preference_mob, var/enabled)
return
/*********************
* Player Preferences *
*********************/
/datum/client_preference/play_admin_midis
description ="Play admin midis"
key = "SOUND_MIDI"
/datum/client_preference/play_lobby_music
description ="Play lobby music"
key = "SOUND_LOBBY"
/datum/client_preference/play_lobby_music/toggled(var/mob/preference_mob, var/enabled)
if(enabled)
preference_mob << sound(ticker.login_music, repeat = 0, wait = 0, volume = 85, channel = 1)
else
preference_mob << sound(null, repeat = 0, wait = 0, volume = 85, channel = 1)
/datum/client_preference/play_ambiance
description ="Play ambience"
key = "SOUND_AMBIENCE"
/datum/client_preference/play_ambiance/toggled(var/mob/preference_mob, var/enabled)
if(!enabled)
preference_mob << sound(null, repeat = 0, wait = 0, volume = 0, channel = 1)
preference_mob << sound(null, repeat = 0, wait = 0, volume = 0, channel = 2)
/datum/client_preference/ghost_ears
description ="Ghost ears"
key = "CHAT_GHOSTEARS"
enabled_description = "All Speech"
disabled_description = "Nearby"
/datum/client_preference/ghost_sight
description ="Ghost sight"
key = "CHAT_GHOSTSIGHT"
enabled_description = "All Emotes"
disabled_description = "Nearby"
/datum/client_preference/ghost_radio
description ="Ghost radio"
key = "CHAT_GHOSTRADIO"
enabled_description = "All Chatter"
disabled_description = "Nearby"
/datum/client_preference/chat_tags
description ="Chat tags"
key = "CHAT_SHOWICONS"
enabled_description = "Show"
disabled_description = "Hide"
/datum/client_preference/show_typing_indicator
description ="Typing indicator"
key = "SHOW_TYPING"
enabled_description = "Show"
disabled_description = "Hide"
/datum/client_preference/show_typing_indicator/toggled(var/mob/preference_mob, var/enabled)
if(!enabled)
preference_mob.set_typing_indicator(0)
/datum/client_preference/show_ooc
description ="OOC chat"
key = "CHAT_OOC"
enabled_description = "Show"
disabled_description = "Hide"
/datum/client_preference/show_looc
description ="LOOC chat"
key = "CHAT_LOOC"
enabled_description = "Show"
disabled_description = "Hide"
/datum/client_preference/show_dsay
description ="Dead chat"
key = "CHAT_DEAD"
enabled_description = "Show"
disabled_description = "Hide"
/********************
* Admin Preferences *
********************/
/datum/client_preference/admin/may_toggle(var/mob/preference_mob)
return check_rights(R_ADMIN, 0, preference_mob)
/datum/client_preference/admin/show_attack_logs
description = "Attack Log Messages"
key = "CHAT_ATTACKLOGS"
enabled_description = "Show"
disabled_description = "Hide"
enabled_by_default = FALSE
/datum/client_preference/admin/show_debug_logs
description = "Debug Log Messages"
key = "CHAT_DEBUGLOGS"
enabled_description = "Show"
disabled_description = "Hide"
enabled_by_default = FALSE
/datum/client_preference/admin/show_chat_prayers
description = "Chat Prayers"
key = "CHAT_PRAYER"
enabled_description = "Show"
disabled_description = "Hide"
/datum/client_preference/holder/may_toggle(var/mob/preference_mob)
return preference_mob && preference_mob.client && preference_mob.client.holder
/datum/client_preference/holder/play_adminhelp_ping
description = "Adminhelps"
key = "SOUND_ADMINHELP"
enabled_description = "Hear"
disabled_description = "Silent"
/datum/client_preference/holder/hear_radio
description = "Radio chatter"
key = "CHAT_RADIO"
enabled_description = "Show"
disabled_description = "Hide"

View File

@@ -19,7 +19,6 @@ datum/preferences
var/ooccolor = "#010000" //Whatever this is set to acts as 'reset' color and is thus unusable as an actual custom color
var/be_special = 0 //Special role selection
var/UI_style = "Midnight"
var/toggles = TOGGLES_DEFAULT
var/UI_style_color = "#ffffff"
var/UI_style_alpha = 255
@@ -204,7 +203,7 @@ datum/preferences
dat += player_setup.content(user)
dat += "</html></body>"
user << browse(dat, "window=preferences;size=625x736")
user << browse(dat, "window=preferences;size=635x736")
/datum/preferences/proc/process_link(mob/user, list/href_list)
if(!user) return

View File

@@ -1,159 +0,0 @@
//toggles
/client/verb/toggle_ghost_ears()
set name = "Show/Hide GhostEars"
set category = "Preferences"
set desc = ".Toggle Between seeing all mob speech, and only speech of nearby mobs"
prefs.toggles ^= CHAT_GHOSTEARS
src << "As a ghost, you will now [(prefs.toggles & CHAT_GHOSTEARS) ? "see all speech in the world" : "only see speech from nearby mobs"]."
prefs.save_preferences()
feedback_add_details("admin_verb","TGE") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/verb/toggle_ghost_sight()
set name = "Show/Hide GhostSight"
set category = "Preferences"
set desc = ".Toggle Between seeing all mob emotes, and only emotes of nearby mobs"
prefs.toggles ^= CHAT_GHOSTSIGHT
src << "As a ghost, you will now [(prefs.toggles & CHAT_GHOSTSIGHT) ? "see all emotes in the world" : "only see emotes from nearby mobs"]."
prefs.save_preferences()
feedback_add_details("admin_verb","TGS") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/verb/toggle_ghost_radio()
set name = "Enable/Disable GhostRadio"
set category = "Preferences"
set desc = ".Toggle between hearing all radio chatter, or only from nearby speakers"
prefs.toggles ^= CHAT_GHOSTRADIO
src << "As a ghost, you will now [(prefs.toggles & CHAT_GHOSTRADIO) ? "hear all radio chat in the world" : "only hear from nearby speakers"]."
prefs.save_preferences()
feedback_add_details("admin_verb","TGR")
/client/proc/toggle_hear_radio()
set name = "Show/Hide RadioChatter"
set category = "Preferences"
set desc = "Toggle seeing radiochatter from radios and speakers"
if(!holder) return
prefs.toggles ^= CHAT_RADIO
prefs.save_preferences()
usr << "You will [(prefs.toggles & CHAT_RADIO) ? "now" : "no longer"] see radio chatter from radios or speakers"
feedback_add_details("admin_verb","THR") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/proc/toggleadminhelpsound()
set name = "Hear/Silence Adminhelps"
set category = "Preferences"
set desc = "Toggle hearing a notification when admin PMs are recieved"
if(!holder) return
prefs.toggles ^= SOUND_ADMINHELP
prefs.save_preferences()
usr << "You will [(prefs.toggles & SOUND_ADMINHELP) ? "now" : "no longer"] hear a sound when adminhelps arrive."
feedback_add_details("admin_verb","AHS") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/verb/deadchat() // Deadchat toggle is usable by anyone.
set name = "Show/Hide Deadchat"
set category = "Preferences"
set desc ="Toggles seeing deadchat"
prefs.toggles ^= CHAT_DEAD
prefs.save_preferences()
if(src.holder)
src << "You will [(prefs.toggles & CHAT_DEAD) ? "now" : "no longer"] see deadchat."
else
src << "As a ghost, you will [(prefs.toggles & CHAT_DEAD) ? "now" : "no longer"] see deadchat."
feedback_add_details("admin_verb","TDV") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/proc/toggleprayers()
set name = "Show/Hide Prayers"
set category = "Preferences"
set desc = "Toggles seeing prayers"
prefs.toggles ^= CHAT_PRAYER
prefs.save_preferences()
src << "You will [(prefs.toggles & CHAT_PRAYER) ? "now" : "no longer"] see prayerchat."
feedback_add_details("admin_verb","TP") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/verb/toggletitlemusic()
set name = "Hear/Silence LobbyMusic"
set category = "Preferences"
set desc = "Toggles hearing the GameLobby music"
prefs.toggles ^= SOUND_LOBBY
prefs.save_preferences()
if(prefs.toggles & SOUND_LOBBY)
src << "You will now hear music in the game lobby."
if(istype(mob, /mob/new_player))
playtitlemusic()
else
src << "You will no longer hear music in the game lobby."
if(istype(mob, /mob/new_player))
src << sound(null, repeat = 0, wait = 0, volume = 85, channel = 1) // stop the jamsz
feedback_add_details("admin_verb","TLobby") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/verb/togglemidis()
set name = "Hear/Silence Midis"
set category = "Preferences"
set desc = "Toggles hearing sounds uploaded by admins"
prefs.toggles ^= SOUND_MIDI
prefs.save_preferences()
if(prefs.toggles & SOUND_MIDI)
src << "You will now hear any sounds uploaded by admins."
var/sound/break_sound = sound(null, repeat = 0, wait = 0, channel = 777)
break_sound.priority = 250
src << break_sound //breaks the client's sound output on channel 777
else
src << "You will no longer hear sounds uploaded by admins; any currently playing midis have been disabled."
feedback_add_details("admin_verb","TMidi") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/verb/listen_ooc()
set name = "Show/Hide OOC"
set category = "Preferences"
set desc = "Toggles seeing OutOfCharacter chat"
prefs.toggles ^= CHAT_OOC
prefs.save_preferences()
src << "You will [(prefs.toggles & CHAT_OOC) ? "now" : "no longer"] see messages on the OOC channel."
feedback_add_details("admin_verb","TOOC") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/verb/listen_looc()
set name = "Show/Hide LOOC"
set category = "Preferences"
set desc = "Toggles seeing Local OutOfCharacter chat"
prefs.toggles ^= CHAT_LOOC
prefs.save_preferences()
src << "You will [(prefs.toggles & CHAT_LOOC) ? "now" : "no longer"] see messages on the LOOC channel."
feedback_add_details("admin_verb","TLOOC") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/verb/toggle_chattags()
set name = "Show/Hide Chat Tags"
set category = "Preferences"
set desc = "Toggles seeing chat tags/icons"
prefs.toggles ^= CHAT_NOICONS
prefs.save_preferences()
src << "You will [!(prefs.toggles & CHAT_NOICONS) ? "now" : "no longer"] see chat tag icons."
feedback_add_details("admin_verb","TCTAG") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/verb/Toggle_Soundscape() //All new ambience should be added here so it works with this verb until someone better at things comes up with a fix that isn't awful
set name = "Hear/Silence Ambience"
set category = "Preferences"
set desc = "Toggles hearing ambient sound effects"
prefs.toggles ^= SOUND_AMBIENCE
prefs.save_preferences()
if(prefs.toggles & SOUND_AMBIENCE)
src << "You will now hear ambient sounds."
else
src << "You will no longer hear ambient sounds."
src << sound(null, repeat = 0, wait = 0, volume = 0, channel = 1)
src << sound(null, repeat = 0, wait = 0, volume = 0, channel = 2)
feedback_add_details("admin_verb","TAmbi") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
//be special
/client/verb/toggle_be_special(role in be_special_flags)
set name = "Toggle SpecialRole Candidacy"
set category = "Preferences"
set desc = "Toggles which special roles you would like to be a candidate for, during events."
var/role_flag = be_special_flags[role]
if(!role_flag) return
prefs.be_special ^= role_flag
prefs.save_preferences()
src << "You will [(prefs.be_special & role_flag) ? "now" : "no longer"] be considered for [role] events (where possible)."
feedback_add_details("admin_verb","TBeSpecial") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!

View File

@@ -33,7 +33,7 @@
continue
if(findtext(message," snores.")) //Because we have so many sleeping people.
break
if(M.stat == 2 && (M.client.prefs.toggles & CHAT_GHOSTSIGHT) && !(M in viewers(src,null)))
if(M.stat == DEAD && M.is_preference_enabled(/datum/client_preference/ghost_sight) && !(M in viewers(src,null)))
M.show_message(message, m_type)
if (m_type & 1)
@@ -66,7 +66,7 @@
src << "<span class='danger'>You cannot send deadchat emotes (muted).</span>"
return
if(!(client.prefs.toggles & CHAT_DEAD))
if(!is_preference_enabled(/datum/client_preference/show_dsay))
src << "<span class='danger'>You have deadchat muted.</span>"
return

View File

@@ -4,7 +4,7 @@
if(!client)
return
if(speaker && !speaker.client && istype(src,/mob/observer/dead) && client.prefs.toggles & CHAT_GHOSTEARS && !speaker in view(src))
if(speaker && !speaker.client && istype(src,/mob/observer/dead) && is_preference_enabled(/datum/client_preference/ghost_ears) && !(speaker in view(src)))
//Does the speaker have a client? It's either random stuff that observers won't care about (Experiment 97B says, 'EHEHEHEHEHEHEHE')
//Or someone snoring. So we make it where they won't hear it.
return
@@ -51,12 +51,12 @@
var/track = null
if(istype(src, /mob/observer/dead))
if(italics && client.prefs.toggles & CHAT_GHOSTRADIO)
if(italics && is_preference_enabled(/datum/client_preference/ghost_radio))
return
if(speaker_name != speaker.real_name && speaker.real_name)
speaker_name = "[speaker.real_name] ([speaker_name])"
track = "([ghost_follow_link(speaker, src)]) "
if(client.prefs.toggles & CHAT_GHOSTEARS && speaker in view(src))
if(is_preference_enabled(/datum/client_preference/ghost_ears) && (speaker in view(src)))
message = "<b>[message]</b>"
if((sdisabilities & DEAF) || ear_deaf)

View File

@@ -70,7 +70,7 @@
for(var/mob/M in dead_mob_list)
if (!M.client || istype(M, /mob/new_player))
continue //skip monkeys, leavers, and new_players
if(M.stat == DEAD && (M.client.prefs.toggles & CHAT_GHOSTSIGHT) && !(M in viewers(src,null)))
if(M.stat == DEAD && M.is_preference_enabled(/datum/client_preference/ghost_sight) && !(M in viewers(src,null)))
M.show_message(message)

View File

@@ -116,7 +116,7 @@
for (var/mob/M in dead_mob_list) //does this include players who joined as observers as well?
if (!(M.client))
continue
if(M.stat == DEAD && M.client && (M.client.prefs.toggles & CHAT_GHOSTEARS))
if(M.stat == DEAD && M.is_preference_enabled(/datum/client_preference/ghost_ears))
listening |= M
//Pass whispers on to anything inside the immediate listeners.

View File

@@ -248,7 +248,7 @@ proc/get_radio_key_from_channel(var/channel)
for(var/mob/M in player_list)
if(M.stat == DEAD && M.client && (M.client.prefs.toggles & CHAT_GHOSTEARS))
if(M.stat == DEAD && M.client && M.is_preference_enabled(/datum/client_preference/ghost_ears))
listening |= M
continue
if(M.loc && M.locs[1] in hearturfs)

View File

@@ -9,7 +9,7 @@
message = sanitize(message)
if (stat == 2)
if (stat == DEAD)
return say_dead(message)
if(copytext(message,1,2) == "*")
@@ -34,7 +34,7 @@
for (var/mob/M in player_list)
if (istype(M, /mob/new_player))
continue
else if(M.stat == 2 && M.client.prefs.toggles & CHAT_GHOSTEARS)
else if(M.stat == DEAD && M.is_preference_enabled(/datum/client_preference/ghost_ears))
if(M.client) M << "<b>[src]</b> transmits, \"[message]\""
return 1
return ..(message, 0)

View File

@@ -28,7 +28,7 @@
for (var/mob/M in player_list)
if (istype(M, /mob/new_player))
continue
else if(M.stat == 2 && M.client.prefs.toggles & CHAT_GHOSTEARS)
else if(M.stat == DEAD && M.is_preference_enabled(/datum/client_preference/ghost_ears))
M << "The captive mind of [src] whispers, \"[message]\""
/mob/living/captive_brain/emote(var/message)

View File

@@ -38,5 +38,5 @@
for (var/mob/M in player_list)
if (istype(M, /mob/new_player))
continue
else if(M.stat == 2 && M.client.prefs.toggles & CHAT_GHOSTEARS)
else if(M.stat == DEAD && M.is_preference_enabled(/datum/client_preference/ghost_ears))
M << "[src.truename] whispers to [host], \"[message]\""

View File

@@ -391,7 +391,7 @@ proc/is_blind(A)
name = realname
for(var/mob/M in player_list)
if(M.client && ((!istype(M, /mob/new_player) && M.stat == DEAD) || (M.client.holder && !is_mentor(M.client))) && (M.client.prefs.toggles & CHAT_DEAD))
if(M.client && ((!istype(M, /mob/new_player) && M.stat == DEAD) || (M.client.holder && !is_mentor(M.client))) && M.is_preference_enabled(/datum/client_preference/show_dsay))
var/follow
var/lname
if(subject)

View File

@@ -54,7 +54,7 @@
src << "<span class='danger'>Deadchat is globally muted.</span>"
return
if(client && !(client.prefs.toggles & CHAT_DEAD))
if(is_preference_enabled(/datum/client_preference/show_dsay))
usr << "<span class='danger'>You have deadchat muted.</span>"
return

View File

@@ -15,8 +15,8 @@ mob/var/obj/effect/decal/typing_indicator
typing_indicator.icon_state = "typing"
if(client && !stat)
typing_indicator.invisibility = invisibility
if(client.prefs.toggles & SHOW_TYPING)
typing_indicator.invisibility = invisibility
if(!is_preference_enabled(/datum/client_preference/show_typing_indicator))
overlays -= typing_indicator
else
if(state)
@@ -54,35 +54,20 @@ mob/var/obj/effect/decal/typing_indicator
me_verb(message)
/mob/proc/handle_typing_indicator()
if(client)
if(!(client.prefs.toggles & SHOW_TYPING) && !hud_typing)
var/temp = winget(client, "input", "text")
if(is_preference_enabled(/datum/client_preference/show_typing_indicator) && !hud_typing)
var/temp = winget(client, "input", "text")
if (temp != last_typed)
last_typed = temp
last_typed_time = world.time
if (temp != last_typed)
last_typed = temp
last_typed_time = world.time
if (world.time > last_typed_time + TYPING_INDICATOR_LIFETIME)
set_typing_indicator(0)
return
if(length(temp) > 5 && findtext(temp, "Say \"", 1, 7))
set_typing_indicator(1)
else if(length(temp) > 3 && findtext(temp, "Me ", 1, 5))
set_typing_indicator(1)
if (world.time > last_typed_time + TYPING_INDICATOR_LIFETIME)
set_typing_indicator(0)
return
if(length(temp) > 5 && findtext(temp, "Say \"", 1, 7))
set_typing_indicator(1)
else if(length(temp) > 3 && findtext(temp, "Me ", 1, 5))
set_typing_indicator(1)
else
set_typing_indicator(0)
/client/verb/typing_indicator()
set name = "Show/Hide Typing Indicator"
set category = "Preferences"
set desc = "Toggles showing an indicator when you are typing emote or say message."
prefs.toggles ^= SHOW_TYPING
prefs.save_preferences()
src << "You will [(prefs.toggles & SHOW_TYPING) ? "no longer" : "now"] display a typing indicator."
// Clear out any existing typing indicator.
if(prefs.toggles & SHOW_TYPING)
if(istype(mob)) mob.set_typing_indicator(0)
feedback_add_details("admin_verb","TID") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
else
set_typing_indicator(0)

View File

@@ -121,7 +121,7 @@
continue //skip monkeys and leavers
if (istype(M, /mob/new_player))
continue
if(M.stat == 2 && M.client.prefs.toggles & CHAT_GHOSTEARS)
if(M.stat == DEAD && M.is_preference_enabled(/datum/client_preference/ghost_ears))
listening|=M
for(var/mob/M in listening)

View File

@@ -972,7 +972,6 @@
#include "code\modules\client\preferences_factions.dm"
#include "code\modules\client\preferences_savefile.dm"
#include "code\modules\client\preferences_spawnpoints.dm"
#include "code\modules\client\preferences_toggles.dm"
#include "code\modules\client\ui_style.dm"
#include "code\modules\client\preference_setup\preference_setup.dm"
#include "code\modules\client\preference_setup\antagonism\01_basic.dm"
@@ -987,6 +986,7 @@
#include "code\modules\client\preference_setup\global\02_settings.dm"
#include "code\modules\client\preference_setup\global\03_pai.dm"
#include "code\modules\client\preference_setup\global\04_communicators.dm"
#include "code\modules\client\preference_setup\global\setting_datums.dm"
#include "code\modules\client\preference_setup\loadout\loadout.dm"
#include "code\modules\client\preference_setup\loadout\loadout_accessories.dm"
#include "code\modules\client\preference_setup\loadout\loadout_cosmetics.dm"