Added a switch inside client/Topic which can direct the topic call to a few frequently used destinations.

Before, when making a link to an admin tool, you done this:
<a href='?src=\ref[C.holder];parameter=1;>link</a>

Now, we do not need to use a reference to direct it to places like usr or usr.client.holder (or client, but you never needed src for that anyway)
usr: <a href='?_src_=usr;parameter=1;>link</a>
holder: <a href='?_src_=holder;parameter=1;>link</a>

This basically allows us to move a LOT of code outside of loops as we no longer have to create a \ref for every recipient of the message. They can all be sent identical links. A simple example of this would be in pray.dm Although it's most noticeable in the adminhelp code which is vastly simplified.

Adminhelp name spotting code thingy...whatever... looks for ckey matches first, then surnames, then forenames. This is to stop it possibly weirding out if there is a station full of "Ed"s of "Sarah"s

Prayer code no longer loads a new icon into memory every time a prayer is sent. Use image() not icon()!

key_name() no longer needs a reference for it's admin_link argument.

message_admin() pretty much doesn't need those extra arguments for finding and replacing %holder_ref%. I've got to go through all the code to check before I remove it though.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@5105 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
elly1989@rocketmail.com
2012-11-18 08:27:11 +00:00
parent a0e8bb51e0
commit a10f6e0ec2
14 changed files with 142 additions and 177 deletions

View File

@@ -475,68 +475,52 @@ Turf and target are seperate in case you want to teleport some distance from a t
/proc/key_name(var/whom, var/include_link = null, var/include_name = 1) /proc/key_name(var/whom, var/include_link = null, var/include_name = 1)
var/mob/the_mob = null var/mob/M
var/client/the_client = null var/client/C
var/the_key = "" var/key
if (isnull(whom)) if(!whom) return "*null*"
return "*null*" if(istype(whom, /client))
else if (istype(whom, /client)) C = whom
the_client = whom M = C.mob
the_mob = the_client.mob key = C.key
the_key = the_client.key else if(ismob(whom))
else if (ismob(whom)) M = whom
the_mob = whom C = M.client
the_client = the_mob.client key = M.key
the_key = the_mob.key else if(istype(whom, /datum))
else if (istype(whom, /datum)) var/datum/D = whom
var/datum/the_datum = whom return "*invalid:[D.type]*"
return "*invalid:[the_datum.type]*"
else else
return "*invalid*" return "*invalid*"
var/text = "" . = ""
if (!the_key) if(key)
text += "*no client*" if(include_link && C)
else . += "<a href='?priv_msg=\ref[C]'>"
var/linked = 1
if (include_link && !isnull(the_mob))
if (istext(include_link))
text += "<a href=\"byond://?src=[include_link];priv_msg=\ref[the_client]\">"
else
if(ismob(include_link))
var/mob/MM = include_link
if(MM.client)
text += "<a href=\"byond://?src=\ref[MM.client];priv_msg=\ref[the_client]\">"
else
linked = 0
else if (istype(include_link, /client))
text += "<a href=\"byond://?src=\ref[include_link];priv_msg=\ref[the_client]\">"
else
linked = 0
if (the_client && the_client.holder && the_client.holder.fakekey && !include_name) if(C && C.holder && C.holder.fakekey && !include_name)
text += "Administrator" . += "Administrator"
else else
text += "[the_key]" . += key
if (!isnull(include_link) && !isnull(the_mob)) if(include_link)
if(linked) if(C) . += "</a>"
text += "</a>" else . += " (DC)"
else else
text += " (DC)" . += "*no key*"
if (include_name && !isnull(the_mob)) if(include_name && M)
if (the_mob.real_name) if(M.real_name)
text += "/([the_mob.real_name])" . += "/([M.real_name])"
else if (the_mob.name) else if(M.name)
text += "/([the_mob.name])" . += "/([M.name])"
return text return .
/proc/key_name_admin(var/whom, var/include_name = 1) /proc/key_name_admin(var/whom, var/include_name = 1)
return key_name(whom, "%admin_ref%", include_name) return key_name(whom, 1, include_name)
// Registers the on-close verb for a browse window (client/verb/.windowclose) // Registers the on-close verb for a browse window (client/verb/.windowclose)

View File

