mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-15 00:53:23 +01:00
Adds a "Ping all admins" command. (#19918)
* ping all admins * optional deadmin ping * aa feedback * fixes this at AA request * Update code/modules/admin/verbs/ping_all_admins.dm Co-authored-by: Sirryan2002 <80364400+Sirryan2002@users.noreply.github.com> * Update code/modules/admin/admin_verbs.dm * Apply suggestions from code review Co-authored-by: Sirryan2002 <80364400+Sirryan2002@users.noreply.github.com>
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
if (C && ckey == C.ckey && computer_id == C.computer_id && address == C.address)
|
||||
return //don't recheck connected clients.
|
||||
|
||||
if((ckey in GLOB.admin_datums) || (ckey in GLOB.deadmins))
|
||||
if((ckey in GLOB.admin_datums) || (ckey in GLOB.de_admins))
|
||||
var/datum/admins/A = GLOB.admin_datums[ckey]
|
||||
if(A && (A.rights & R_ADMIN))
|
||||
admin = 1
|
||||
|
||||
@@ -68,7 +68,8 @@ GLOBAL_LIST_INIT(admin_verbs_admin, list(
|
||||
/client/proc/list_ssds_afks,
|
||||
/client/proc/ccbdb_lookup_ckey,
|
||||
/client/proc/view_instances,
|
||||
/client/proc/start_vote
|
||||
/client/proc/start_vote,
|
||||
/client/proc/ping_all_admins
|
||||
))
|
||||
GLOBAL_LIST_INIT(admin_verbs_ban, list(
|
||||
/client/proc/ban_panel,
|
||||
@@ -632,14 +633,17 @@ GLOBAL_LIST_INIT(admin_verbs_maintainer, list(
|
||||
set name = "De-admin self"
|
||||
set category = "Admin"
|
||||
|
||||
if(!check_rights(R_ADMIN|R_MOD|R_MENTOR))
|
||||
if(!check_rights(R_ADMIN|R_MENTOR))
|
||||
return
|
||||
|
||||
log_admin("[key_name(usr)] deadmined themself.")
|
||||
message_admins("[key_name_admin(usr)] deadmined themself.")
|
||||
if(check_rights(R_ADMIN, FALSE))
|
||||
GLOB.de_admins += ckey
|
||||
else
|
||||
GLOB.de_mentors += ckey
|
||||
deadmin()
|
||||
verbs += /client/proc/readmin
|
||||
GLOB.deadmins += ckey
|
||||
to_chat(src, "<span class='interface'>You are now a normal player.</span>")
|
||||
SSblackbox.record_feedback("tally", "admin_verb", 1, "De-admin") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
|
||||
@@ -731,13 +735,15 @@ GLOBAL_LIST_INIT(admin_verbs_maintainer, list(
|
||||
D.associate(C)
|
||||
message_admins("[key_name_admin(usr)] re-adminned themselves.")
|
||||
log_admin("[key_name(usr)] re-adminned themselves.")
|
||||
GLOB.deadmins -= ckey
|
||||
GLOB.de_admins -= ckey
|
||||
GLOB.de_mentors -= ckey
|
||||
SSblackbox.record_feedback("tally", "admin_verb", 1, "Re-admin")
|
||||
return
|
||||
else
|
||||
to_chat(src, "You are already an admin.")
|
||||
verbs -= /client/proc/readmin
|
||||
GLOB.deadmins -= ckey
|
||||
GLOB.de_admins -= ckey
|
||||
GLOB.de_mentors -= ckey
|
||||
return
|
||||
|
||||
/client/proc/toggle_log_hrefs()
|
||||
|
||||
@@ -21,15 +21,16 @@
|
||||
SSredis.publish("byond.asay", json_encode(data))
|
||||
|
||||
for(var/client/C in GLOB.admins)
|
||||
var/temp_message = msg
|
||||
if(R_ADMIN & C.holder.rights)
|
||||
// Lets see if this admin was pinged in the asay message
|
||||
if(findtext(msg, "@[C.ckey]") || findtext(msg, "@[C.key]")) // Check ckey and key, so you can type @AffectedArc07 or @affectedarc07
|
||||
if(findtext(temp_message, "@[C.ckey]") || findtext(temp_message, "@[C.key]")) // Check ckey and key, so you can type @AffectedArc07 or @affectedarc07
|
||||
SEND_SOUND(C, sound('sound/misc/ping.ogg'))
|
||||
msg = replacetext(msg, "@[C.ckey]", "<font color='red'>@[C.ckey]</font>")
|
||||
msg = replacetext(msg, "@[C.key]", "<font color='red'>@[C.key]</font>") // Same applies here. key and ckey.
|
||||
temp_message = replacetext(temp_message, "@[C.ckey]", "<font color='red'>@[C.ckey]</font>")
|
||||
temp_message = replacetext(temp_message, "@[C.key]", "<font color='red'>@[C.key]</font>") // Same applies here. key and ckey.
|
||||
|
||||
msg = "<span class='emoji_enabled'>[msg]</span>"
|
||||
to_chat(C, "<span class='admin_channel'>ADMIN: <span class='name'>[key_name(usr, 1)]</span> ([admin_jump_link(mob)]): <span class='message'>[msg]</span></span>")
|
||||
temp_message = "<span class='emoji_enabled'>[temp_message]</span>"
|
||||
to_chat(C, "<span class='admin_channel'>ADMIN: <span class='name'>[key_name(usr, 1)]</span> ([admin_jump_link(mob)]): <span class='message'>[temp_message]</span></span>")
|
||||
|
||||
SSblackbox.record_feedback("tally", "admin_verb", 1, "Asay") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/client/proc/ping_all_admins()
|
||||
set name = "Ping all admins"
|
||||
set category = "Admin"
|
||||
|
||||
if(!check_rights(R_ADMIN, FALSE))
|
||||
return
|
||||
|
||||
var/msg = input(src, "What message do you want the ping to show?", "Ping all admins") as text|null
|
||||
msg = sanitize(copytext(msg, 1, MAX_MESSAGE_LEN))
|
||||
|
||||
if(!msg)
|
||||
return
|
||||
|
||||
var/list/admins_to_ping = list()
|
||||
|
||||
for(var/client/C in GLOB.admins)
|
||||
if(R_ADMIN & C.holder.rights)
|
||||
admins_to_ping += C
|
||||
|
||||
var/de_admin_also = alert(usr, "Do you want to ping admins that have used de-admin?","Ping all admins", "Yes", "No")
|
||||
if(de_admin_also == "Yes")
|
||||
for(var/key in GLOB.de_admins)
|
||||
var/client/C = GLOB.directory[ckey]
|
||||
if(!C)
|
||||
continue
|
||||
admins_to_ping += C
|
||||
|
||||
if(length(admins_to_ping) < 2) // All by yourself?
|
||||
to_chat(usr, "<span class='boldannounce'>No other admins online to ping[de_admin_also == "Yes" ? ", including those that have used de-admin" : ""]!</span>")
|
||||
return
|
||||
|
||||
var/datum/asays/asay = new(usr.ckey, usr.client.holder.rank, msg, world.timeofday)
|
||||
GLOB.asays += asay
|
||||
log_ping_all_admins("[length(admins_to_ping)] clients pinged: [msg]", src)
|
||||
|
||||
for(var/client/C in admins_to_ping)
|
||||
SEND_SOUND(C, sound('sound/misc/ping.ogg'))
|
||||
to_chat(C, "<span class='all_admin_ping'>ALL ADMIN PING: <span class='name'>[key_name(usr, TRUE)]</span> ([admin_jump_link(mob)]): <span class='emoji_enabled'>[msg]</span></span>")
|
||||
to_chat(usr, "[length(admins_to_ping)] clients pinged.")
|
||||
Reference in New Issue
Block a user