From d7d84ff5157e1c0f887e0e3e4273add300ea6a7e Mon Sep 17 00:00:00 2001 From: Kilakk Date: Sat, 27 Jul 2013 22:54:30 -0400 Subject: [PATCH] Added a deadchat toggle for all players. * Both admins and regular players can toggle deadchat off * Having deadchat on still requires you to be a ghost or an admin/mod to be able to /see/ deadchat --- code/modules/admin/admin_verbs.dm | 6 +++--- code/modules/admin/verbs/deadsay.dm | 10 +++++++++- code/modules/client/preferences_toggles.dm | 9 +++++++-- code/modules/mob/emote.dm | 12 ++++++++++-- code/modules/mob/say.dm | 9 +++++++-- 5 files changed, 36 insertions(+), 10 deletions(-) diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 2f9c87e0b14..7f821923415 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -6,8 +6,8 @@ var/list/admin_verbs_default = list( /client/proc/hide_verbs, /*hides all our adminverbs*/ /client/proc/hide_most_verbs, /*hides all our hideable adminverbs*/ /client/proc/debug_variables, /*allows us to -see- the variables of any instance in the game. +VAREDIT needed to modify*/ - /client/proc/check_antagonists, /*shows all antags*/ - /client/proc/deadchat /*toggles deadchat on/off*/ + /client/proc/check_antagonists /*shows all antags*/ +// /client/proc/deadchat /*toggles deadchat on/off*/ ) var/list/admin_verbs_admin = list( /client/proc/player_panel, /*shows an interface for all players, with links to various panels (old style)*/ @@ -156,7 +156,7 @@ var/list/admin_verbs_rejuv = list( var/list/admin_verbs_hideable = list( /client/proc/set_ooc, /client/proc/deadmin_self, - /client/proc/deadchat, +// /client/proc/deadchat, /client/proc/toggleprayers, /client/proc/toggle_hear_radio, /datum/admins/proc/show_traitor_panel, diff --git a/code/modules/admin/verbs/deadsay.dm b/code/modules/admin/verbs/deadsay.dm index e861264f486..8485778e3cf 100644 --- a/code/modules/admin/verbs/deadsay.dm +++ b/code/modules/admin/verbs/deadsay.dm @@ -11,6 +11,10 @@ src << "\red You cannot send DSAY messages (muted)." return + if(!(prefs.toggles & CHAT_DEAD)) + src << "\red You have deadchat muted." + return + if (src.handle_spam_prevention(msg,MUTE_DEADCHAT)) return @@ -25,7 +29,11 @@ for (var/mob/M in player_list) if (istype(M, /mob/new_player)) continue - if (M.stat == DEAD || (M.client && M.client.holder && (M.client.prefs.toggles & CHAT_DEAD))) //admins can toggle deadchat on and off. This is a proc in admin.dm and is only give to Administrators and above + + if(M.client && M.client.holder && (M.client.prefs.toggles & CHAT_DEAD)) // show the message to admins who have deadchat toggled on + M.show_message(rendered, 2) + + else if(M.stat == DEAD && (M.client.prefs.toggles & CHAT_DEAD)) // show the message to regular ghosts who have deadchat toggled on M.show_message(rendered, 2) feedback_add_details("admin_verb","D") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! \ No newline at end of file diff --git a/code/modules/client/preferences_toggles.dm b/code/modules/client/preferences_toggles.dm index e3773f77857..e59546a470f 100644 --- a/code/modules/client/preferences_toggles.dm +++ b/code/modules/client/preferences_toggles.dm @@ -37,13 +37,18 @@ 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/proc/deadchat() +/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() - src << "You will [(prefs.toggles & CHAT_DEAD) ? "now" : "no longer"] see deadchat." + + 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() diff --git a/code/modules/mob/emote.dm b/code/modules/mob/emote.dm index 1a8cec7d3b1..eaa345be1bd 100644 --- a/code/modules/mob/emote.dm +++ b/code/modules/mob/emote.dm @@ -45,6 +45,14 @@ /mob/proc/emote_dead(var/message) + if(client.prefs.muted & MUTE_DEADCHAT) + src << "\red You cannot send deadchat emotes (muted)." + return + + if(!(client.prefs.toggles & CHAT_DEAD)) + src << "\red You have deadchat muted." + return + var/input if(!message) input = copytext(sanitize(input(src, "Choose an emote to display.") as text|null), 1, MAX_MESSAGE_LEN) @@ -64,8 +72,8 @@ if(istype(M, /mob/new_player)) continue - if(M.client && M.client.holder && (M.client.holder.rights & R_ADMIN|R_MOD) && (M.client.prefs.toggles & CHAT_DEAD)) + if(M.client && M.client.holder && (M.client.holder.rights & R_ADMIN|R_MOD) && (M.client.prefs.toggles & CHAT_DEAD)) // Show the emote to admins/mods M << message - else if(M.stat == DEAD) + else if(M.stat == DEAD && (M.client.prefs.toggles & CHAT_DEAD)) // Show the emote to regular ghosts with deadchat toggled on M.show_message(message, 2) diff --git a/code/modules/mob/say.dm b/code/modules/mob/say.dm index 58f6724e85f..b6452266a00 100644 --- a/code/modules/mob/say.dm +++ b/code/modules/mob/say.dm @@ -37,6 +37,10 @@ usr << "\red Speech is currently admin-disabled." return + if(!(client.prefs.toggles & CHAT_DEAD)) + usr << "\red You have deadchat muted." + return + if(mind && mind.name) name = "[mind.name]" else @@ -50,9 +54,10 @@ for(var/mob/M in player_list) if(istype(M, /mob/new_player)) continue - if(M.client && M.client.holder && (M.client.holder.rights & R_ADMIN|R_MOD) && (M.client.prefs.toggles & CHAT_DEAD)) //admins can toggle deadchat on and off. This is a proc in admin.dm and is only give to Administrators and above + if(M.client && M.client.holder && (M.client.holder.rights & R_ADMIN|R_MOD) && (M.client.prefs.toggles & CHAT_DEAD)) // Show the message to admins/mods with deadchat toggled on M << rendered //Admins can hear deadchat, if they choose to, no matter if they're blind/deaf or not. - else if(M.stat == DEAD) + + else if(M.stat == DEAD && (M.client.prefs.toggles & CHAT_DEAD)) // Show the message to regular ghosts with deadchat toggled on. M.show_message(rendered, 2) //Takes into account blindness and such. return