@@ -24,7 +24,7 @@
if("Supply Shuttle") if("Supply Shuttle")
supply_shuttle.process() supply_shuttle.process()
feedback_add_details("admin_verb","RSupply") feedback_add_details("admin_verb","RSupply")
message_admins("Admin [key_name_admin(usr)] has restarted the [controller] controller.", 1) message_admins("Admin [key_name_admin(usr)] has restarted the [controller] controller.")
return return
@@ -74,5 +74,5 @@
if("Cameras") if("Cameras")
debug_variables(cameranet) debug_variables(cameranet)
feedback_add_details("admin_verb","DCameras") feedback_add_details("admin_verb","DCameras")
message_admins("Admin [key_name_admin(usr)] is debugging the [controller] controller.", 1) message_admins("Admin [key_name_admin(usr)] is debugging the [controller] controller.")
return return

View File

@@ -417,7 +417,7 @@ client
var/new_name = copytext(sanitize(input(usr,"What would you like to name this mob?","Input a name",M.real_name) as text|null),1,MAX_NAME_LEN) var/new_name = copytext(sanitize(input(usr,"What would you like to name this mob?","Input a name",M.real_name) as text|null),1,MAX_NAME_LEN)
if( !new_name || !M ) return if( !new_name || !M ) return
message_admins("Admin [key_name_admin(usr)] renamed [key_name_admin(M)] to [new_name].", 1) message_admins("Admin [key_name_admin(usr)] renamed [key_name_admin(M)] to [new_name].")
M.fully_replace_character_name(M.real_name,new_name) M.fully_replace_character_name(M.real_name,new_name)
href_list["datumrefresh"] = href_list["rename"] href_list["datumrefresh"] = href_list["rename"]
@@ -590,7 +590,7 @@ client
usr << "No objects of this type exist" usr << "No objects of this type exist"
return return
log_admin("[key_name(usr)] deleted all objects of type [O_type] ([i] objects deleted) ") log_admin("[key_name(usr)] deleted all objects of type [O_type] ([i] objects deleted) ")
message_admins("\blue [key_name(usr)] deleted all objects of type [O_type] ([i] objects deleted) ", 1) message_admins("\blue [key_name(usr)] deleted all objects of type [O_type] ([i] objects deleted) ")
if("Type and subtypes") if("Type and subtypes")
var/i = 0 var/i = 0
for(var/obj/Obj in world) for(var/obj/Obj in world)
@@ -601,7 +601,7 @@ client
usr << "No objects of this type exist" usr << "No objects of this type exist"
return return
log_admin("[key_name(usr)] deleted all objects of type or subtype of [O_type] ([i] objects deleted) ") log_admin("[key_name(usr)] deleted all objects of type or subtype of [O_type] ([i] objects deleted) ")
message_admins("\blue [key_name(usr)] deleted all objects of type or subtype of [O_type] ([i] objects deleted) ", 1) message_admins("\blue [key_name(usr)] deleted all objects of type or subtype of [O_type] ([i] objects deleted) ")
else if(href_list["explode"]) else if(href_list["explode"])
if(!check_rights(0)) return if(!check_rights(0)) return
@@ -774,7 +774,7 @@ client
if(amount != 0) if(amount != 0)
log_admin("[key_name(usr)] dealt [amount] amount of [Text] damage to [L] ") log_admin("[key_name(usr)] dealt [amount] amount of [Text] damage to [L] ")
message_admins("\blue [key_name(usr)] dealt [amount] amount of [Text] damage to [L] ", 1) message_admins("\blue [key_name(usr)] dealt [amount] amount of [Text] damage to [L] ")
href_list["datumrefresh"] = href_list["mobToDamage"] href_list["datumrefresh"] = href_list["mobToDamage"]
else else
. = 0 . = 0

View File

@@ -424,6 +424,6 @@ var/list/archive_diseases = list()
var/list/name_symptoms = list() var/list/name_symptoms = list()
for(var/datum/symptom/S in D.symptoms) for(var/datum/symptom/S in D.symptoms)
name_symptoms += S.name name_symptoms += S.name
message_admins("[key_name_admin(user)] has triggered a custom virus outbreak of [D.name]! It has these symptoms: [english_list(name_symptoms)]", 1) message_admins("[key_name_admin(user)] has triggered a custom virus outbreak of [D.name]! It has these symptoms: [english_list(name_symptoms)]")
#undef RANDOM_STARTING_LEVEL #undef RANDOM_STARTING_LEVEL

