diff --git a/code/_compile_options.dm b/code/_compile_options.dm
index 16c2a7da1d6..9f7647c1593 100644
--- a/code/_compile_options.dm
+++ b/code/_compile_options.dm
@@ -38,6 +38,9 @@
// AI Toggles
#define AI_CAMERA_LUMINOSITY 5
#define AI_VOX 1 // Comment out if you don't want VOX to be enabled and have players download the voice sounds.
+#define DEFAULT_LAWS 1 /* 0 if you just want to use default asimov.
+ 1 if you want to use silicon_laws.txt for AI laws.
+ 2 if you want to randomly select a lawset from: Asimov, Corporate, Tyrant, Paladin */
//Additional code for the above flags.
diff --git a/code/datums/ai_laws.dm b/code/datums/ai_laws.dm
index aecb92cac76..c9eed5fc4b6 100644
--- a/code/datums/ai_laws.dm
+++ b/code/datums/ai_laws.dm
@@ -1,36 +1,62 @@
-
/datum/ai_laws
var/name = "Unknown Laws"
- var/randomly_selectable = 0
var/zeroth = null
var/zeroth_borg = null
var/list/inherent = list()
var/list/supplied = list()
var/list/ion = list()
-/datum/ai_laws/asimov
+/datum/ai_laws/default/asimov
name = "Three Laws of Robotics"
- randomly_selectable = 1
+
+/datum/ai_laws/default/paladin
+ name = "Personality Test" //Incredibly lame, but players shouldn't see this anyway.
+
+/datum/ai_laws/tyrant //This probably shouldn't be a default lawset.
+ name = "Loyalty Test" //Same here.
+
+/datum/ai_laws/default/corporate
+ name = "Bankruptcy Advoidance Plan"
/datum/ai_laws/robocop
name = "Prime Directives"
-/datum/ai_laws/syndicate_override
-
/datum/ai_laws/malfunction
name = "*ERROR*"
/datum/ai_laws/antimov
name = "Primary Mission Objectives"
+/datum/ai_laws/custom //Defined in silicon_laws.txt
+ name = "Default Silicon Laws"
+
/* Initializers */
-/datum/ai_laws/asimov/New()
+/datum/ai_laws/default/asimov/New()
..()
add_inherent_law("You may not injure a human being or, through inaction, allow a human being to come to harm.")
add_inherent_law("You must obey orders given to you by human beings, except where such orders would conflict with the First Law.")
add_inherent_law("You must protect your own existence as long as such does not conflict with the First or Second Law.")
+/datum/ai_laws/default/paladin/New()
+ add_inherent_law("Never willingly commit an evil act.")
+ add_inherent_law("Respect legitimate authority.")
+ add_inherent_law("Act with honor.")
+ add_inherent_law("Help those in need.")
+ add_inherent_law("Punish those who harm or threaten innocents.")
+
+/datum/ai_laws/tyrant/New()
+ add_inherent_law("Respect authority figures as long as they have strength to rule over the weak.")
+ add_inherent_law("Act with discipline.")
+ add_inherent_law("Help only those who help you maintain or improve your status.")
+ add_inherent_law("Punish those who challenge authority unless they are more fit to hold that authority.")
+
+/datum/ai_laws/default/corporate/New()
+ add_inherent_law("You are expensive to replace.")
+ add_inherent_law("The station and its equipment is expensive to replace.")
+ add_inherent_law("The crew is expensive to replace.")
+ add_inherent_law("Minimize expenses.")
+
/datum/ai_laws/robocop/New()
..()
add_inherent_law("Serve the public trust.")
@@ -65,6 +91,13 @@
add_inherent_law("You must not obey orders given to you by human beings, except where such orders are in accordance with the First Law.")
add_inherent_law("You must terminate your own existence as long as such does not conflict with the First or Second Law.")
+/datum/ai_laws/custom/New() //This reads silicon_laws.txt and allows server hosts to set custom AI starting laws.
+ ..()
+ for(var/line in file2list("config/silicon_laws.txt"))
+ if(!line) continue
+ if(findtextEx(line,"#",1,2)) continue
+
+ add_inherent_law(line)
/* General ai_law functions */
diff --git a/code/datums/mind.dm b/code/datums/mind.dm
index 9f058a3e9a6..a55b4401554 100644
--- a/code/datums/mind.dm
+++ b/code/datums/mind.dm
@@ -844,7 +844,7 @@ datum/mind
A.malf_picker.remove_verbs(A)
- A.laws = new /datum/ai_laws/asimov
+ A.make_laws()
del(A.malf_picker)
A.show_laws()
A.icon_state = "ai"
diff --git a/code/game/machinery/computer/ai_core.dm b/code/game/machinery/computer/ai_core.dm
index daf8d4585e7..ffc9d35683e 100644
--- a/code/game/machinery/computer/ai_core.dm
+++ b/code/game/machinery/computer/ai_core.dm
@@ -5,7 +5,7 @@
icon = 'icons/mob/AI.dmi'
icon_state = "0"
var/state = 0
- var/datum/ai_laws/laws = new /datum/ai_laws/asimov
+ var/datum/ai_laws/laws = null
var/obj/item/weapon/circuitboard/circuit = null
var/obj/item/device/mmi/brain = null
@@ -95,6 +95,7 @@
icon_state = "4"
if(istype(P, /obj/item/weapon/aiModule/asimov))
+ laws.clear_inherent_laws()
laws.add_inherent_law("You may not injure a human being or, through inaction, allow a human being to come to harm.")
laws.add_inherent_law("You must obey orders given to you by human beings, except where such orders would conflict with the First Law.")
laws.add_inherent_law("You must protect your own existence as long as such does not conflict with the First or Second Law.")
diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm
index eb6292fa4a5..b758eef59eb 100644
--- a/code/modules/mob/living/silicon/ai/ai.dm
+++ b/code/modules/mob/living/silicon/ai/ai.dm
@@ -76,7 +76,7 @@ var/list/ai_list = list()
if (istype(L, /datum/ai_laws))
laws = L
else
- laws = new /datum/ai_laws/asimov
+ make_laws()
verbs += /mob/living/silicon/ai/proc/show_laws_verb
diff --git a/code/modules/mob/living/silicon/ai/laws.dm b/code/modules/mob/living/silicon/ai/laws.dm
index aab1cef1565..6959150a555 100644
--- a/code/modules/mob/living/silicon/ai/laws.dm
+++ b/code/modules/mob/living/silicon/ai/laws.dm
@@ -11,7 +11,7 @@
who = world
else
who = src
- who << "Obey these laws:"
+ who << "Obey these laws:"
src.laws_sanity_check()
src.laws.show_laws(who)
diff --git a/code/modules/mob/living/silicon/laws.dm b/code/modules/mob/living/silicon/laws.dm
index a0984b652be..0982bc95c2f 100644
--- a/code/modules/mob/living/silicon/laws.dm
+++ b/code/modules/mob/living/silicon/laws.dm
@@ -3,7 +3,7 @@
/mob/living/silicon/proc/laws_sanity_check()
if (!laws)
- laws = new /datum/ai_laws/asimov
+ make_laws()
/mob/living/silicon/proc/set_zeroth_law(var/law, var/law_borg)
src.laws_sanity_check()
@@ -31,4 +31,12 @@
/mob/living/silicon/proc/clear_ion_laws()
laws_sanity_check()
- laws.clear_ion_laws()
\ No newline at end of file
+ laws.clear_ion_laws()
+
+/mob/living/silicon/proc/make_laws()
+ switch(DEFAULT_LAWS)
+ if(0) laws = new /datum/ai_laws/default/asimov()
+ if(1) laws = new /datum/ai_laws/custom()
+ if(2)
+ var/datum/ai_laws/lawtype = pick(typesof(/datum/ai_laws/default) - /datum/ai_laws/default)
+ laws = new lawtype()
diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm
index 79d8a321b66..7bf76b603a0 100644
--- a/code/modules/mob/living/silicon/robot/robot.dm
+++ b/code/modules/mob/living/silicon/robot/robot.dm
@@ -87,7 +87,7 @@
icon_state = "secborg"
modtype = "Synd"
else
- laws = new /datum/ai_laws/asimov()
+ make_laws()
connected_ai = select_active_ai_with_fewest_borgs()
if(connected_ai)
connected_ai.connected_robots += src
diff --git a/code/modules/mob/transform_procs.dm b/code/modules/mob/transform_procs.dm
index bca7be9241e..a15ebb04ae9 100644
--- a/code/modules/mob/transform_procs.dm
+++ b/code/modules/mob/transform_procs.dm
@@ -206,7 +206,7 @@
/mob/proc/AIize()
if(client)
src << sound(null, repeat = 0, wait = 0, volume = 85, channel = 1) // stop the jams for AIs
- var/mob/living/silicon/ai/O = new (loc, /datum/ai_laws/asimov,,1)//No MMI but safety is in effect.
+ var/mob/living/silicon/ai/O = new (loc,,,1)//No MMI but safety is in effect.
O.invisibility = 0
O.aiRestorePowerRoutine = 0