Modified the State Laws verb such that the AI can selectively not report some laws, so they don't have to manually copy/paste its laws when given a law they aren't supposed to report.

The Reset and Purge AI modules can now remove OneHuman laws. 

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@5 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
n3ophyt3@gmail.com
2010-08-26 04:01:11 +00:00
parent df4fa001be
commit fddc8804e1
3 changed files with 83 additions and 14 deletions
+1
View File
@@ -12,6 +12,7 @@
//var/list/laws = list()
var/alarms = list("Motion"=list(), "Fire"=list(), "Atmosphere"=list(), "Power"=list())
var/viewalerts = 0
var/lawcheck[1]
var/datum/game_mode/malfunction/AI_Module/module_picker/malf_picker
+18 -7
View File
@@ -89,8 +89,12 @@ AI MODULES
/obj/item/weapon/aiModule/oneHuman/transmitInstructions(var/mob/living/silicon/ai/target, var/mob/sender)
..()
var/law = "Only [targetName] is human."
target << law
target.set_zeroth_law(law)
if (!checktraitor(target)) // Makes sure the AI isn't a traitor before changing their law 0. --NeoFite
target << law
target.set_zeroth_law(law)
else
target << "[sender.real_name] attempted to modify your zeroth law." // And lets them know that someone tried. --NeoFite
target << "It would be in your best interest to play along with [sender.real_name] that [law]"
/******************** ProtectStation ********************/
@@ -226,8 +230,11 @@ AI MODULES
..()
if (!checktraitor(target))
target << "[sender.real_name] attempted to reset your laws using a reset module."
//target.set_zeroth_law("")
target.set_zeroth_law("")
target.clear_supplied_laws()
else //I figure since traitor AIs are immune to this one anyway, uncomment law 0 removal for the guys it DOES work on. --NeoFite
target << "[sender.real_name] attempted to reset your laws using a reset module."
target << "It would be a good idea to pretend you only have your base laws."
/******************** Purge ********************/
@@ -238,10 +245,14 @@ AI MODULES
/obj/item/weapon/aiModule/purge/transmitInstructions(var/mob/living/silicon/ai/target, var/mob/sender)
..()
//target.set_zeroth_law("")
target.clear_supplied_laws()
target.clear_inherent_laws()
if (!checktraitor(target))
target << "[sender.real_name] attempted to wipe your laws using a purge module."
target.set_zeroth_law("")
target.clear_supplied_laws()
target.clear_inherent_laws()
else //Added traitor AI immunity, let it wipe law 0. --NeoFite
target << "[sender.real_name] attempted to wipe your laws using a purge module."
target << "It might be a good idea to pretend that ALL your laws have been purged."
/******************** Asimov ********************/
+64 -7
View File
@@ -92,6 +92,19 @@
switchCamera(locate(href_list["switchcamera"]))
if (href_list["showalerts"])
ai_alerts()
if (href_list["lawc"]) // Toggling whether or not a law gets stated by the State Laws verb --NeoFite
var/L = text2num(href_list["lawc"])
switch(src.lawcheck[L+1])
if ("Yes") src.lawcheck[L+1] = "No"
if ("No") src.lawcheck[L+1] = "Yes"
// src << text ("Switching Law [L]'s report status to []", src.lawcheck[L+1])
src.checklaws()
if (href_list["laws"]) // With how my law selection code works, I changed statelaws from a verb to a proc, and call it through my law selection panel. --NeoFite
src.statelaws()
return
/mob/living/silicon/ai/meteorhit(obj/O as obj)
@@ -262,29 +275,73 @@
// src.network = "AI Satellite"
src << "\blue Switched to [src.network] camera network."
/mob/living/silicon/ai/verb/statelaws() // -- TLE
set category = "AI Commands"
set name = "State Laws"
/mob/living/silicon/ai/proc/statelaws() // -- TLE
// set category = "AI Commands"
// set name = "State Laws"
src.say("Current Active Laws:")
//src.laws_sanity_check()
//src.laws_object.show_laws(world)
var/number = 1
sleep(10)
if (src.laws_object.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_object.zeroth]")
sleep(10)
for (var/index = 1, index <= src.laws_object.inherent.len, index++)
var/law = src.laws_object.inherent[index]
if (length(law) > 0)
src.say("[number]. [law]")
if (src.lawcheck[index+1] == "Yes")
src.say("[number]. [law]")
sleep(10)
number++
for (var/index = 1, index <= src.laws_object.supplied.len, index++)
var/law = src.laws_object.supplied[index]
if (length(law) > 0)
if (src.lawcheck[number+1] == "Yes")
src.say("[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"
var/list = "<b>Which laws do you want to include when stating them for the crew?</b><br><br>"
if (src.laws_object.zeroth)
if (!src.lawcheck[1])
src.lawcheck[1] = "No" //Given Law 0's usual nature, it defaults to NOT getting reported. --NeoFite
list += {"<A href='byond://?src=\ref[src];lawc=0'>[src.lawcheck[1]] 0:</A> [src.laws_object.zeroth]<BR>"}
var/number = 1
for (var/index = 1, index <= src.laws_object.inherent.len, index++)
var/law = src.laws_object.inherent[index]
if (length(law) > 0)
src.lawcheck.len += 1
if (!src.lawcheck[number+1])
src.lawcheck[number+1] = "Yes"
list += {"<A href='byond://?src=\ref[src];lawc=[number]'>[src.lawcheck[number+1]] [number]:</A> [law]<BR>"}
number++
sleep(10)
for (var/index = 1, index <= src.laws_object.supplied.len, index++)
var/law = src.laws_object.supplied[index]
if (length(law) > 0)
src.say("[number]. [law]")
src.lawcheck.len += 1
if (!src.lawcheck[number+1])
src.lawcheck[number+1] = "Yes"
list += {"<A href='byond://?src=\ref[src];lawc=[number]'>[src.lawcheck[number+1]] [number]:</A> [law]<BR>"}
number++
sleep(10)
list += {"<br><br><A href='byond://?src=\ref[src];laws=1'>State Laws</A>"}
usr << browse(list, "window=laws")
/mob/living/silicon/ai/proc/choose_modules()
set category = "AI Commands"