View File

@@ -750,7 +750,7 @@ datum/mind
var/mob/living/carbon/monkey/M = current var/mob/living/carbon/monkey/M = current
if (istype(H)) if (istype(H))
log_admin("[key_name(usr)] attempting to monkeyize [key_name(current)]") log_admin("[key_name(usr)] attempting to monkeyize [key_name(current)]")
message_admins("\blue [key_name_admin(usr)] attempting to monkeyize [key_name_admin(current)]", 1) message_admins("\blue [key_name_admin(usr)] attempting to monkeyize [key_name_admin(current)]")
src = null src = null
M = H.monkeyize() M = H.monkeyize()
src = M.mind src = M.mind
@@ -780,7 +780,7 @@ datum/mind
D.cure(0) D.cure(0)
sleep(0) //because deleting of virus is doing throught spawn(0) sleep(0) //because deleting of virus is doing throught spawn(0)
log_admin("[key_name(usr)] attempting to humanize [key_name(current)]") log_admin("[key_name(usr)] attempting to humanize [key_name(current)]")
message_admins("\blue [key_name_admin(usr)] attempting to humanize [key_name_admin(current)]", 1) message_admins("\blue [key_name_admin(usr)] attempting to humanize [key_name_admin(current)]")
var/obj/item/weapon/dnainjector/m2h/m2h = new var/obj/item/weapon/dnainjector/m2h/m2h = new
var/obj/item/weapon/implant/mobfinder = new(M) //hack because humanizing deletes mind --rastaf0 var/obj/item/weapon/implant/mobfinder = new(M) //hack because humanizing deletes mind --rastaf0
src = null src = null

View File

@@ -593,7 +593,7 @@ ________________________________________________________________________________
grant_kamikaze(U)//Give them verbs and change variables as necessary. grant_kamikaze(U)//Give them verbs and change variables as necessary.
U.regenerate_icons()//Update their clothing. U.regenerate_icons()//Update their clothing.
ninjablade()//Summon two energy blades. ninjablade()//Summon two energy blades.
message_admins("\blue [U.key] used KAMIKAZE mode.", 1)//Let the admins know. message_admins("\blue [key_name_admin(U)] used KAMIKAZE mode.")//Let the admins know.
s_busy = 0 s_busy = 0
return return
sleep(s_delay) sleep(s_delay)

View File

@@ -475,7 +475,7 @@ As such, it's hard-coded for now. No reason for it not to be, really.
space_ninja_arrival(input, mission) space_ninja_arrival(input, mission)
message_admins("\blue [key] has spawned [input] as a Space Ninja.\nTheir <b>mission</b> is: [mission]", 1) message_admins("\blue [key_name_admin(key)] has spawned [input] as a Space Ninja.\nTheir <b>mission</b> is: [mission]")
log_admin("[key] used Spawn Space Ninja.") log_admin("[key] used Spawn Space Ninja.")
return return

View File

@@ -84,7 +84,7 @@
if(security_level != old_level) if(security_level != old_level)
//Only notify the admins if an actual change happened //Only notify the admins if an actual change happened
log_game("[key_name(usr)] has changed the security level to [get_security_level()].") log_game("[key_name(usr)] has changed the security level to [get_security_level()].")
message_admins("[key_name_admin(usr)] has changed the security level to [get_security_level()].", 1) message_admins("[key_name_admin(usr)] has changed the security level to [get_security_level()].")
switch(security_level) switch(security_level)
if(SEC_LEVEL_GREEN) if(SEC_LEVEL_GREEN)
feedback_inc("alert_comms_green",1) feedback_inc("alert_comms_green",1)

View File

@@ -27,7 +27,7 @@
entry += " - <font color='black'><b>DEAD</b></font>" entry += " - <font color='black'><b>DEAD</b></font>"
if(is_special_character(C.mob)) if(is_special_character(C.mob))
entry += " - <b><font color='red'>Antagonist</font></b>" entry += " - <b><font color='red'>Antagonist</font></b>"
entry += " (<A HREF='?src=\ref[holder];adminmoreinfo=\ref[C.mob]'>?</A>)" entry += " (<A HREF='?_src_=holder;adminmoreinfo=\ref[C.mob]'>?</A>)"
Lines += entry Lines += entry
else else
for(var/client/C in clients) for(var/client/C in clients)

