From 960bac697692c06539e384fdd8b7f528b649018c Mon Sep 17 00:00:00 2001 From: mochi Date: Sat, 6 Jun 2020 09:37:48 +0200 Subject: [PATCH] View Asays, Erase Flavor Text and Use Random Name --- code/modules/admin/admin.dm | 3 +- code/modules/admin/topic.dm | 48 ++++++++++++++++++++++++++++ code/modules/admin/verbs/adminsay.dm | 7 ++++ code/modules/admin/verbs/asays.dm | 47 +++++++++++++++++++++++++++ paradise.dme | 1 + 5 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 code/modules/admin/verbs/asays.dm diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index df156c5b0df..0d2c818ac4d 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -109,9 +109,10 @@ GLOBAL_VAR_INIT(nologevent, 0) else body += "Add to Watchlist " - if(M.client) body += "| Prison | " body += "\ Send back to Lobby | " + body += "\ Erase Flavor Text | " + body += "\ Use Random Name | " var/muted = M.client.prefs.muted body += {"
Mute: \[IC | diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 1a040d46e90..8df4ca31c6b 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -1287,6 +1287,54 @@ NP.ckey = M.ckey qdel(M) + else if(href_list["eraseflavortext"]) + if(!check_rights(R_ADMIN)) + return + + var/mob/M = locateUID(href_list["eraseflavortext"]) + + if(!M.client) + to_chat(usr, "[M] doesn't seem to have an active client.") + return + + if(M.flavor_text == "" && M.client.prefs.flavor_text == "") + to_chat(usr, "[M] has no flavor text set.") + return + + if(alert(usr, "Erase [key_name(M)]'s flavor text?", "Message", "Yes", "No") != "Yes") + return + + log_admin("[key_name(usr)] has erased [key_name(M)]'s flavor text.") + message_admins("[key_name_admin(usr)] has erased [key_name_admin(M)]'s flavor text.") + + // Clears the body's flavor text as well as the persistent one + M.flavor_text = ""; + M.client.prefs.flavor_text = ""; + M.client.prefs.save_character(M.client) + + else if(href_list["userandomname"]) + if(!check_rights(R_ADMIN)) + return + + var/mob/M = locateUID(href_list["userandomname"]) + + if(!M.client) + to_chat(usr, "[M] doesn't seem to have an active client.") + return + + if(M.client.prefs.be_random_name) + to_chat(usr, "[M] already uses a random name.") + return + + if(alert(usr, "Force [key_name(M)] to use a random name?", "Message", "Yes", "No") != "Yes") + return + + log_admin("[key_name(usr)] has forced [key_name(M)] to use a random name.") + message_admins("[key_name_admin(usr)] has forced [key_name_admin(M)] to use a random name.") + + M.client.prefs.be_random_name = TRUE; + M.client.prefs.save_character(M.client) + else if(href_list["tdome1"]) if(!check_rights(R_SERVER|R_EVENT)) return diff --git a/code/modules/admin/verbs/adminsay.dm b/code/modules/admin/verbs/adminsay.dm index a0e8b4b9088..fd7be97fb5c 100644 --- a/code/modules/admin/verbs/adminsay.dm +++ b/code/modules/admin/verbs/adminsay.dm @@ -7,6 +7,13 @@ msg = sanitize(copytext(msg, 1, MAX_MESSAGE_LEN)) if(!msg) return + var/datum/asays/asay = new() + asay.ckey = usr.ckey + asay.rank = usr.client.holder.rank + asay.message = msg + asay.time = world.timeofday + + GLOB.asays += asay log_adminsay(msg, src) if(check_rights(R_ADMIN,0)) diff --git a/code/modules/admin/verbs/asays.dm b/code/modules/admin/verbs/asays.dm new file mode 100644 index 00000000000..d25d2753f12 --- /dev/null +++ b/code/modules/admin/verbs/asays.dm @@ -0,0 +1,47 @@ +GLOBAL_LIST_EMPTY(asays) + +/datum/asays + var/ckey = "" + var/rank = "" + var/message = "" + var/time = 0 + +/client/proc/viewasays() + set name = "View Asays" + set desc = "View Asays from the current round." + set category = "Admin" + + if(!check_rights(R_ADMIN)) + return + + var/output = "" + + // Header & body start + output += {" + + + + + + + + + "} + + for (var/datum/asays/A in GLOB.asays) + var/timestr = time2text(A.time, "hh:mm:ss") + output += {" + + + + + + "} + + output += {" + +
TimeCkeyMessage
[timestr][A.ckey] ([A.rank])[A.message]
"} + + var/datum/browser/popup = new(src, "asays", "
Current Round Asays
", 1000, 800) + popup.set_content(output) + popup.open(0) diff --git a/paradise.dme b/paradise.dme index c3dcfbd3c2d..137897243f0 100644 --- a/paradise.dme +++ b/paradise.dme @@ -1203,6 +1203,7 @@ #include "code\modules\admin\verbs\adminsay.dm" #include "code\modules\admin\verbs\alt_check.dm" #include "code\modules\admin\verbs\antag-ooc.dm" +#include "code\modules\admin\verbs\asays.dm" #include "code\modules\admin\verbs\atmosdebug.dm" #include "code\modules\admin\verbs\BrokenInhands.dm" #include "code\modules\admin\verbs\cinematic.dm"