From f908a610b7265a187f187f5ca627a6ba388641b0 Mon Sep 17 00:00:00 2001 From: "baloh.matevz" Date: Fri, 27 Jul 2012 07:13:08 +0000 Subject: [PATCH] - If someone enters the name of an AI or the word 'AI' in an adminhelp, a (CL) link is displayed along with the others, which is a shortcut to the 'check laws' secret panel button. - The 'check laws' secret panel button now outputs AI laws, cyborg laws and also pai laws. It used to just be AI laws. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4190 316c924e-a436-60f5-8080-3fe189b3f50e --- code/modules/admin/admin.dm | 30 +++++++++++++++++++++------ code/modules/admin/verbs/adminhelp.dm | 13 +++++++++++- 2 files changed, 36 insertions(+), 7 deletions(-) diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index bd65dfc5df3..28eeb6ddc53 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -1153,6 +1153,10 @@ var/global/BSACooldown = 0 sleep(2) cl.jumptomob(M) + if (href_list["adminchecklaws"]) + if(src && src.owner) + output_ai_laws() + if (href_list["adminmoreinfo"]) var/mob/M = locate(href_list["adminmoreinfo"]) if(!M) @@ -2101,12 +2105,7 @@ var/global/BSACooldown = 0 if("check_antagonist") check_antagonists() if("showailaws") - for(var/mob/living/silicon/ai/ai in mob_list) - usr << "[key_name(ai, usr)]'s Laws:" - if (ai.laws == null) - usr << "[key_name(ai, usr)]'s Laws are null??" - else - ai.laws.show_laws(usr) + output_ai_laws() if("showgm") if(!ticker) alert("The game hasn't started yet!") @@ -2996,6 +2995,25 @@ var/global/BSACooldown = 0 feedback_add_details("admin_verb","UJBP") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! return +/obj/admins/proc/output_ai_laws() + var/ai_number = 0 + for(var/mob/living/silicon/S in mob_list) + ai_number++ + if(isAI(S)) + usr << "AI [key_name(S, usr)]'s laws:" + else if(isrobot(S)) + usr << "CYBORG [key_name(S, usr)]'s laws:" + else if (ispAI(S)) + usr << "pAI [key_name(S, usr)]'s laws:" + else + usr << "SOMETHING SILICON [key_name(S, usr)]'s laws:" + + if (S.laws == null) + usr << "[key_name(S, usr)]'s laws are null?? Contact a coder." + else + S.laws.show_laws(usr) + if(!ai_number) + usr << "No AIs located" //Just so you know the thing is actually working and not just ignoring you. // // diff --git a/code/modules/admin/verbs/adminhelp.dm b/code/modules/admin/verbs/adminhelp.dm index be703d9c1e9..acf99ab6cf4 100644 --- a/code/modules/admin/verbs/adminhelp.dm +++ b/code/modules/admin/verbs/adminhelp.dm @@ -41,6 +41,8 @@ var/list/adminhelp_ignored_words = list("unknown","the","a","an", "monkey", "ali //So if this list has the value list("John","Jane") and msg is, at the end, "This is × and he griffed ×" the text to //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. + 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. + //we will try to locate each word of the message in our lists of names and clients //for each mob that we have found //split the mob's info into a list. "John Arnolds" becomes list("John","Arnolds") so we can iterate through this @@ -58,6 +60,9 @@ var/list/adminhelp_ignored_words = list("unknown","the","a","an", "monkey", "ali word = dd_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 = dd_text2list("[M.name] [M.real_name] [M.original_name] [M.ckey] [M.key]", " ") var/word_is_match = 0 //Used to break from this mob for loop if a match is found @@ -70,6 +75,8 @@ var/list/adminhelp_ignored_words = list("unknown","the","a","an", "monkey", "ali word_is_match = 1 break if(word_is_match) + if(isAI(M)) + ai_found = 1 break //Breaks execution of the mob loop, since a match was already found. var/j = 1 //index to the next element in the replacement_value list @@ -92,7 +99,11 @@ var/list/adminhelp_ignored_words = list("unknown","the","a","an", "monkey", "ali admin_number_afk++ if(X.sound_adminhelp) X << 'adminhelp.ogg' - var/msg_to_send = "\blue HELP: [key_name(src, X)] (?) (PP) (VV) (SM) (JMP) (CA): [msg]" + var/check_laws_text = "" + if(ai_found) + check_laws_text = (" (CL)") + + var/msg_to_send = "\blue HELP: [key_name(src, X)] (?) (PP) (VV) (SM) (JMP) (CA) [check_laws_text]: [msg]" msg_to_send = dd_replaceText(msg_to_send, "HOLDERREF", "\ref[X.holder]") msg_to_send = dd_replaceText(msg_to_send, "ADMINREF", "\ref[X]") X << msg_to_send