View File

@@ -1,5 +1,6 @@
/datum/admins/Topic(href, href_list) /datum/admins/Topic(href, href_list)
..() ..()
if(usr.client != src.owner || !check_rights(0)) if(usr.client != src.owner || !check_rights(0))
world << "\blue [usr.key] has attempted to override the admin panel!" world << "\blue [usr.key] has attempted to override the admin panel!"
log_admin("[key_name(usr)] tried to use the admin panel without authorization.") log_admin("[key_name(usr)] tried to use the admin panel without authorization.")

View File

@@ -1,122 +1,101 @@
//This is a list of words which are ignored by the parser when comparing message contents for names. MUST BE IN LOWER CASE! //This is a list of words which are ignored by the parser when comparing message contents for names. MUST BE IN LOWER CASE!
var/list/adminhelp_ignored_words = list("unknown","the","a","an", "monkey", "alien", "as") var/list/adminhelp_ignored_words = list("unknown","the","a","an","of","monkey","alien","as")
/client/verb/adminhelp(msg as text) /client/verb/adminhelp(msg as text)
set category = "Admin" set category = "Admin"
set name = "Adminhelp" set name = "Adminhelp"
//handle muting and automuting
if(muted & MUTE_ADMINHELP) if(muted & MUTE_ADMINHELP)
src << "<font color='red'>Error: Admin-PM: You cannot send adminhelps (Muted).</font>" src << "<font color='red'>Error: Admin-PM: You cannot send adminhelps (Muted).</font>"
return return
if(src.handle_spam_prevention(msg,MUTE_ADMINHELP))
if (src.handle_spam_prevention(msg,MUTE_ADMINHELP))
return return
//remove out adminhelp verb temporarily to prevent spamming of admins.
src.verbs -= /client/verb/adminhelp src.verbs -= /client/verb/adminhelp
spawn(1200) spawn(1200)
src.verbs += /client/verb/adminhelp // 2 minute cool-down for adminhelps src.verbs += /client/verb/adminhelp // 2 minute cool-down for adminhelps
//clean the input msg
if(!msg) return if(!msg) return
msg = sanitize(copytext(msg,1,MAX_MESSAGE_LEN)) msg = sanitize(copytext(msg,1,MAX_MESSAGE_LEN))
if (!msg) return if(!msg) return
var/original_msg = msg var/original_msg = msg
//The symbol <20> (fancy multiplication sign) will be used to mark where to put replacements, so the original message must not contain it. //explode the input msg into a list
msg = replacetext(msg, "<22>", "")
msg = replacetext(msg, "HOLDERREF", "HOLDER-REF") //HOLDERREF is a key word which gets replaced with the admin's holder ref later on, so it mustn't be in the original message
msg = replacetext(msg, "ADMINREF", "ADMIN-REF") //ADMINREF is a key word which gets replaced with the admin's client's ref. So it mustn't be in the original message.
var/list/msglist = text2list(msg, " ") var/list/msglist = text2list(msg, " ")
var/list/mob/mobs = list() //generate keywords lookup
var/list/surnames = list()
var/list/forenames = list()
var/list/ckeys = list()
for(var/mob/M in mob_list) for(var/mob/M in mob_list)
mobs += M var/list/indexing = list(M.real_name, M.name)
if(M.mind) indexing += M.mind.name
var/list/replacement_value = list() //When a word match is found, the word matched will get replaced with an <20> (fancy multiplication symbol). for(var/string in indexing)
//This list will contain a list of values which the <20> will be replaced with in the same order as indexes in this list. var/list/L = text2list(string, " ")
//So if this list has the value list("John","Jane") and msg is, at the end, "This is <20> and he griffed <20>" the text to var/surname_found = 0
//display will be "This is John and he griffe Jane". The strings in this list are a bit more complex than 'John' and 'Jane' tho. //surnames
for(var/i=L.len, i>=1, i--)
var/ai_found = 0 //If an AI name or 'ai' word is found in the text, the additional (CL) = Check Laws button gets added. Not added every time so it doesn't spam. var/word = ckey(L[i])
if(word)
//we will try to locate each word of the message in our lists of names and clients surnames[word] = M
//for each mob that we have found surname_found = i
//split the mob's info into a list. "John Arnolds" becomes list("John","Arnolds") so we can iterate through this
//for each of the name parts IE. "John", "Arnolds", etc. in the current name.
for(var/i = 1; i <= msglist.len; i++)
var/word = msglist[i]
var/original_word = word
word = replacetext(word, ".", "")
word = replacetext(word, ",", "")
word = replacetext(word, "!", "")
word = replacetext(word, "?", "") //Strips some common punctuation characters so the actual word can be better compared.
word = replacetext(word, ";", "")
word = replacetext(word, ":", "")
word = replacetext(word, "(", "")
word = replacetext(word, ")", "")
if(lowertext(word) in adminhelp_ignored_words)
continue
if(lowertext(word) == "ai")
ai_found = 1
continue
for(var/mob/M in mobs)
var/list/namelist = text2list("[M.name] [M.real_name] [(M.mind)?"[M.mind.name]":""] [M.ckey] [M.key]", " ")
var/word_is_match = 0 //Used to break from this mob for loop if a match is found
for(var/namepart in namelist)
if( lowertext(word) == lowertext(namepart) )
msglist[i] = "<22>"
var/description_string = "<b><font color='black'>[original_word] (<A HREF='?src=HOLDERREF;adminmoreinfo=\ref[M]'>?</A>)</font></b>"
replacement_value += description_string
mobs -= M //If a mob is found then remove it from the list of mobs, so we don't get the same mob reported a million times.
word_is_match = 1
break break
if(word_is_match) //forenames
if(isAI(M)) for(var/i=1, i<surname_found, i++)
var/word = ckey(L[i])
if(word)
forenames[word] = M
//ckeys
ckeys[M.ckey] = M
var/ai_found = 0
msg = ""
var/list/mobs_found = list()
for(var/original_word in msglist)
var/word = ckey(original_word)
if(word)
if(!(word in adminhelp_ignored_words))
if(word == "ai")
ai_found = 1 ai_found = 1
break //Breaks execution of the mob loop, since a match was already found. else
var/mob/found = ckeys[word]
if(!found)
found = surnames[word]
if(!found)
found = forenames[word]
if(found)
if(!(found in mobs_found))
mobs_found += found
if(!ai_found && isAI(found))
ai_found = 1
msg += "<b><font color='black'>[original_word] (<A HREF='?_src_=holder;adminmoreinfo=\ref[found]'>?</A>)</font></b> "
continue
msg += "[original_word] "
var/j = 1 //index to the next element in the replacement_value list if(!mob) return //this doesn't happen
for(var/i = 1; i <= msglist.len; i++)
var/word = msglist[i]
if(word == "<22>")
msglist[i] = replacement_value[j]
j++
msg = dd_list2text(msglist, " ") var/ref_mob = "\ref[mob]"
msg = "\blue <b><font color=red>HELP: </font>[key_name(src, 1)] (<A HREF='?_src_=holder;adminmoreinfo=[ref_mob]'>?</A>) (<A HREF='?_src_=holder;adminplayeropts=[ref_mob]'>PP</A>) (<A HREF='?_src_=holder;adminplayervars=[ref_mob]'>VV</A>) (<A HREF='?_src_=holder;subtlemessage=[ref_mob]'>SM</A>) (<A HREF='?_src_=holder;adminplayerobservejump=[ref_mob]'>JMP</A>) (<A HREF='?_src_=holder;secretsadmin=check_antagonist'>CA</A>) [ai_found ? " (<A HREF='?_src_=holder;adminchecklaws=[ref_mob]'>CL</A>)" : ""]:</b> [msg]"
//send this msg to all admins
var/admin_number_afk = 0 var/admin_number_afk = 0
for(var/client/X in admins)
if(X.is_afk())
admin_number_afk++
if(X.holder.sound_adminhelp)
X << 'sound/effects/adminhelp.ogg'
X << msg
if(mob) //show it to the person adminhelping too
var/ref_mob = "\ref[src.mob]"
for(var/client/X in admins)
if( X.inactivity > AFK_THRESHOLD ) //When I made this, the AFK_THRESHOLD was 3000ds = 300s = 5m, see setup.dm for the new one.
admin_number_afk++
if(X.holder.sound_adminhelp)
X << 'sound/effects/adminhelp.ogg'
var/check_laws_text = ""
if(ai_found)
check_laws_text = (" (<A HREF='?src=\ref[X.holder];adminchecklaws=[ref_mob]'>CL</A>)")
var/msg_to_send = "\blue <b><font color=red>HELP: </font>[key_name(src, X)] (<A HREF='?src=\ref[X.holder];adminmoreinfo=[ref_mob]'>?</A>) (<A HREF='?src=\ref[X.holder];adminplayeropts=[ref_mob]'>PP</A>) (<A HREF='?src=\ref[X.holder];adminplayervars=[ref_mob]'>VV</A>) (<A HREF='?src=\ref[X.holder];subtlemessage=[ref_mob]'>SM</A>) (<A HREF='?src=\ref[X.holder];adminplayerobservejump=[ref_mob]'>JMP</A>) (<A HREF='?src=\ref[X.holder];secretsadmin=check_antagonist'>CA</A>) [check_laws_text]:</b> [msg]"
msg_to_send = replacetext(msg_to_send, "HOLDERREF", "\ref[X.holder]")
msg_to_send = replacetext(msg_to_send, "ADMINREF", "\ref[X]")
X << msg_to_send
else
var/ref_client = "\ref[src]"
for(var/client/X in admins)
if( X.inactivity > AFK_THRESHOLD ) //When I made this, the AFK_THRESHOLD was 3000ds = 300s = 5m, see setup.dm for the new one.
admin_number_afk++
if(X.holder.sound_adminhelp)
X << 'sound/effects/adminhelp.ogg'
var/msg_to_send = "\blue <b><font color=red>HELP: </font>[key_name(src, X)] (<A HREF='?src=\ref[X.holder];adminplayervars=[ref_client]'>VV</A>) (<A HREF='?src=\ref[X.holder];secretsadmin=check_antagonist'>CA</A>):</b> [msg]"
msg_to_send = replacetext(msg_to_send, "HOLDERREF", "\ref[X.holder]")
msg_to_send = replacetext(msg_to_send, "ADMINREF", "\ref[X]")
X << msg_to_send
var/admin_number_present = admins.len - admin_number_afk
src << "<font color='blue'>PM to-<b>Admins</b>: [original_msg]</font>" src << "<font color='blue'>PM to-<b>Admins</b>: [original_msg]</font>"
var/admin_number_present = admins.len - admin_number_afk
log_admin("HELP: [key_name(src)]: [original_msg] - heard by [admin_number_present] non-AFK admins.") log_admin("HELP: [key_name(src)]: [original_msg] - heard by [admin_number_present] non-AFK admins.")
if(admin_number_present <= 0) if(admin_number_present <= 0)
if(!admin_number_afk) if(!admin_number_afk)

