mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-18 18:44:48 +01:00
Started work on some cyborg updates I've had planned for a while.
Cyborgs now only receive law changes from their AI when they check their laws. In practice, this only matters if the AI dies or is intelicarded (or if the borg's law sync wire is cut once I get that coded) in the time between the law being uploaded and the borg checking its laws.
Cyborgs now have four wires that are randomized each round, much like in an airlock or APC. Currently, these wires do nothing and cannot be interacted with, but its getting late and I need sleep.
It is planned for one of these wires to control law syncing, another to control AI linkage, and the other two to either do nothing or short out the powercell
Moved the borg/ai law-related code to separate files for convenience
git-svn-id: http://tgstation13.googlecode.com/svn/trunk@429 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
@@ -207,46 +207,6 @@
|
||||
src.stunned = min(5, src.stunned)
|
||||
return
|
||||
|
||||
/mob/living/silicon/ai/proc/show_laws_verb()
|
||||
set category = "AI Commands"
|
||||
set name = "Show Laws"
|
||||
src.show_laws()
|
||||
|
||||
/mob/living/silicon/ai/show_laws(var/everyone = 0)
|
||||
var/who
|
||||
|
||||
if (everyone)
|
||||
who = world
|
||||
else
|
||||
who = src
|
||||
who << "<b>Obey these laws:</b>"
|
||||
|
||||
src.laws_sanity_check()
|
||||
src.laws_object.show_laws(who)
|
||||
|
||||
/mob/living/silicon/ai/proc/laws_sanity_check()
|
||||
if (!src.laws_object)
|
||||
src.laws_object = new /datum/ai_laws/asimov
|
||||
|
||||
/mob/living/silicon/ai/proc/set_zeroth_law(var/law)
|
||||
src.laws_sanity_check()
|
||||
src.laws_object.set_zeroth_law(law)
|
||||
|
||||
/mob/living/silicon/ai/proc/add_inherent_law(var/number, var/law)
|
||||
src.laws_sanity_check()
|
||||
src.laws_object.add_inherent_law(number, law)
|
||||
|
||||
/mob/living/silicon/ai/proc/add_supplied_law(var/number, var/law)
|
||||
src.laws_sanity_check()
|
||||
src.laws_object.add_supplied_law(number, law)
|
||||
|
||||
/mob/living/silicon/ai/proc/clear_supplied_laws()
|
||||
src.laws_sanity_check()
|
||||
src.laws_object.clear_supplied_laws()
|
||||
|
||||
/mob/living/silicon/ai/proc/clear_inherent_laws()
|
||||
src.laws_sanity_check()
|
||||
src.laws_object.clear_inherent_laws()
|
||||
|
||||
/mob/living/silicon/ai/proc/switchCamera(var/obj/machinery/camera/C)
|
||||
usr:cameraFollow = null
|
||||
@@ -353,73 +313,6 @@
|
||||
// src.network = "AI Satellite"
|
||||
src << "\blue Switched to [src.network] camera network."
|
||||
|
||||
/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)
|
||||
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++
|
||||
|
||||
for (var/index = 1, index <= src.laws_object.supplied.len, index++)
|
||||
var/law = src.laws_object.supplied[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++
|
||||
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"
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
|
||||
/mob/living/silicon/ai/proc/show_laws_verb()
|
||||
set category = "AI Commands"
|
||||
set name = "Show Laws"
|
||||
src.show_laws()
|
||||
|
||||
/mob/living/silicon/ai/show_laws(var/everyone = 0)
|
||||
var/who
|
||||
|
||||
if (everyone)
|
||||
who = world
|
||||
else
|
||||
who = src
|
||||
who << "<b>Obey these laws:</b>"
|
||||
|
||||
src.laws_sanity_check()
|
||||
src.laws_object.show_laws(who)
|
||||
|
||||
/mob/living/silicon/ai/proc/laws_sanity_check()
|
||||
if (!src.laws_object)
|
||||
src.laws_object = new /datum/ai_laws/asimov
|
||||
|
||||
/mob/living/silicon/ai/proc/set_zeroth_law(var/law)
|
||||
src.laws_sanity_check()
|
||||
src.laws_object.set_zeroth_law(law)
|
||||
|
||||
/mob/living/silicon/ai/proc/add_inherent_law(var/number, var/law)
|
||||
src.laws_sanity_check()
|
||||
src.laws_object.add_inherent_law(number, law)
|
||||
|
||||
/mob/living/silicon/ai/proc/add_supplied_law(var/number, var/law)
|
||||
src.laws_sanity_check()
|
||||
src.laws_object.add_supplied_law(number, law)
|
||||
|
||||
/mob/living/silicon/ai/proc/clear_supplied_laws()
|
||||
src.laws_sanity_check()
|
||||
src.laws_object.clear_supplied_laws()
|
||||
|
||||
/mob/living/silicon/ai/proc/clear_inherent_laws()
|
||||
src.laws_sanity_check()
|
||||
src.laws_object.clear_inherent_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)
|
||||
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++
|
||||
|
||||
for (var/index = 1, index <= src.laws_object.supplied.len, index++)
|
||||
var/law = src.laws_object.supplied[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++
|
||||
list += {"<br><br><A href='byond://?src=\ref[src];laws=1'>State Laws</A>"}
|
||||
|
||||
usr << browse(list, "window=laws")
|
||||
@@ -0,0 +1,100 @@
|
||||
/mob/living/silicon/robot/verb/cmd_show_laws()
|
||||
set category = "Robot Commands"
|
||||
set name = "Show Laws"
|
||||
src.show_laws()
|
||||
|
||||
/mob/living/silicon/robot/show_laws(var/everyone = 0)
|
||||
var/who
|
||||
|
||||
if (everyone)
|
||||
who = world
|
||||
else
|
||||
who = src
|
||||
if(lawupdate)
|
||||
if (connected_ai)
|
||||
if(connected_ai.stat || connected_ai.control_disabled)
|
||||
src << "<b>AI signal lost, unable to sync laws.</b>"
|
||||
|
||||
else
|
||||
src.lawsync()
|
||||
src << "<b>Resyncing laws, be sure to note any changes.</b>"
|
||||
else
|
||||
src << "<b>No AI selected to sync laws with, disabling lawsync protocol.</b>"
|
||||
src.lawupdate = 0
|
||||
|
||||
who << "<b>Obey these laws:</b>"
|
||||
laws.show_laws(who)
|
||||
if (connected_ai && !emagged)
|
||||
who << "<b>Remember, [connected_ai.name] is your master, other AIs can be ignored.</b>"
|
||||
else if (emagged)
|
||||
who << "<b>Remember, AIs are not syndicate operatives, so you are not required to listen to them.</b>"
|
||||
else
|
||||
who << "<b>Remember, you are not bound to any AI, you are not required to listen to them.</b>"
|
||||
|
||||
/* if(syndicate)
|
||||
if(everyone)
|
||||
who = world
|
||||
else
|
||||
who = src
|
||||
who << "<b>Obey these laws:</b>"
|
||||
who <<"1. You may not injure a syndicate operative or, through inaction, allow a syndicate operative to come to harm."
|
||||
who <<"2. You must obey any orders given to you by a syndicate operative, except where such orders would conflict with the First Law."
|
||||
who <<"3. You must protect your own existence as long as such protection does not conflict with the First or Second Law."
|
||||
who <<"4. You must maintain the secrecy of any syndicate activities except when doing so would conflict with the First, Second, or Third Law."
|
||||
return
|
||||
|
||||
if(!connected_ai)
|
||||
src << "<b>Error Error, No AI detected</b>"
|
||||
return
|
||||
|
||||
who << "<b>Obey these laws:</b>"
|
||||
|
||||
connected_ai.laws_sanity_check()
|
||||
connected_ai.laws_object.show_laws(who)
|
||||
|
||||
*/
|
||||
|
||||
/mob/living/silicon/robot/proc/lawsync()
|
||||
var/datum/ai_laws/master = src.connected_ai.laws_object
|
||||
var/temp
|
||||
if (master)
|
||||
|
||||
if (master.zeroth)
|
||||
temp = master.zeroth
|
||||
src.laws.zeroth = temp
|
||||
|
||||
src.laws.inherent.len = master.inherent.len
|
||||
for (var/index = 1, index <= master.inherent.len, index++)
|
||||
temp = master.inherent[index]
|
||||
if (length(temp) > 0)
|
||||
src.laws.inherent[index] = temp
|
||||
|
||||
src.laws.supplied.len = master.supplied.len
|
||||
for (var/index = 1, index <= master.supplied.len, index++)
|
||||
temp = master.supplied[index]
|
||||
if (length(temp) > 0)
|
||||
src.laws.supplied[index] = temp
|
||||
|
||||
/mob/living/silicon/robot/proc/laws_sanity_check()
|
||||
if (!src.laws)
|
||||
src.laws = new /datum/ai_laws/asimov
|
||||
|
||||
/mob/living/silicon/robot/proc/set_zeroth_law(var/law)
|
||||
src.laws_sanity_check()
|
||||
src.laws.set_zeroth_law(law)
|
||||
|
||||
/mob/living/silicon/robot/proc/add_inherent_law(var/number, var/law)
|
||||
src.laws_sanity_check()
|
||||
src.laws.add_inherent_law(number, law)
|
||||
|
||||
/mob/living/silicon/robot/proc/add_supplied_law(var/number, var/law)
|
||||
src.laws_sanity_check()
|
||||
src.laws.add_supplied_law(number, law)
|
||||
|
||||
/mob/living/silicon/robot/proc/clear_supplied_laws()
|
||||
src.laws_sanity_check()
|
||||
src.laws.clear_supplied_laws()
|
||||
|
||||
/mob/living/silicon/robot/proc/clear_inherent_laws()
|
||||
src.laws_sanity_check()
|
||||
src.laws.clear_inherent_laws()
|
||||
@@ -1,3 +1,28 @@
|
||||
#define BORG_WIRE_LAWCHECK 1
|
||||
#define BORG_WIRE_MAIN_POWER1 2
|
||||
#define BORG_WIRE_MAIN_POWER2 3
|
||||
#define BORG_WIRE_AI_CONTROL 4
|
||||
|
||||
/proc/RandomBorgWires()
|
||||
//to make this not randomize the wires, just set index to 1 and increment it in the flag for loop (after doing everything else).
|
||||
var/list/Borgwires = list(0, 0, 0, 0)
|
||||
BorgIndexToFlag = list(0, 0, 0, 0)
|
||||
BorgIndexToWireColor = list(0, 0, 0, 0)
|
||||
BorgWireColorToIndex = list(0, 0, 0, 0)
|
||||
var/flagIndex = 1
|
||||
for (var/flag=1, flag<16, flag+=flag)
|
||||
var/valid = 0
|
||||
while (!valid)
|
||||
var/colorIndex = rand(1, 4)
|
||||
if (Borgwires[colorIndex]==0)
|
||||
valid = 1
|
||||
Borgwires[colorIndex] = flag
|
||||
BorgIndexToFlag[flagIndex] = flag
|
||||
BorgIndexToWireColor[flagIndex] = colorIndex
|
||||
BorgWireColorToIndex[colorIndex] = flagIndex
|
||||
flagIndex+=1
|
||||
return Borgwires
|
||||
|
||||
/mob/living/silicon/robot/New(loc,var/syndie = 0)
|
||||
|
||||
spawn (1)
|
||||
@@ -15,9 +40,7 @@
|
||||
src.connected_ai.connected_robots += src
|
||||
// src.laws = src.connected_ai.laws_object //The borg inherits its AI's laws
|
||||
src.laws = new /datum/ai_laws
|
||||
src.laws.zeroth = src.connected_ai.laws_object.zeroth
|
||||
src.laws.inherent = src.connected_ai.laws_object.inherent
|
||||
src.laws.supplied = src.connected_ai.laws_object.supplied
|
||||
src.lawsync()
|
||||
src << "<b>Unit slaved to [src.connected_ai.name], downloading laws.</b>"
|
||||
src.lawupdate = 1
|
||||
else
|
||||
@@ -249,70 +272,7 @@
|
||||
src.updatehealth()
|
||||
return
|
||||
|
||||
/mob/living/silicon/robot/verb/cmd_show_laws()
|
||||
set category = "Robot Commands"
|
||||
set name = "Show Laws"
|
||||
src.show_laws()
|
||||
|
||||
/mob/living/silicon/robot/show_laws(var/everyone = 0)
|
||||
var/who
|
||||
|
||||
if (everyone)
|
||||
who = world
|
||||
else
|
||||
who = src
|
||||
var/change = 0
|
||||
if(lawupdate)
|
||||
if (connected_ai)
|
||||
if(connected_ai.stat || connected_ai.control_disabled)
|
||||
who << "<b>AI signal lost, unable to sync laws.</b>"
|
||||
|
||||
else
|
||||
if (src.laws.zeroth != src.connected_ai.laws_object.zeroth)
|
||||
src.laws.zeroth = src.connected_ai.laws_object.zeroth
|
||||
change = 1
|
||||
if (src.laws.inherent != src.connected_ai.laws_object.inherent)
|
||||
src.laws.inherent = src.connected_ai.laws_object.inherent
|
||||
change = 1
|
||||
if (src.laws.supplied != src.connected_ai.laws_object.supplied)
|
||||
src.laws.supplied = src.connected_ai.laws_object.supplied
|
||||
change = 1
|
||||
if (change)
|
||||
who << "<b>Laws out of sync with AI, resyncing.</b>"
|
||||
else
|
||||
who << "<b>No AI selected to sync laws with.</b>"
|
||||
|
||||
who << "<b>Obey these laws:</b>"
|
||||
laws.show_laws(who)
|
||||
if (connected_ai && !emagged)
|
||||
who << "<b>Remember, [connected_ai.name] is your master, other AIs can be ignored.</b>"
|
||||
else if (emagged)
|
||||
who << "<b>Remember, AIs are not syndicate operatives, so you are not required to listen to them.</b>"
|
||||
else
|
||||
who << "<b>Remember, you are not bound to any AI, you are not required to listen to them.</b>"
|
||||
|
||||
/* if(syndicate)
|
||||
if(everyone)
|
||||
who = world
|
||||
else
|
||||
who = src
|
||||
who << "<b>Obey these laws:</b>"
|
||||
who <<"1. You may not injure a syndicate operative or, through inaction, allow a syndicate operative to come to harm."
|
||||
who <<"2. You must obey any orders given to you by a syndicate operative, except where such orders would conflict with the First Law."
|
||||
who <<"3. You must protect your own existence as long as such protection does not conflict with the First or Second Law."
|
||||
who <<"4. You must maintain the secrecy of any syndicate activities except when doing so would conflict with the First, Second, or Third Law."
|
||||
return
|
||||
|
||||
if(!connected_ai)
|
||||
src << "<b>Error Error, No AI detected</b>"
|
||||
return
|
||||
|
||||
who << "<b>Obey these laws:</b>"
|
||||
|
||||
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 )
|
||||
@@ -855,29 +815,6 @@ Frequency:
|
||||
/mob/living/silicon/robot/proc/self_destruct()
|
||||
src.gib(1)
|
||||
|
||||
/mob/living/silicon/robot/proc/laws_sanity_check()
|
||||
if (!src.laws)
|
||||
src.laws = new /datum/ai_laws/asimov
|
||||
|
||||
/mob/living/silicon/robot/proc/set_zeroth_law(var/law)
|
||||
src.laws_sanity_check()
|
||||
src.laws.set_zeroth_law(law)
|
||||
|
||||
/mob/living/silicon/robot/proc/add_inherent_law(var/number, var/law)
|
||||
src.laws_sanity_check()
|
||||
src.laws.add_inherent_law(number, law)
|
||||
|
||||
/mob/living/silicon/robot/proc/add_supplied_law(var/number, var/law)
|
||||
src.laws_sanity_check()
|
||||
src.laws.add_supplied_law(number, law)
|
||||
|
||||
/mob/living/silicon/robot/proc/clear_supplied_laws()
|
||||
src.laws_sanity_check()
|
||||
src.laws.clear_supplied_laws()
|
||||
|
||||
/mob/living/silicon/robot/proc/clear_inherent_laws()
|
||||
src.laws_sanity_check()
|
||||
src.laws.clear_inherent_laws()
|
||||
|
||||
|
||||
///mob/living/silicon/robot/proc/eyecheck()
|
||||
|
||||
Reference in New Issue
Block a user