From f8ff7a551072d0a2f89df4cd3cc08f554e619fc5 Mon Sep 17 00:00:00 2001 From: PsiOmega Date: Wed, 16 Jul 2014 16:02:10 +0200 Subject: [PATCH] Allows the AI to select which channel to state laws on. --- code/modules/mob/living/silicon/ai/ai.dm | 9 ++++++ code/modules/mob/living/silicon/ai/laws.dm | 32 ++++++++++++---------- 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index 44da5d74af..62a0032618 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -27,6 +27,7 @@ var/list/ai_list = list() var/viewalerts = 0 var/lawcheck[1] var/ioncheck[1] + var/lawchannel = "Common" // Default channel on which to state laws var/icon/holo_icon//Default is assigned when AI is created. var/obj/item/device/pda/ai/aiPDA = null var/obj/item/device/multitool/aiMulti = null @@ -390,6 +391,14 @@ var/list/ai_list = list() // src << text ("Switching Law [L]'s report status to []", lawcheck[L+1]) checklaws() + if (href_list["lawr"]) // Selects on which channel to state laws + var/setchannel = input(usr, "Specify channel.", "Channel selection") in list("State","Common","Science","Command","Medical","Engineering","Security","Supply","Cancel") + if(setchannel == "Cancel") + return + lawchannel = setchannel + + checklaws() + //Uncomment this line of code if you are enabling the AI Vocal (VOX) announcements. /* if(href_list["say_word"]) diff --git a/code/modules/mob/living/silicon/ai/laws.dm b/code/modules/mob/living/silicon/ai/laws.dm index 904451aa1d..b4c9db3fcd 100755 --- a/code/modules/mob/living/silicon/ai/laws.dm +++ b/code/modules/mob/living/silicon/ai/laws.dm @@ -51,24 +51,28 @@ src.laws_sanity_check() src.laws.clear_supplied_laws() - - - - /mob/living/silicon/ai/proc/statelaws() // -- TLE // set category = "AI Commands" // set name = "State Laws" - src.say("Current Active Laws:") + /var/prefix = "" + switch(lawchannel) + if("Common") prefix = ";" + if("Science") prefix = ":n " + if("Command") prefix = ":c " + if("Medical") prefix = ":m " + if("Engineering") prefix = ":e " + if("Security") prefix = ":s " + if("Supply") prefix = ":u " + + src.say("[prefix]Current Active Laws:") //src.laws_sanity_check() //src.laws.show_laws(world) var/number = 1 sleep(10) - - if (src.laws.zeroth) if (src.lawcheck[1] == "Yes") //This line and the similar lines below make sure you don't state a law unless you want to. --NeoFite - src.say("0. [src.laws.zeroth]") + src.say("[prefix]0. [src.laws.zeroth]") sleep(10) for (var/index = 1, index <= src.laws.ion.len, index++) @@ -76,7 +80,7 @@ var/num = ionnum() if (length(law) > 0) if (src.ioncheck[index] == "Yes") - src.say("[num]. [law]") + src.say("[prefix][num]. [law]") sleep(10) for (var/index = 1, index <= src.laws.inherent.len, index++) @@ -84,22 +88,20 @@ if (length(law) > 0) if (src.lawcheck[index+1] == "Yes") - src.say("[number]. [law]") + src.say("[prefix][number]. [law]") sleep(10) number++ - for (var/index = 1, index <= src.laws.supplied.len, index++) var/law = src.laws.supplied[index] if (length(law) > 0) if(src.lawcheck.len >= number+1) if (src.lawcheck[number+1] == "Yes") - src.say("[number]. [law]") + src.say("[prefix][number]. [law]") sleep(10) number++ - /mob/living/silicon/ai/verb/checklaws() //Gives you a link-driven interface for deciding what laws the statelaws() proc will share with the crew. --NeoFite set category = "AI Commands" set name = "State Laws" @@ -144,6 +146,8 @@ src.lawcheck[number+1] = "Yes" list += {"[src.lawcheck[number+1]] [number]: [law]
"} number++ - list += {"

State Laws"} + + list += {"
Channel: [src.lawchannel]
"} + list += {"State Laws"} usr << browse(list, "window=laws") \ No newline at end of file