View File

@@ -6,14 +6,15 @@
msg = copytext(sanitize(msg), 1, MAX_MESSAGE_LEN) msg = copytext(sanitize(msg), 1, MAX_MESSAGE_LEN)
if(!msg) return if(!msg) return
if(check_rights(R_ADMIN,0))
for(var/client/C in admins)
C << "<span class='admin'><span class='prefix'>ADMIN:</span> <EM>[key_name(usr, C)]</EM> (<A HREF='?src=\ref[C.holder];adminplayerobservejump=\ref[mob]'>JMP</A>): <span class='message'>[msg]</span></span>"
else
for(var/client/C in admins)
C << "<span class='adminobserver'><span class='prefix'>ADMIN:</span> <EM>[key_name(usr, C)]:</EM> <span class='message'>[msg]</span></span>"
log_admin("[key_name(src)] : [msg]") log_admin("[key_name(src)] : [msg]")
if(check_rights(R_ADMIN,0))
msg = "<span class='admin'><span class='prefix'>ADMIN:</span> <EM>[key_name(usr, 1)]</EM> (<a href='?_src_=holder;adminplayerobservejump=\ref[mob]'>JMP</A>): <span class='message'>[msg]</span></span>"
admins << msg
else
msg = "<span class='adminobserver'><span class='prefix'>ADMIN:</span> <EM>[key_name(usr, 1)]:</EM> <span class='message'>[msg]</span></span>"
admins << msg
feedback_add_details("admin_verb","M") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! feedback_add_details("admin_verb","M") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!

