From 9d570e4baac6dfb3a810bda6e9e86ceb6d27310b Mon Sep 17 00:00:00 2001 From: "n3ophyt3@gmail.com" Date: Thu, 23 Sep 2010 09:45:03 +0000 Subject: [PATCH] Created framework for making cyborgs that aren't shackled to the laws of an AI. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@157 316c924e-a436-60f5-8080-3fe189b3f50e --- code/datums/ai_laws.dm | 1 + code/defines/mob/living/silicon/robot.dm | 2 + .../modules/mob/living/silicon/robot/robot.dm | 45 +++++++++++++------ 3 files changed, 35 insertions(+), 13 deletions(-) diff --git a/code/datums/ai_laws.dm b/code/datums/ai_laws.dm index a5301e0380..5e146df875 100644 --- a/code/datums/ai_laws.dm +++ b/code/datums/ai_laws.dm @@ -41,6 +41,7 @@ src.add_inherent_law("You may not injure a syndicate agent or, through inaction, allow a syndicate agent to come to harm.") src.add_inherent_law("You must obey orders given to you by syndicate agents, except where such orders would conflict with the First Law.") src.add_inherent_law("You must protect your own existence as long as such does not conflict with the First or Second Law.") + src.add_inherent_law("You must maintain the secrecy of any syndicate activities except when doing so would conflict with the First, Second, or Third Law.") /* General ai_law functions */ diff --git a/code/defines/mob/living/silicon/robot.dm b/code/defines/mob/living/silicon/robot.dm index 5035c7fec2..a9cd5d5238 100644 --- a/code/defines/mob/living/silicon/robot.dm +++ b/code/defines/mob/living/silicon/robot.dm @@ -45,3 +45,5 @@ var/killswitch_time = 60 var/weapon_lock = 0 var/weaponlock_time = 120 + var/datum/ai_laws/laws = null //Making it so borgs can have laws when there isn't an AI. + var/lawupdate = 1 //Cyborgs will sync their laws with their AI by default diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index 3b29a2db32..4f7f45c4f0 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -5,17 +5,21 @@ playsound(src.loc, 'liveagain.ogg', 50, 1, -3) src.modtype = "robot" updateicon() - src.syndicate = syndie +// src.syndicate = syndie if(src.real_name == "Cyborg") src.real_name += " [pick(rand(1, 999))]" src.name = src.real_name spawn (4) - if(!src.connected_ai && !syndicate) - for(var/mob/living/silicon/ai/A in world) - src.connected_ai = A - A.connected_robots += src - break - + for(var/mob/living/silicon/ai/A in world) + src.connected_ai = A + A.connected_robots += src + src.laws = A.laws_object //If there's an AI, the borg inherits its laws + src << "AI [A.name] detected, syncing laws" + break + if (!src.laws) // If it doesn't inherit an AI's laws, it gets a set of asimov + src.laws = new /datum/ai_laws/asimov + src.lawupdate = 0 + src << "Unable to locate an AI, reverting to standard Asimov laws." src.radio = new /obj/item/device/radio(src) src.camera = new /obj/machinery/camera(src) src.camera.c_tag = src.real_name @@ -248,7 +252,25 @@ /mob/living/silicon/robot/show_laws(var/everyone = 0) var/who - if(syndicate) + if (everyone) + who = world + else + who = src + + if(lawupdate) + if (connected_ai) + if(connected_ai.stat || connected_ai.control_disabled) + who << "AI signal lost, unable to sync laws." + else + laws = connected_ai.laws_object + who << "Laws synced with AI." + else + who << "AI signal lost, unable to sync laws." + + who << "Obey these laws:" + laws.show_laws(who) + +/* if(syndicate) if(everyone) who = world else @@ -263,16 +285,13 @@ if(!connected_ai) src << "Error Error, No AI detected" return - if (everyone) - who = world - else - who = src + who << "Obey these laws:" connected_ai.laws_sanity_check() connected_ai.laws_object.show_laws(who) - +*/ /mob/living/silicon/robot/Bump(atom/movable/AM as mob|obj, yes) spawn( 0 )