Changes roundstart AI law behavior.

This commit is contained in:
Miauw
2013-12-19 17:12:05 +01:00
parent e33a9fe346
commit 8b09e95aaf
9 changed files with 60 additions and 15 deletions
+3
View File
@@ -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.
+40 -7
View File
@@ -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 */
+1 -1
View File
@@ -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"
+2 -1
View File
@@ -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.")
+1 -1
View File
@@ -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
+1 -1
View File
@@ -11,7 +11,7 @@
who = world
else
who = src
who << "<b>Obey these laws:</b>"
who << "<b>Obey these laws:</b>"
src.laws_sanity_check()
src.laws.show_laws(who)
+10 -2
View File
@@ -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()
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()
@@ -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
+1 -1
View File
@@ -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