View File

@@ -3,36 +3,32 @@
set name = "Pray" set name = "Pray"
msg = copytext(sanitize(msg), 1, MAX_MESSAGE_LEN) msg = copytext(sanitize(msg), 1, MAX_MESSAGE_LEN)
if(!msg) return
if (!msg) if(usr.client)
return
if (usr.client)
if(usr.client.muted & MUTE_PRAY) if(usr.client.muted & MUTE_PRAY)
usr << "\red You cannot pray (muted)." usr << "\red You cannot pray (muted)."
return return
if(src.client.handle_spam_prevention(msg,MUTE_PRAY))
if (src.client.handle_spam_prevention(msg,MUTE_PRAY))
return return
var/icon/cross = icon('icons/obj/storage.dmi',"bible") var/image/cross = image('icons/obj/storage.dmi',"bible")
msg = "\blue \icon[cross] <b><font color=purple>PRAY: </font>[key_name(src, 1)] (<A HREF='?_src_=holder;adminmoreinfo=\ref[src]'>?</A>) (<A HREF='?_src_=holder;adminplayeropts=\ref[src]'>PP</A>) (<A HREF='?_src_=holder;adminplayervars=\ref[src]'>VV</A>) (<A HREF='?_src_=holder;subtlemessage=\ref[src]'>SM</A>) (<A HREF='?_src_=holder;adminplayerobservejump=\ref[src]'>JMP</A>) (<A HREF='?_src_=holder;secretsadmin=check_antagonist'>CA</A>) (<A HREF='?_src_=holder;adminspawncookie=\ref[src]'>SC</a>):</b> [msg]"
for(var/client/C in admins) for(var/client/C in admins)
if(C.seeprayers) if(C.seeprayers)
C << "\blue \icon[cross] <b><font color=purple>PRAY: </font>[key_name(src, C)] (<A HREF='?src=\ref[C.holder];adminmoreinfo=\ref[src]'>?</A>) (<A HREF='?src=\ref[C.holder];adminplayeropts=\ref[src]'>PP</A>) (<A HREF='?src=\ref[C.holder];adminplayervars=\ref[src]'>VV</A>) (<A HREF='?src=\ref[C.holder];subtlemessage=\ref[src]'>SM</A>) (<A HREF='?src=\ref[C.holder];adminplayerobservejump=\ref[src]'>JMP</A>) (<A HREF='?src=\ref[C.holder];secretsadmin=check_antagonist'>CA</A>) (<A HREF='?src=\ref[C.holder];adminspawncookie=\ref[src]'>SC</a>):</b> [msg]" C << msg
usr << "Your prayers have been received by the gods." usr << "Your prayers have been received by the gods."
feedback_add_details("admin_verb","PR") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! feedback_add_details("admin_verb","PR") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
//log_admin("HELP: [key_name(src)]: [msg]") //log_admin("HELP: [key_name(src)]: [msg]")
/proc/Centcomm_announce(var/text , var/mob/Sender) /proc/Centcomm_announce(var/text , var/mob/Sender)
var/msg = copytext(sanitize(text), 1, MAX_MESSAGE_LEN) var/msg = copytext(sanitize(text), 1, MAX_MESSAGE_LEN)
for(var/client/C in admins) msg = "\blue <b><font color=orange>CENTCOMM:</font>[key_name(Sender, 1)] (<A HREF='?_src_=holder;adminplayeropts=\ref[Sender]'>PP</A>) (<A HREF='?_src_=holder;adminplayervars=\ref[Sender]'>VV</A>) (<A HREF='?_src_=holder;subtlemessage=\ref[Sender]'>SM</A>) (<A HREF='?_src_=holder;adminplayerobservejump=\ref[Sender]'>JMP</A>) (<A HREF='?_src_=holder;secretsadmin=check_antagonist'>CA</A>) (<A HREF='?_src_=holder;BlueSpaceArtillery=\ref[Sender]'>BSA</A>) (<A HREF='?_src_=holder;CentcommReply=\ref[Sender]'>RPLY</A>):</b> [msg]"
C << "\blue <b><font color=orange>CENTCOMM:</font>[key_name(Sender, C)] (<A HREF='?src=\ref[C.holder];adminplayeropts=\ref[Sender]'>PP</A>) (<A HREF='?src=\ref[C.holder];adminplayervars=\ref[Sender]'>VV</A>) (<A HREF='?src=\ref[C.holder];subtlemessage=\ref[Sender]'>SM</A>) (<A HREF='?src=\ref[C.holder];adminplayerobservejump=\ref[Sender]'>JMP</A>) (<A HREF='?src=\ref[C.holder];secretsadmin=check_antagonist'>CA</A>) (<A HREF='?src=\ref[C.holder];BlueSpaceArtillery=\ref[Sender]'>BSA</A>) (<A HREF='?src=\ref[C.holder];CentcommReply=\ref[Sender]'>RPLY</A>):</b> [msg]" admins << msg
/proc/Syndicate_announce(var/text , var/mob/Sender) /proc/Syndicate_announce(var/text , var/mob/Sender)
var/msg = copytext(sanitize(text), 1, MAX_MESSAGE_LEN) var/msg = copytext(sanitize(text), 1, MAX_MESSAGE_LEN)
for(var/client/C in admins) msg = "\blue <b><font color=crimson>SYNDICATE:</font>[key_name(Sender, 1)] (<A HREF='?_src_=holder;adminplayeropts=\ref[Sender]'>PP</A>) (<A HREF='?_src_=holder;adminplayervars=\ref[Sender]'>VV</A>) (<A HREF='?_src_=holder;subtlemessage=\ref[Sender]'>SM</A>) (<A HREF='?_src_=holder;adminplayerobservejump=\ref[Sender]'>JMP</A>) (<A HREF='?_src_=holder;secretsadmin=check_antagonist'>CA</A>) (<A HREF='?_src_=holder;BlueSpaceArtillery=\ref[Sender]'>BSA</A>) (<A HREF='?_src_=holder;SyndicateReply=\ref[Sender]'>RPLY</A>):</b> [msg]"
C << "\blue <b><font color=crimson>SYNDICATE:</font>[key_name(Sender, C)] (<A HREF='?src=\ref[C.holder];adminplayeropts=\ref[Sender]'>PP</A>) (<A HREF='?src=\ref[C.holder];adminplayervars=\ref[Sender]'>VV</A>) (<A HREF='?src=\ref[C.holder];subtlemessage=\ref[Sender]'>SM</A>) (<A HREF='?src=\ref[C.holder];adminplayerobservejump=\ref[Sender]'>JMP</A>) (<A HREF='?src=\ref[C.holder];secretsadmin=check_antagonist'>CA</A>) (<A HREF='?src=\ref[C.holder];BlueSpaceArtillery=\ref[Sender]'>BSA</A>) (<A HREF='?src=\ref[C.holder];SyndicateReply=\ref[Sender]'>RPLY</A>):</b> [msg]" admins << msg

View File

@@ -47,12 +47,16 @@
//Logs all hrefs //Logs all hrefs
if(config && config.log_hrefs && href_logfile) if(config && config.log_hrefs && href_logfile)
href_logfile << "<small>[time2text(world.timeofday,"hh:mm")] [src] (usr:[usr])</small> || [href]<br>" href_logfile << "<small>[time2text(world.timeofday,"hh:mm")] [src] (usr:[usr])</small> || [hsrc ? "[hsrc] " : ""][href]<br>"
switch(href_list["_src_"])
if("holder") hsrc = usr.client.holder
if("usr") hsrc = usr
if(view_var_Topic(href,href_list,hsrc)) //Until viewvars can be rewritten as datum/admins/Topic() if(view_var_Topic(href,href_list,hsrc)) //Until viewvars can be rewritten as datum/admins/Topic()
return return
..() //redirect to [locate(hsrc)]/Topic() ..() //redirect to hsrc.Topic()
/client/proc/handle_spam_prevention(var/message, var/mute_type) /client/proc/handle_spam_prevention(var/message, var/mute_type)
if(config.automute_on && !holder && src.last_message == message) if(config.automute_on && !holder && src.last_message == message)
@@ -181,6 +185,6 @@
//checks if a client is afk //checks if a client is afk
//3000 frames = 5 minutes //3000 frames = 5 minutes
/client/proc/is_afk(duration=3000) /client/proc/is_afk(duration=AFK_THRESHOLD)
if(inactivity > duration) return inactivity if(inactivity > duration) return inactivity
return 0 return 0