mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-23 12:07:27 +01:00
Port Bay's silicon law manager
This commit is contained in:
@@ -41,6 +41,8 @@ var/list/admin_verbs_admin = list(
|
||||
/client/proc/admin_cancel_shuttle, /*allows us to cancel the emergency shuttle, sending it back to centcomm*/
|
||||
/client/proc/check_words, /*displays cult-words*/
|
||||
/client/proc/check_ai_laws, /*shows AI and borg laws*/
|
||||
/client/proc/rename_silicon, /*properly renames silicons*/
|
||||
/client/proc/manage_silicon_laws, /* Allows viewing and editing silicon laws. */
|
||||
/client/proc/admin_memo, /*admin memo system. show/delete/write. +SERVER needed to delete admin memos of others*/
|
||||
/client/proc/dsay, /*talk in deadchat using our ckey/fakekey*/
|
||||
/client/proc/toggleprayers, /*toggles prayers on/off*/
|
||||
@@ -659,10 +661,42 @@ var/list/admin_verbs_mentor = list(
|
||||
/client/proc/check_ai_laws()
|
||||
set name = "Check AI Laws"
|
||||
set category = "Admin"
|
||||
|
||||
if(!check_rights(R_ADMIN)) return
|
||||
|
||||
if(holder)
|
||||
src.holder.output_ai_laws()
|
||||
|
||||
/client/proc/change_human_appearance_admin(mob/living/carbon/human/H in world)
|
||||
/client/proc/rename_silicon()
|
||||
set name = "Rename Silicon"
|
||||
set category = "Admin"
|
||||
|
||||
if(!check_rights(R_ADMIN)) return
|
||||
|
||||
var/mob/living/silicon/S = input("Select silicon.", "Rename Silicon.") as null|anything in silicon_mob_list
|
||||
if(!S) return
|
||||
|
||||
var/new_name = sanitizeSafe(input(src, "Enter new name. Leave blank or as is to cancel.", "[S.real_name] - Enter new silicon name", S.real_name))
|
||||
if(new_name && new_name != S.real_name)
|
||||
log_and_message_admins("has renamed the silicon '[S.real_name]' to '[new_name]'")
|
||||
S.SetName(new_name)
|
||||
feedback_add_details("admin_verb","RAI") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
|
||||
/client/proc/manage_silicon_laws()
|
||||
set name = "Manage Silicon Laws"
|
||||
set category = "Admin"
|
||||
|
||||
if(!check_rights(R_ADMIN)) return
|
||||
|
||||
var/mob/living/silicon/S = input("Select silicon.", "Manage Silicon Laws") as null|anything in silicon_mob_list
|
||||
if(!S) return
|
||||
|
||||
var/datum/nano_module/law_manager/L = new(S)
|
||||
L.ui_interact(usr, state = admin_state)
|
||||
log_and_message_admins("has opened [S]'s law manager.")
|
||||
feedback_add_details("admin_verb","MSL") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
|
||||
/client/proc/change_human_appearance_admin(mob/living/carbon/human/H in mob_list)
|
||||
set name = "C.M.A. - Admin"
|
||||
set desc = "Allows you to change the mob appearance"
|
||||
set category = "Admin"
|
||||
@@ -675,7 +709,7 @@ var/list/admin_verbs_mentor = list(
|
||||
H.change_appearance(APPEARANCE_ALL, usr, usr, check_species_whitelist = 0)
|
||||
feedback_add_details("admin_verb","CHAA") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
|
||||
/client/proc/change_human_appearance_self(mob/living/carbon/human/H in world)
|
||||
/client/proc/change_human_appearance_self(mob/living/carbon/human/H in mob_list)
|
||||
set name = "C.M.A. - Self"
|
||||
set desc = "Allows the mob to change its appearance"
|
||||
set category = "Admin"
|
||||
|
||||
@@ -1162,7 +1162,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
|
||||
set name = "Debug Mob Lists"
|
||||
set desc = "For when you just gotta know"
|
||||
|
||||
switch(input("Which list?") in list("Players","Admins","Mobs","Living Mobs","Dead Mobs", "Clients","Respawnable Mobs"))
|
||||
switch(input("Which list?") in list("Players","Admins","Mobs","Living Mobs","Dead Mobs","Silicons","Clients","Respawnable Mobs"))
|
||||
if("Players")
|
||||
usr << list2text(player_list,",")
|
||||
if("Admins")
|
||||
@@ -1173,6 +1173,8 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
|
||||
usr << list2text(living_mob_list,",")
|
||||
if("Dead Mobs")
|
||||
usr << list2text(dead_mob_list,",")
|
||||
if("Silicons")
|
||||
usr << list2text(silicon_mob_list,",")
|
||||
if("Clients")
|
||||
usr << list2text(clients,",")
|
||||
if("Respawnable Mobs")
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
var/now_pushing = null
|
||||
|
||||
var/cameraFollow = null
|
||||
var/atom/movable/cameraFollow = null
|
||||
|
||||
var/tod = null // Time of death
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ var/list/ai_verbs_default = list(
|
||||
/mob/living/silicon/ai/proc/ai_roster,
|
||||
/mob/living/silicon/ai/proc/ai_statuschange,
|
||||
/mob/living/silicon/ai/proc/ai_store_location,
|
||||
/mob/living/silicon/ai/proc/checklaws,
|
||||
/mob/living/silicon/ai/proc/control_integrated_radio,
|
||||
/mob/living/silicon/ai/proc/core,
|
||||
/mob/living/silicon/ai/proc/pick_icon,
|
||||
@@ -51,9 +50,6 @@ var/list/ai_verbs_default = list(
|
||||
//var/list/laws = list()
|
||||
var/alarms = list("Motion"=list(), "Fire"=list(), "Atmosphere"=list(), "Power"=list(), "Camera"=list())
|
||||
var/viewalerts = 0
|
||||
var/lawcheck[1]
|
||||
var/ioncheck[1]
|
||||
var/lawchannel = "Common" // Default channel on which to state laws
|
||||
var/icon/holo_icon//Default is assigned when AI is created.
|
||||
var/obj/mecha/controlled_mech //For controlled_mech a mech, to determine whether to relaymove or use the AI eye.
|
||||
var/obj/item/device/pda/ai/aiPDA = null
|
||||
@@ -210,9 +206,9 @@ var/list/ai_verbs_default = list(
|
||||
|
||||
job = "AI"
|
||||
|
||||
/mob/living/silicon/ai/proc/SetName(pickedName as text)
|
||||
real_name = pickedName
|
||||
name = pickedName
|
||||
/mob/living/silicon/ai/SetName(pickedName as text)
|
||||
..()
|
||||
|
||||
if(eyeobj)
|
||||
eyeobj.name = "[pickedName] (AI Eye)"
|
||||
|
||||
@@ -473,32 +469,6 @@ var/list/ai_verbs_default = list(
|
||||
else
|
||||
src << "<span class='notice'>Unable to locate the holopad.</span>"
|
||||
|
||||
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(lawcheck[L+1])
|
||||
if ("Yes") lawcheck[L+1] = "No"
|
||||
if ("No") lawcheck[L+1] = "Yes"
|
||||
// src << text ("Switching Law [L]'s report status to []", lawcheck[L+1])
|
||||
checklaws()
|
||||
|
||||
if (href_list["lawr"]) // Selects on which channel to state laws
|
||||
var/setchannel = input(usr, "Specify channel.", "Channel selection") in list("State","Common","Science","Command","Medical","Engineering","Security","Supply","Binary","Holopad", "Cancel")
|
||||
if(setchannel == "Cancel")
|
||||
return
|
||||
lawchannel = setchannel
|
||||
checklaws()
|
||||
|
||||
if (href_list["lawi"]) // Toggling whether or not a law gets stated by the State Laws verb --NeoFite
|
||||
var/L = text2num(href_list["lawi"])
|
||||
switch(ioncheck[L])
|
||||
if ("Yes") ioncheck[L] = "No"
|
||||
if ("No") ioncheck[L] = "Yes"
|
||||
// src << text ("Switching Law [L]'s report status to []", lawcheck[L+1])
|
||||
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
|
||||
statelaws()
|
||||
|
||||
if(href_list["say_word"])
|
||||
play_vox_word(href_list["say_word"], null, src)
|
||||
return
|
||||
|
||||
@@ -28,4 +28,14 @@
|
||||
msg += "*---------*</span>"
|
||||
|
||||
usr << msg
|
||||
return
|
||||
usr.showLaws(src)
|
||||
|
||||
return
|
||||
|
||||
/mob/proc/showLaws(var/mob/living/silicon/S)
|
||||
return
|
||||
|
||||
/mob/dead/observer/showLaws(var/mob/living/silicon/S)
|
||||
if(antagHUD || check_rights(R_MOD, 0, src))
|
||||
S.laws.show_laws(src)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
/mob/living/silicon/ai/proc/show_laws_verb()
|
||||
set category = "AI Commands"
|
||||
set name = "Show Laws"
|
||||
@@ -16,147 +15,13 @@
|
||||
src.laws_sanity_check()
|
||||
src.laws.show_laws(who)
|
||||
|
||||
/mob/living/silicon/ai/proc/laws_sanity_check()
|
||||
if (!src.laws)
|
||||
make_laws()
|
||||
|
||||
/mob/living/silicon/ai/proc/set_zeroth_law(var/law, var/law_borg, var/law_type)
|
||||
src.laws_sanity_check()
|
||||
src.laws.set_zeroth_law(law, law_borg, law_type)
|
||||
|
||||
/mob/living/silicon/ai/proc/clear_zeroth_law(var/law_borg)
|
||||
src.laws_sanity_check()
|
||||
src.laws.clear_zeroth_law(law_borg)
|
||||
|
||||
/mob/living/silicon/ai/proc/add_inherent_law(var/law)
|
||||
src.laws_sanity_check()
|
||||
src.laws.add_inherent_law(law)
|
||||
|
||||
/mob/living/silicon/ai/proc/clear_inherent_laws()
|
||||
src.laws_sanity_check()
|
||||
src.laws.clear_inherent_laws()
|
||||
|
||||
/mob/living/silicon/ai/proc/add_ion_law(var/law)
|
||||
src.laws_sanity_check()
|
||||
src.laws.add_ion_law(law)
|
||||
/mob/living/silicon/ai/add_ion_law(var/law)
|
||||
..()
|
||||
for(var/mob/living/silicon/robot/R in mob_list)
|
||||
if(R.lawupdate && (R.connected_ai == src))
|
||||
R << "\red " + law + "\red...LAWS UPDATED"
|
||||
R.show_laws()
|
||||
|
||||
/mob/living/silicon/ai/proc/clear_ion_laws()
|
||||
src.laws_sanity_check()
|
||||
src.laws.clear_ion_laws()
|
||||
|
||||
/mob/living/silicon/ai/proc/add_supplied_law(var/number, var/law)
|
||||
src.laws_sanity_check()
|
||||
src.laws.add_supplied_law(number, law)
|
||||
|
||||
/mob/living/silicon/ai/proc/clear_supplied_laws()
|
||||
src.laws_sanity_check()
|
||||
src.laws.clear_supplied_laws()
|
||||
|
||||
/mob/living/silicon/ai/proc/statelaws() // -- TLE
|
||||
// set category = "AI Commands"
|
||||
// set name = "State Laws"
|
||||
/var/prefix = ""
|
||||
switch(lawchannel)
|
||||
if("Common") prefix = ";"
|
||||
if("Science") prefix = ":n "
|
||||
if("Command") prefix = ":c "
|
||||
if("Medical") prefix = ":m "
|
||||
if("Engineering") prefix = ":e "
|
||||
if("Security") prefix = ":s "
|
||||
if("Supply") prefix = ":u "
|
||||
if("Service") prefix = ":z "
|
||||
if("Binary") prefix = ":b "
|
||||
if("Holopad") prefix = ":h "
|
||||
else prefix = ""
|
||||
|
||||
src.say("[prefix]Current Active Laws:")
|
||||
|
||||
//src.laws_sanity_check()
|
||||
//src.laws.show_laws(world)
|
||||
var/number = 1
|
||||
sleep(10)
|
||||
|
||||
if (src.laws.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("[prefix]0. [src.laws.zeroth]")
|
||||
sleep(10)
|
||||
|
||||
for (var/index = 1, index <= src.laws.ion.len, index++)
|
||||
var/law = src.laws.ion[index]
|
||||
var/num = ionnum()
|
||||
if (length(law) > 0)
|
||||
if (src.ioncheck[index] == "Yes")
|
||||
src.say("[prefix][num]. [law]")
|
||||
sleep(10)
|
||||
|
||||
for (var/index = 1, index <= src.laws.inherent.len, index++)
|
||||
var/law = src.laws.inherent[index]
|
||||
|
||||
if (length(law) > 0)
|
||||
if (src.lawcheck[index+1] == "Yes")
|
||||
src.say("[prefix][number]. [law]")
|
||||
sleep(10)
|
||||
number++
|
||||
|
||||
|
||||
for (var/index = 1, index <= src.laws.supplied.len, index++)
|
||||
var/law = src.laws.supplied[index]
|
||||
|
||||
if (length(law) > 0)
|
||||
if(src.lawcheck.len >= number+1)
|
||||
if (src.lawcheck[number+1] == "Yes")
|
||||
src.say("[prefix][number]. [law]")
|
||||
sleep(10)
|
||||
number++
|
||||
|
||||
|
||||
/mob/living/silicon/ai/proc/checklaws() //Gives you a link-driven interface for deciding what laws the statelaws() proc will share with the crew. --NeoFite
|
||||
/mob/living/silicon/ai/proc/ai_checklaws()
|
||||
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.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.zeroth]<BR>"}
|
||||
|
||||
for (var/index = 1, index <= src.laws.ion.len, index++)
|
||||
var/law = src.laws.ion[index]
|
||||
|
||||
if (length(law) > 0)
|
||||
|
||||
|
||||
if (!src.ioncheck[index])
|
||||
src.ioncheck[index] = "Yes"
|
||||
list += {"<A href='byond://?src=\ref[src];lawi=[index]'>[src.ioncheck[index]] [ionnum()]:</A> [law]<BR>"}
|
||||
src.ioncheck.len += 1
|
||||
|
||||
var/number = 1
|
||||
for (var/index = 1, index <= src.laws.inherent.len, index++)
|
||||
var/law = src.laws.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.supplied.len, index++)
|
||||
var/law = src.laws.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><A href='byond://?src=\ref[src];lawr=1'>Channel: [src.lawchannel]</A><br>"}
|
||||
list += {"<A href='byond://?src=\ref[src];laws=1'>State Laws</A>"}
|
||||
|
||||
usr << browse(list, "window=laws")
|
||||
subsystem_law_manager()
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
/mob/living/silicon
|
||||
var/datum/ai_laws/laws = null
|
||||
var/list/additional_law_channels = list("State")
|
||||
|
||||
/mob/living/silicon/proc/laws_sanity_check()
|
||||
if (!src.laws)
|
||||
laws = new base_law_type
|
||||
|
||||
/mob/living/silicon/proc/has_zeroth_law()
|
||||
return laws.zeroth_law != null
|
||||
|
||||
/mob/living/silicon/proc/set_zeroth_law(var/law, var/law_borg)
|
||||
laws_sanity_check()
|
||||
laws.set_zeroth_law(law, law_borg)
|
||||
log_and_message_admins("has given [src] the zeroth laws: [law]/[law_borg ? law_borg : "N/A"]")
|
||||
|
||||
/mob/living/silicon/robot/set_zeroth_law(var/law, var/law_borg)
|
||||
..()
|
||||
if(tracking_entities)
|
||||
src << "<span class='warning'>Internal camera is currently being accessed.</span>"
|
||||
|
||||
/mob/living/silicon/proc/add_ion_law(var/law)
|
||||
laws_sanity_check()
|
||||
laws.add_ion_law(law)
|
||||
log_and_message_admins("has given [src] the ion law: [law]")
|
||||
|
||||
/mob/living/silicon/proc/add_inherent_law(var/law)
|
||||
laws_sanity_check()
|
||||
laws.add_inherent_law(law)
|
||||
log_and_message_admins("has given [src] the inherent law: [law]")
|
||||
|
||||
/mob/living/silicon/proc/add_supplied_law(var/number, var/law)
|
||||
laws_sanity_check()
|
||||
laws.add_supplied_law(number, law)
|
||||
log_and_message_admins("has given [src] the supplied law: [law]")
|
||||
|
||||
/mob/living/silicon/proc/delete_law(var/datum/ai_law/law)
|
||||
laws_sanity_check()
|
||||
laws.delete_law(law)
|
||||
log_and_message_admins("has deleted a law belonging to [src]: [law.law]")
|
||||
|
||||
/mob/living/silicon/proc/clear_inherent_laws(var/silent = 0)
|
||||
laws_sanity_check()
|
||||
laws.clear_inherent_laws()
|
||||
if(!silent)
|
||||
log_and_message_admins("cleared the inherent laws of [src]")
|
||||
|
||||
/mob/living/silicon/proc/clear_ion_laws(var/silent = 0)
|
||||
laws_sanity_check()
|
||||
laws.clear_ion_laws()
|
||||
if(!silent)
|
||||
log_and_message_admins("cleared the ion laws of [src]")
|
||||
|
||||
/mob/living/silicon/proc/clear_supplied_laws(var/silent = 0)
|
||||
laws_sanity_check()
|
||||
laws.clear_supplied_laws()
|
||||
if(!silent)
|
||||
log_and_message_admins("cleared the supplied laws of [src]")
|
||||
|
||||
/mob/living/silicon/proc/statelaws(var/datum/ai_laws/laws)
|
||||
var/prefix = ""
|
||||
switch(lawchannel)
|
||||
if(MAIN_CHANNEL) prefix = ";"
|
||||
if("Binary") prefix = ":b "
|
||||
else
|
||||
prefix = get_radio_key_from_channel(lawchannel == "Holopad" ? "department" : lawchannel) + " "
|
||||
|
||||
dostatelaws(lawchannel, prefix, laws)
|
||||
|
||||
/mob/living/silicon/proc/dostatelaws(var/method, var/prefix, var/datum/ai_laws/laws)
|
||||
if(stating_laws[prefix])
|
||||
src << "<span class='notice'>[method]: Already stating laws using this communication method.</span>"
|
||||
return
|
||||
|
||||
stating_laws[prefix] = 1
|
||||
|
||||
var/can_state = statelaw("[prefix]Current Active Laws:")
|
||||
|
||||
for(var/datum/ai_law/law in laws.laws_to_state())
|
||||
can_state = statelaw("[prefix][law.get_index()]. [law.law]")
|
||||
if(!can_state)
|
||||
break
|
||||
|
||||
if(!can_state)
|
||||
src << "<span class='danger'>[method]: Unable to state laws. Communication method unavailable.</span>"
|
||||
stating_laws[prefix] = 0
|
||||
|
||||
/mob/living/silicon/proc/statelaw(var/law)
|
||||
if(src.say(law))
|
||||
sleep(10)
|
||||
return 1
|
||||
|
||||
return 0
|
||||
|
||||
/mob/living/silicon/proc/law_channels()
|
||||
var/list/channels = new()
|
||||
channels += MAIN_CHANNEL
|
||||
channels += common_radio.channels
|
||||
channels += additional_law_channels
|
||||
return channels
|
||||
|
||||
/mob/living/silicon/proc/lawsync()
|
||||
laws_sanity_check()
|
||||
laws.sort_laws()
|
||||
|
||||
/mob/living/silicon/proc/make_laws()
|
||||
switch(config.default_laws)
|
||||
if(0)
|
||||
laws = new /datum/ai_laws/crewsimov()
|
||||
else
|
||||
laws = get_random_lawset()
|
||||
|
||||
/mob/living/silicon/proc/get_random_lawset()
|
||||
var/list/law_options[0]
|
||||
var/paths = subtypesof(/datum/ai_laws)
|
||||
for(var/law in paths)
|
||||
var/datum/ai_laws/L = new law
|
||||
if(!L.default)
|
||||
continue
|
||||
law_options += L
|
||||
return pick(law_options)
|
||||
@@ -75,6 +75,12 @@
|
||||
aiCamera = new/obj/item/device/camera/siliconcam/drone_camera(src)
|
||||
playsound(src.loc, 'sound/machines/twobeep.ogg', 50, 0)
|
||||
|
||||
//Redefining some robot procs...
|
||||
/mob/living/silicon/robot/drone/SetName(pickedName as text)
|
||||
// Would prefer to call the grandparent proc but this isn't possible, so..
|
||||
real_name = pickedName
|
||||
name = real_name
|
||||
|
||||
//Redefining some robot procs...
|
||||
/mob/living/silicon/robot/drone/updatename()
|
||||
real_name = "maintenance drone ([rand(100,999)])"
|
||||
|
||||
@@ -50,4 +50,5 @@
|
||||
msg += "\nIt is [pose]"
|
||||
|
||||
usr << msg
|
||||
usr.showLaws(src)
|
||||
return
|
||||
@@ -20,6 +20,7 @@
|
||||
lawsync()
|
||||
photosync()
|
||||
src << "<b>Laws synced with AI, be sure to note any changes.</b>"
|
||||
// TODO: Update to new antagonist system.
|
||||
if(mind && mind.special_role == "traitor" && mind.original == src)
|
||||
src << "<b>Remember, your AI does NOT share or know about your law 0."
|
||||
else
|
||||
@@ -28,6 +29,7 @@
|
||||
|
||||
who << "<b>Obey these laws:</b>"
|
||||
laws.show_laws(who)
|
||||
// TODO: Update to new antagonist system.
|
||||
if (mind && (mind.special_role == "traitor" && mind.original == src) && connected_ai)
|
||||
who << "<b>Remember, [connected_ai.name] is technically your master, but your objective comes first.</b>"
|
||||
else if (connected_ai)
|
||||
@@ -38,166 +40,15 @@
|
||||
who << "<b>Remember, you are not bound to any AI, you are not required to listen to them.</b>"
|
||||
|
||||
|
||||
/mob/living/silicon/robot/proc/lawsync()
|
||||
/mob/living/silicon/robot/lawsync()
|
||||
laws_sanity_check()
|
||||
var/datum/ai_laws/master = connected_ai ? connected_ai.laws : null
|
||||
var/temp
|
||||
var/datum/ai_laws/master = connected_ai && lawupdate ? connected_ai.laws : null
|
||||
if (master)
|
||||
laws.ion.len = master.ion.len
|
||||
for (var/index = 1, index <= master.ion.len, index++)
|
||||
temp = master.ion[index]
|
||||
if (length(temp) > 0)
|
||||
laws.ion[index] = temp
|
||||
|
||||
if (!is_special_character(src) || mind.original != src)
|
||||
if(master.zeroth_borg) //If the AI has a defined law zero specifically for its borgs, give it that one, otherwise give it the same one. --NEO
|
||||
temp = master.zeroth_borg
|
||||
else
|
||||
temp = master.zeroth
|
||||
laws.zeroth = temp
|
||||
|
||||
laws.inherent.len = master.inherent.len
|
||||
for (var/index = 1, index <= master.inherent.len, index++)
|
||||
temp = master.inherent[index]
|
||||
if (length(temp) > 0)
|
||||
laws.inherent[index] = temp
|
||||
|
||||
laws.supplied.len = master.supplied.len
|
||||
for (var/index = 1, index <= master.supplied.len, index++)
|
||||
temp = master.supplied[index]
|
||||
if (length(temp) > 0)
|
||||
laws.supplied[index] = temp
|
||||
master.sync(src)
|
||||
..()
|
||||
return
|
||||
|
||||
/mob/living/silicon/robot/proc/laws_sanity_check()
|
||||
if (!laws)
|
||||
make_laws()
|
||||
|
||||
/mob/living/silicon/robot/proc/set_zeroth_law(var/law)
|
||||
laws_sanity_check()
|
||||
laws.set_zeroth_law(law)
|
||||
|
||||
/mob/living/silicon/robot/proc/clear_zeroth_law()
|
||||
laws_sanity_check()
|
||||
laws.clear_zeroth_law()
|
||||
|
||||
/mob/living/silicon/robot/proc/add_inherent_law(var/law)
|
||||
laws_sanity_check()
|
||||
laws.add_inherent_law(law)
|
||||
|
||||
/mob/living/silicon/robot/proc/clear_inherent_laws()
|
||||
laws_sanity_check()
|
||||
laws.clear_inherent_laws()
|
||||
|
||||
/mob/living/silicon/robot/proc/add_supplied_law(var/number, var/law)
|
||||
laws_sanity_check()
|
||||
laws.add_supplied_law(number, law)
|
||||
|
||||
/mob/living/silicon/robot/proc/clear_supplied_laws()
|
||||
laws_sanity_check()
|
||||
laws.clear_supplied_laws()
|
||||
|
||||
/mob/living/silicon/robot/proc/add_ion_law(var/law)
|
||||
laws_sanity_check()
|
||||
laws.add_ion_law(law)
|
||||
|
||||
/mob/living/silicon/robot/proc/clear_ion_laws()
|
||||
laws_sanity_check()
|
||||
laws.clear_ion_laws()
|
||||
|
||||
/mob/living/silicon/proc/make_laws()
|
||||
switch(config.default_laws)
|
||||
if(0) laws = new /datum/ai_laws/asimov()
|
||||
if(1) laws = new /datum/ai_laws/custom()
|
||||
if(2)
|
||||
var/datum/ai_laws/lawtype = pick(subtypesof(/datum/ai_laws/default))
|
||||
laws = new lawtype()
|
||||
|
||||
/mob/living/silicon/robot/proc/statelaws() // -- TLE
|
||||
// set category = "AI Commands"
|
||||
// set name = "State Laws"
|
||||
src.say("Current Active Laws:")
|
||||
//src.laws_sanity_check()
|
||||
//src.laws.show_laws(world)
|
||||
var/number = 1
|
||||
sleep(10)
|
||||
|
||||
if (src.laws.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.zeroth]")
|
||||
sleep(10)
|
||||
|
||||
for (var/index = 1, index <= src.laws.ion.len, index++)
|
||||
var/law = src.laws.ion[index]
|
||||
var/num = ionnum()
|
||||
if (length(law) > 0)
|
||||
if (src.ioncheck[index] == "Yes")
|
||||
src.say("[num]. [law]")
|
||||
sleep(10)
|
||||
|
||||
for (var/index = 1, index <= src.laws.inherent.len, index++)
|
||||
var/law = src.laws.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.supplied.len, index++)
|
||||
var/law = src.laws.supplied[index]
|
||||
|
||||
if (length(law) > 0)
|
||||
if(src.lawcheck.len >= number+1)
|
||||
if (src.lawcheck[number+1] == "Yes")
|
||||
src.say("[number]. [law]")
|
||||
sleep(10)
|
||||
number++
|
||||
|
||||
|
||||
/mob/living/silicon/robot/proc/checklaws() //Gives you a link-driven interface for deciding what laws the statelaws() proc will share with the crew. --NeoFite
|
||||
/mob/living/silicon/robot/proc/robot_checklaws()
|
||||
set category = "Robot 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.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.zeroth]<BR>"}
|
||||
|
||||
for (var/index = 1, index <= src.laws.ion.len, index++)
|
||||
var/law = src.laws.ion[index]
|
||||
|
||||
if (length(law) > 0)
|
||||
|
||||
|
||||
if (!src.ioncheck[index])
|
||||
src.ioncheck[index] = "Yes"
|
||||
list += {"<A href='byond://?src=\ref[src];lawi=[index]'>[src.ioncheck[index]] [ionnum()]:</A> [law]<BR>"}
|
||||
src.ioncheck.len += 1
|
||||
|
||||
var/number = 1
|
||||
for (var/index = 1, index <= src.laws.inherent.len, index++)
|
||||
var/law = src.laws.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.supplied.len, index++)
|
||||
var/law = src.laws.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")
|
||||
subsystem_law_manager()
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
var/list/robot_verbs_default = list(
|
||||
/mob/living/silicon/robot/proc/sensor_mode,
|
||||
/mob/living/silicon/robot/proc/checklaws
|
||||
)
|
||||
|
||||
/mob/living/silicon/robot
|
||||
@@ -67,11 +66,10 @@ var/list/robot_verbs_default = list(
|
||||
var/weapon_lock = 0
|
||||
var/weaponlock_time = 120
|
||||
var/lawupdate = 1 //Cyborgs will sync their laws with their AI by default
|
||||
var/lawcheck[1] //For stating laws.
|
||||
var/ioncheck[1] //Ditto.
|
||||
var/lockcharge //Used when locking down a borg to preserve cell charge
|
||||
var/speed = 0 //Cause sec borgs gotta go fast //No they dont!
|
||||
var/scrambledcodes = 0 // Used to determine if a borg shows up on the robotics console. Setting to one hides them.
|
||||
var/tracking_entities = 0 //The number of known entities currently accessing the internal camera
|
||||
var/braintype = "Cyborg"
|
||||
var/base_icon = ""
|
||||
var/crisis = 0
|
||||
@@ -153,17 +151,24 @@ var/list/robot_verbs_default = list(
|
||||
/mob/living/silicon/robot/proc/init(var/alien=0)
|
||||
aiCamera = new/obj/item/device/camera/siliconcam/robot_camera(src)
|
||||
make_laws()
|
||||
connected_ai = select_active_ai_with_fewest_borgs()
|
||||
if(connected_ai)
|
||||
connected_ai.connected_robots += src
|
||||
lawsync()
|
||||
photosync()
|
||||
var/new_ai = select_active_ai_with_fewest_borgs()
|
||||
if(new_ai)
|
||||
lawupdate = 1
|
||||
connect_to_ai(new_ai)
|
||||
else
|
||||
lawupdate = 0
|
||||
|
||||
playsound(loc, 'sound/voice/liveagain.ogg', 75, 1)
|
||||
|
||||
/mob/living/silicon/robot/SetName(pickedName as text)
|
||||
custom_name = pickedName
|
||||
updatename()
|
||||
|
||||
/mob/living/silicon/robot/proc/sync()
|
||||
if(lawupdate && connected_ai)
|
||||
lawsync()
|
||||
photosync()
|
||||
|
||||
// setup the PDA and its name
|
||||
/mob/living/silicon/robot/proc/setup_PDA()
|
||||
if (!rbPDA)
|
||||
@@ -768,8 +773,7 @@ var/list/robot_verbs_default = list(
|
||||
emagged = 1
|
||||
if(src.hud_used)
|
||||
src.hud_used.update_robot_modules_display() //Shows/hides the emag item if the inventory screen is already open.
|
||||
lawupdate = 0
|
||||
connected_ai = null
|
||||
disconnect_from_ai()
|
||||
user << "You emag [src]'s interface."
|
||||
// message_admins("[key_name_admin(user)] emagged cyborg [key_name_admin(src)]. Laws overridden.")
|
||||
log_game("[key_name(user)] emagged cyborg [key_name(src)]. Laws overridden.")
|
||||
@@ -1097,27 +1101,6 @@ var/list/robot_verbs_default = list(
|
||||
installed_modules()
|
||||
return 1
|
||||
|
||||
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(lawcheck[L+1])
|
||||
if ("Yes") lawcheck[L+1] = "No"
|
||||
if ("No") lawcheck[L+1] = "Yes"
|
||||
// src << text ("Switching Law [L]'s report status to []", lawcheck[L+1])
|
||||
checklaws()
|
||||
return 1
|
||||
|
||||
if (href_list["lawi"]) // Toggling whether or not a law gets stated by the State Laws verb --NeoFite
|
||||
var/L = text2num(href_list["lawi"])
|
||||
switch(ioncheck[L])
|
||||
if ("Yes") ioncheck[L] = "No"
|
||||
if ("No") ioncheck[L] = "Yes"
|
||||
// src << text ("Switching Law [L]'s report status to []", lawcheck[L+1])
|
||||
checklaws()
|
||||
return 1
|
||||
|
||||
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
|
||||
statelaws()
|
||||
return 1
|
||||
return 1
|
||||
|
||||
/mob/living/silicon/robot/proc/radio_menu()
|
||||
@@ -1199,8 +1182,7 @@ var/list/robot_verbs_default = list(
|
||||
return
|
||||
|
||||
/mob/living/silicon/robot/proc/UnlinkSelf()
|
||||
if (src.connected_ai)
|
||||
src.connected_ai = null
|
||||
disconnect_from_ai()
|
||||
lawupdate = 0
|
||||
lockcharge = 0
|
||||
canmove = 1
|
||||
@@ -1213,7 +1195,7 @@ var/list/robot_verbs_default = list(
|
||||
// Instead of being listed as "deactivated". The downside is that I'm going
|
||||
// to have to check if every camera is null or not before doing anything, to prevent runtime errors.
|
||||
// I could change the network to null but I don't know what would happen, and it seems too hacky for me.
|
||||
|
||||
|
||||
/mob/living/silicon/robot/proc/ResetSecurityCodes()
|
||||
set category = "Robot Commands"
|
||||
set name = "Reset Identity Codes"
|
||||
@@ -1362,6 +1344,7 @@ var/list/robot_verbs_default = list(
|
||||
designation = "Syndicate"
|
||||
modtype = "Syndicate"
|
||||
req_access = list(access_syndicate)
|
||||
lawchannel = "State"
|
||||
|
||||
/mob/living/silicon/robot/syndicate/New(loc)
|
||||
if(!cell)
|
||||
@@ -1391,4 +1374,18 @@ var/list/robot_verbs_default = list(
|
||||
if(2) //New Module
|
||||
connected_ai << "<br><br><span class='notice'>NOTICE - Cyborg module change detected: [name] has loaded the [designation] module.</span><br>"
|
||||
if(3) //New Name
|
||||
connected_ai << "<br><br><span class='notice'>NOTICE - Cyborg reclassification detected: [oldname] is now designated as [newname].</span><br>"
|
||||
connected_ai << "<br><br><span class='notice'>NOTICE - Cyborg reclassification detected: [oldname] is now designated as [newname].</span><br>"
|
||||
|
||||
/mob/living/silicon/robot/proc/disconnect_from_ai()
|
||||
if(connected_ai)
|
||||
sync() // One last sync attempt
|
||||
connected_ai.connected_robots -= src
|
||||
connected_ai = null
|
||||
|
||||
/mob/living/silicon/robot/proc/connect_to_ai(var/mob/living/silicon/ai/AI)
|
||||
if(AI && AI != connected_ai)
|
||||
disconnect_from_ai()
|
||||
connected_ai = AI
|
||||
connected_ai.connected_robots |= src
|
||||
notify_ai(1)
|
||||
sync()
|
||||
@@ -3,7 +3,9 @@
|
||||
robot_talk_understand = 1
|
||||
voice_name = "synthesized voice"
|
||||
var/syndicate = 0
|
||||
var/datum/ai_laws/laws = null//Now... THEY ALL CAN ALL HAVE LAWS
|
||||
var/const/MAIN_CHANNEL = "Main Frequency"
|
||||
var/lawchannel = MAIN_CHANNEL // Default channel on which to state laws
|
||||
var/list/stating_laws = list()// Channels laws are currently being stated on
|
||||
var/list/alarms_to_show = list()
|
||||
var/list/alarms_to_clear = list()
|
||||
var/list/hud_list[10]
|
||||
@@ -28,14 +30,21 @@
|
||||
var/obj/item/device/radio/common_radio
|
||||
|
||||
/mob/living/silicon/New()
|
||||
silicon_mob_list |= src
|
||||
..()
|
||||
add_language("Galactic Common")
|
||||
init_subsystems()
|
||||
|
||||
/mob/living/silicon/Destroy()
|
||||
silicon_mob_list -= src
|
||||
for(var/datum/alarm_handler/AH in alarm_handlers)
|
||||
AH.unregister(src)
|
||||
return ..()
|
||||
|
||||
/mob/living/silicon/proc/SetName(pickedName as text)
|
||||
real_name = pickedName
|
||||
name = real_name
|
||||
|
||||
/mob/living/silicon/proc/show_laws()
|
||||
return
|
||||
|
||||
@@ -142,13 +151,12 @@
|
||||
|
||||
// This adds the basic clock, shuttle recall timer, and malf_ai info to all silicon lifeforms
|
||||
/mob/living/silicon/Stat()
|
||||
..()
|
||||
statpanel("Status")
|
||||
if (src.client.statpanel == "Status")
|
||||
if(statpanel("Status"))
|
||||
show_station_time()
|
||||
show_emergency_shuttle_eta()
|
||||
show_system_integrity()
|
||||
show_malf_ai()
|
||||
..()
|
||||
|
||||
//Silicon mob language procs
|
||||
|
||||
|
||||
@@ -3,11 +3,13 @@
|
||||
var/datum/nano_module/alarm_monitor/all/alarm_monitor
|
||||
var/datum/nano_module/atmos_control/atmos_control
|
||||
var/datum/nano_module/crew_monitor/crew_monitor
|
||||
var/datum/nano_module/law_manager/law_manager
|
||||
var/datum/nano_module/power_monitor/silicon/power_monitor
|
||||
|
||||
/mob/living/silicon
|
||||
var/list/silicon_subsystems = list(
|
||||
/mob/living/silicon/proc/subsystem_alarm_monitor
|
||||
/mob/living/silicon/proc/subsystem_alarm_monitor,
|
||||
/mob/living/silicon/proc/subsystem_law_manager
|
||||
)
|
||||
|
||||
/mob/living/silicon/ai
|
||||
@@ -15,12 +17,14 @@
|
||||
/mob/living/silicon/proc/subsystem_alarm_monitor,
|
||||
/mob/living/silicon/proc/subsystem_atmos_control,
|
||||
/mob/living/silicon/proc/subsystem_crew_monitor,
|
||||
/mob/living/silicon/proc/subsystem_law_manager,
|
||||
/mob/living/silicon/proc/subsystem_power_monitor
|
||||
)
|
||||
|
||||
/mob/living/silicon/robot/drone
|
||||
silicon_subsystems = list(
|
||||
/mob/living/silicon/proc/subsystem_alarm_monitor,
|
||||
/mob/living/silicon/proc/subsystem_law_manager,
|
||||
/mob/living/silicon/proc/subsystem_power_monitor
|
||||
)
|
||||
|
||||
@@ -31,6 +35,7 @@
|
||||
alarm_monitor = new(src)
|
||||
atmos_control = new(src)
|
||||
crew_monitor = new(src)
|
||||
law_manager = new(src)
|
||||
power_monitor = new(src)
|
||||
|
||||
if(!register_alarms)
|
||||
@@ -69,6 +74,15 @@
|
||||
|
||||
crew_monitor.ui_interact(usr, state = self_state)
|
||||
|
||||
/****************
|
||||
* Law Manager *
|
||||
****************/
|
||||
/mob/living/silicon/proc/subsystem_law_manager()
|
||||
set name = "Law Manager"
|
||||
set category = "Subsystems"
|
||||
|
||||
law_manager.ui_interact(usr, state = self_state)
|
||||
|
||||
/********************
|
||||
* Power Monitor *
|
||||
********************/
|
||||
|
||||
@@ -218,6 +218,15 @@ proc/hassensorlevel(A, var/level)
|
||||
return U.sensor_mode >= level
|
||||
return 0
|
||||
|
||||
proc/getsensorlevel(A)
|
||||
var/mob/living/carbon/human/H = A
|
||||
if(istype(H) && istype(H.w_uniform, /obj/item/clothing/under))
|
||||
var/obj/item/clothing/under/U = H.w_uniform
|
||||
return U.sensor_mode
|
||||
return SUIT_SENSOR_OFF
|
||||
|
||||
/proc/is_admin(var/mob/user)
|
||||
return check_rights(R_ADMIN, 0, user) != 0
|
||||
|
||||
|
||||
/proc/check_zone(zone)
|
||||
|
||||
@@ -152,6 +152,8 @@
|
||||
generate_data()
|
||||
|
||||
/datum/nano_module/appearance_changer/proc/generate_data()
|
||||
if(!owner)
|
||||
return
|
||||
if(!valid_species.len)
|
||||
valid_species = owner.generate_valid_species(check_whitelist, whitelist, blacklist)
|
||||
if(!valid_hairstyles.len || !valid_facial_hairstyles.len)
|
||||
|
||||
@@ -0,0 +1,219 @@
|
||||
/datum/nano_module/law_manager
|
||||
name = "Law manager"
|
||||
var/ion_law = "IonLaw"
|
||||
var/zeroth_law = "ZerothLaw"
|
||||
var/inherent_law = "InherentLaw"
|
||||
var/supplied_law = "SuppliedLaw"
|
||||
var/supplied_law_position = MIN_SUPPLIED_LAW_NUMBER
|
||||
|
||||
var/current_view = 0
|
||||
|
||||
var/global/list/datum/ai_laws/admin_laws
|
||||
var/global/list/datum/ai_laws/player_laws
|
||||
var/mob/living/silicon/owner = null
|
||||
|
||||
/datum/nano_module/law_manager/New(var/mob/living/silicon/S)
|
||||
..()
|
||||
owner = S
|
||||
|
||||
if(!admin_laws)
|
||||
admin_laws = new()
|
||||
player_laws = new()
|
||||
|
||||
init_subtypes(/datum/ai_laws, admin_laws)
|
||||
admin_laws = dd_sortedObjectList(admin_laws)
|
||||
|
||||
for(var/datum/ai_laws/laws in admin_laws)
|
||||
if(laws.selectable)
|
||||
player_laws += laws
|
||||
|
||||
/datum/nano_module/law_manager/Topic(href, href_list)
|
||||
if(..())
|
||||
return 1
|
||||
|
||||
if(href_list["set_view"])
|
||||
current_view = text2num(href_list["set_view"])
|
||||
return 1
|
||||
|
||||
if(href_list["law_channel"])
|
||||
if(href_list["law_channel"] in owner.law_channels())
|
||||
owner.lawchannel = href_list["law_channel"]
|
||||
return 1
|
||||
|
||||
if(href_list["state_law"])
|
||||
var/datum/ai_law/AL = locate(href_list["ref"]) in owner.laws.all_laws()
|
||||
if(AL)
|
||||
var/state_law = text2num(href_list["state_law"])
|
||||
owner.laws.set_state_law(AL, state_law)
|
||||
return 1
|
||||
|
||||
if(href_list["add_zeroth_law"])
|
||||
if(zeroth_law && is_admin(usr) && !owner.laws.zeroth_law)
|
||||
owner.set_zeroth_law(zeroth_law)
|
||||
return 1
|
||||
|
||||
if(href_list["add_ion_law"])
|
||||
if(ion_law && is_malf(usr))
|
||||
owner.add_ion_law(ion_law)
|
||||
return 1
|
||||
|
||||
if(href_list["add_inherent_law"])
|
||||
if(inherent_law && is_malf(usr))
|
||||
owner.add_inherent_law(inherent_law)
|
||||
return 1
|
||||
|
||||
if(href_list["add_supplied_law"])
|
||||
if(supplied_law && supplied_law_position >= 1 && MIN_SUPPLIED_LAW_NUMBER <= MAX_SUPPLIED_LAW_NUMBER && is_malf(usr))
|
||||
owner.add_supplied_law(supplied_law_position, supplied_law)
|
||||
return 1
|
||||
|
||||
if(href_list["change_zeroth_law"])
|
||||
var/new_law = sanitize(input("Enter new law Zero. Leaving the field blank will cancel the edit.", "Edit Law", zeroth_law))
|
||||
if(new_law && new_law != zeroth_law && can_still_topic())
|
||||
zeroth_law = new_law
|
||||
return 1
|
||||
|
||||
if(href_list["change_ion_law"])
|
||||
var/new_law = sanitize(input("Enter new ion law. Leaving the field blank will cancel the edit.", "Edit Law", ion_law))
|
||||
if(new_law && new_law != ion_law && can_still_topic())
|
||||
ion_law = new_law
|
||||
return 1
|
||||
|
||||
if(href_list["change_inherent_law"])
|
||||
var/new_law = sanitize(input("Enter new inherent law. Leaving the field blank will cancel the edit.", "Edit Law", inherent_law))
|
||||
if(new_law && new_law != inherent_law && can_still_topic())
|
||||
inherent_law = new_law
|
||||
return 1
|
||||
|
||||
if(href_list["change_supplied_law"])
|
||||
var/new_law = sanitize(input("Enter new supplied law. Leaving the field blank will cancel the edit.", "Edit Law", supplied_law))
|
||||
if(new_law && new_law != supplied_law && can_still_topic())
|
||||
supplied_law = new_law
|
||||
return 1
|
||||
|
||||
if(href_list["change_supplied_law_position"])
|
||||
var/new_position = input(usr, "Enter new supplied law position between 1 and [MAX_SUPPLIED_LAW_NUMBER], inclusive. Inherent laws at the same index as a supplied law will not be stated.", "Law Position", supplied_law_position) as num|null
|
||||
if(isnum(new_position) && can_still_topic())
|
||||
supplied_law_position = Clamp(new_position, 1, MAX_SUPPLIED_LAW_NUMBER)
|
||||
return 1
|
||||
|
||||
if(href_list["edit_law"])
|
||||
if(is_malf(usr))
|
||||
var/datum/ai_law/AL = locate(href_list["edit_law"]) in owner.laws.all_laws()
|
||||
if(AL)
|
||||
var/new_law = sanitize(input(usr, "Enter new law. Leaving the field blank will cancel the edit.", "Edit Law", AL.law))
|
||||
if(new_law && new_law != AL.law && is_malf(usr) && can_still_topic())
|
||||
log_and_message_admins("has changed a law of [owner] from '[AL.law]' to '[new_law]'")
|
||||
AL.law = new_law
|
||||
return 1
|
||||
|
||||
if(href_list["delete_law"])
|
||||
if(is_malf(usr))
|
||||
var/datum/ai_law/AL = locate(href_list["delete_law"]) in owner.laws.all_laws()
|
||||
if(AL && is_malf(usr))
|
||||
owner.delete_law(AL)
|
||||
return 1
|
||||
|
||||
if(href_list["state_laws"])
|
||||
owner.statelaws(owner.laws)
|
||||
return 1
|
||||
|
||||
if(href_list["state_law_set"])
|
||||
var/datum/ai_laws/ALs = locate(href_list["state_law_set"]) in (is_admin(usr) ? admin_laws : player_laws)
|
||||
if(ALs)
|
||||
owner.statelaws(ALs)
|
||||
return 1
|
||||
|
||||
if(href_list["transfer_laws"])
|
||||
if(is_malf(usr))
|
||||
var/datum/ai_laws/ALs = locate(href_list["transfer_laws"]) in (is_admin(usr) ? admin_laws : player_laws)
|
||||
if(ALs)
|
||||
log_and_message_admins("has transfered the [ALs.name] laws to [owner].")
|
||||
ALs.sync(owner, 0)
|
||||
current_view = 0
|
||||
return 1
|
||||
|
||||
if(href_list["notify_laws"])
|
||||
owner << "<span class='danger'>Law Notice</span>"
|
||||
owner.laws.show_laws(owner)
|
||||
if(isAI(owner))
|
||||
var/mob/living/silicon/ai/AI = owner
|
||||
for(var/mob/living/silicon/robot/R in AI.connected_robots)
|
||||
R << "<span class='danger'>Law Notice</span>"
|
||||
R.laws.show_laws(R)
|
||||
if(usr != owner)
|
||||
usr << "<span class='notice'>Laws displayed.</span>"
|
||||
return 1
|
||||
|
||||
return 0
|
||||
|
||||
/datum/nano_module/law_manager/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1, var/datum/topic_state/state = default_state)
|
||||
var/data[0]
|
||||
owner.lawsync()
|
||||
|
||||
data["ion_law_nr"] = ionnum()
|
||||
data["ion_law"] = ion_law
|
||||
data["zeroth_law"] = zeroth_law
|
||||
data["inherent_law"] = inherent_law
|
||||
data["supplied_law"] = supplied_law
|
||||
data["supplied_law_position"] = supplied_law_position
|
||||
|
||||
package_laws(data, "zeroth_laws", list(owner.laws.zeroth_law))
|
||||
package_laws(data, "ion_laws", owner.laws.ion_laws)
|
||||
package_laws(data, "inherent_laws", owner.laws.inherent_laws)
|
||||
package_laws(data, "supplied_laws", owner.laws.supplied_laws)
|
||||
|
||||
data["isAI"] = isAI(owner)
|
||||
data["isMalf"] = is_malf(user)
|
||||
data["isSlaved"] = owner.is_slaved()
|
||||
data["isAdmin"] = is_admin(user)
|
||||
data["view"] = current_view
|
||||
|
||||
var/channels[0]
|
||||
for (var/ch_name in owner.law_channels())
|
||||
channels[++channels.len] = list("channel" = ch_name)
|
||||
data["channel"] = owner.lawchannel
|
||||
data["channels"] = channels
|
||||
data["law_sets"] = package_multiple_laws(data["isAdmin"] ? admin_laws : player_laws)
|
||||
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "law_manager.tmpl", sanitize("[src] - [owner.name]"), 800, is_malf(user) ? 600 : 400, state = state)
|
||||
ui.set_initial_data(data)
|
||||
ui.open()
|
||||
ui.set_auto_update(1)
|
||||
|
||||
/datum/nano_module/law_manager/proc/package_laws(var/list/data, var/field, var/list/datum/ai_law/laws)
|
||||
var/packaged_laws[0]
|
||||
for(var/datum/ai_law/AL in laws)
|
||||
packaged_laws[++packaged_laws.len] = list("law" = AL.law, "index" = AL.get_index(), "state" = owner.laws.get_state_law(AL), "ref" = "\ref[AL]")
|
||||
data[field] = packaged_laws
|
||||
data["has_[field]"] = packaged_laws.len
|
||||
|
||||
/datum/nano_module/law_manager/proc/package_multiple_laws(var/list/datum/ai_laws/laws)
|
||||
var/law_sets[0]
|
||||
for(var/datum/ai_laws/ALs in laws)
|
||||
var/packaged_laws[0]
|
||||
package_laws(packaged_laws, "zeroth_laws", list(ALs.zeroth_law, ALs.zeroth_law_borg))
|
||||
package_laws(packaged_laws, "ion_laws", ALs.ion_laws)
|
||||
package_laws(packaged_laws, "inherent_laws", ALs.inherent_laws)
|
||||
package_laws(packaged_laws, "supplied_laws", ALs.supplied_laws)
|
||||
law_sets[++law_sets.len] = list("name" = ALs.name, "header" = ALs.law_header, "ref" = "\ref[ALs]","laws" = packaged_laws)
|
||||
|
||||
return law_sets
|
||||
|
||||
/datum/nano_module/law_manager/proc/is_malf(var/mob/user)
|
||||
return (is_admin(user) && !owner.is_slaved()) || is_special_character(owner)
|
||||
|
||||
/mob/living/silicon/proc/is_slaved()
|
||||
return 0
|
||||
|
||||
/mob/living/silicon/robot/is_slaved()
|
||||
return lawupdate && connected_ai ? sanitize(connected_ai.name) : null
|
||||
|
||||
/datum/nano_module/law_manager/proc/sync_laws(var/mob/living/silicon/ai/AI)
|
||||
if(!AI)
|
||||
return
|
||||
for(var/mob/living/silicon/robot/R in AI.connected_robots)
|
||||
R.sync()
|
||||
log_and_message_admins("has syncronized [AI]'s laws with its borgs.")
|
||||
@@ -9,17 +9,17 @@
|
||||
req_tech = list("programming" = 4, "materials" = 4)
|
||||
build_type = IMPRINTER
|
||||
materials = list("$glass" = 1000, "sacid" = 20, "$gold" = 100)
|
||||
build_path = /obj/item/weapon/aiModule/supplied/freeform
|
||||
build_path = /obj/item/weapon/aiModule/freeform
|
||||
category = list("AI Modules")
|
||||
|
||||
/datum/design/onehuman_module
|
||||
name = "AI Module (OneHuman)"
|
||||
desc = "Allows for the construction of a OneHuman AI Module."
|
||||
id = "onehuman_module"
|
||||
/datum/design/onecrewmember_module
|
||||
name = "AI Module (oneCrewMember)"
|
||||
desc = "Allows for the construction of a oneCrewMember AI Module."
|
||||
id = "onecrewmember_module"
|
||||
req_tech = list("programming" = 4, "materials" = 6)
|
||||
build_type = IMPRINTER
|
||||
materials = list("$glass" = 1000, "sacid" = 20, "$diamond" = 100)
|
||||
build_path = /obj/item/weapon/aiModule/zeroth/oneHuman
|
||||
build_path = /obj/item/weapon/aiModule/oneCrewMember
|
||||
category = list("AI Modules")
|
||||
|
||||
/datum/design/oxygen_module
|
||||
@@ -29,7 +29,7 @@
|
||||
req_tech = list("programming" = 3, "biotech" = 2, "materials" = 4)
|
||||
build_type = IMPRINTER
|
||||
materials = list("$glass" = 1000, "sacid" = 20, "$gold" = 100)
|
||||
build_path = /obj/item/weapon/aiModule/supplied/oxygen
|
||||
build_path = /obj/item/weapon/aiModule/oxygen
|
||||
category = list("AI Modules")
|
||||
|
||||
/datum/design/protectstation_module
|
||||
@@ -39,7 +39,7 @@
|
||||
req_tech = list("programming" = 3, "materials" = 6)
|
||||
build_type = IMPRINTER
|
||||
materials = list("$glass" = 1000, "sacid" = 20, "$gold" = 100)
|
||||
build_path = /obj/item/weapon/aiModule/supplied/protectStation
|
||||
build_path = /obj/item/weapon/aiModule/protectStation
|
||||
category = list("AI Modules")
|
||||
|
||||
/datum/design/purge_module
|
||||
@@ -49,7 +49,7 @@
|
||||
req_tech = list("programming" = 4, "materials" = 6)
|
||||
build_type = IMPRINTER
|
||||
materials = list("$glass" = 2000, "sacid" = 20, "$diamond" = 100)
|
||||
build_path = /obj/item/weapon/aiModule/reset/purge
|
||||
build_path = /obj/item/weapon/aiModule/purge
|
||||
category = list("AI Modules")
|
||||
|
||||
/datum/design/quarantine_module
|
||||
@@ -59,7 +59,7 @@
|
||||
req_tech = list("programming" = 3, "biotech" = 2, "materials" = 4)
|
||||
build_type = IMPRINTER
|
||||
materials = list("$glass" = 1000, "sacid" = 20, "$gold" = 100)
|
||||
build_path = /obj/item/weapon/aiModule/zeroth/quarantine
|
||||
build_path = /obj/item/weapon/aiModule/quarantine
|
||||
category = list("AI Modules")
|
||||
|
||||
/datum/design/reset_module
|
||||
@@ -79,7 +79,7 @@
|
||||
req_tech = list("programming" = 3, "materials" = 4)
|
||||
build_type = IMPRINTER
|
||||
materials = list("$glass" = 1000, "sacid" = 20, "$gold" = 100)
|
||||
build_path = /obj/item/weapon/aiModule/supplied/safeguard
|
||||
build_path = /obj/item/weapon/aiModule/safeguard
|
||||
category = list("AI Modules")
|
||||
|
||||
/datum/design/antimov_module
|
||||
@@ -89,7 +89,7 @@
|
||||
req_tech = list("programming" = 4, "materials" = 6, "syndicate" = 2)
|
||||
build_type = IMPRINTER
|
||||
materials = list("$glass" = 1000, "sacid" = 20, "$diamond" = 100)
|
||||
build_path = /obj/item/weapon/aiModule/core/full/antimov
|
||||
build_path = /obj/item/weapon/aiModule/antimov
|
||||
category = list("AI Modules")
|
||||
|
||||
/datum/design/asimov
|
||||
@@ -99,7 +99,7 @@
|
||||
req_tech = list("programming" = 3, "materials" = 6)
|
||||
build_type = IMPRINTER
|
||||
materials = list("$glass" = 1000, "sacid" = 20, "$diamond" = 100)
|
||||
build_path = /obj/item/weapon/aiModule/core/full/asimov
|
||||
build_path = /obj/item/weapon/aiModule/asimov
|
||||
category = list("AI Modules")
|
||||
|
||||
/datum/design/corporate_module
|
||||
@@ -109,18 +109,18 @@
|
||||
req_tech = list("programming" = 4, "materials" = 6)
|
||||
build_type = IMPRINTER
|
||||
materials = list("$glass" = 1000, "sacid" = 20, "$diamond" = 100)
|
||||
build_path = /obj/item/weapon/aiModule/core/full/corp
|
||||
build_path = /obj/item/weapon/aiModule/corp
|
||||
category = list("AI Modules")
|
||||
|
||||
/datum/design/custom_module
|
||||
name = "Core AI Module (Custom)"
|
||||
desc = "Allows for the construction of a Custom AI Core Module."
|
||||
id = "custom_module"
|
||||
req_tech = list("programming" = 4, "materials" = 6)
|
||||
/datum/design/crewsimov
|
||||
name = "Core AI Module (Crewsimov)"
|
||||
desc = "Allows for the construction of a Crewsimov AI Core Module."
|
||||
id = "crewsimov_module"
|
||||
req_tech = list("programming" = 3, "materials" = 6)
|
||||
build_type = IMPRINTER
|
||||
materials = list("$glass" = 1000, "sacid" = 20, "$diamond" = 100)
|
||||
build_path = /obj/item/weapon/aiModule/core/full/custom
|
||||
category = list("AI Modules")
|
||||
build_path = /obj/item/weapon/aiModule/crewsimov
|
||||
category = list("AI Modules")
|
||||
|
||||
/datum/design/freeformcore_module
|
||||
name = "Core AI Module (Freeform)"
|
||||
@@ -129,7 +129,7 @@
|
||||
req_tech = list("programming" = 4, "materials" = 6)
|
||||
build_type = IMPRINTER
|
||||
materials = list("$glass" = 1000, "sacid" = 20, "$diamond" = 100)
|
||||
build_path = /obj/item/weapon/aiModule/core/freeformcore
|
||||
build_path = /obj/item/weapon/aiModule/freeformcore
|
||||
category = list("AI Modules")
|
||||
|
||||
/datum/design/paladin_module
|
||||
@@ -139,7 +139,7 @@
|
||||
req_tech = list("programming" = 4, "materials" = 6)
|
||||
build_type = IMPRINTER
|
||||
materials = list("$glass" = 1000, "sacid" = 20, "$diamond" = 100)
|
||||
build_path = /obj/item/weapon/aiModule/core/full/paladin
|
||||
build_path = /obj/item/weapon/aiModule/paladin
|
||||
category = list("AI Modules")
|
||||
|
||||
/datum/design/tyrant_module
|
||||
@@ -149,5 +149,5 @@
|
||||
req_tech = list("programming" = 4, "syndicate" = 2, "materials" = 6)
|
||||
build_type = IMPRINTER
|
||||
materials = list("$glass" = 1000, "sacid" = 20, "$diamond" = 100)
|
||||
build_path = /obj/item/weapon/aiModule/core/full/tyrant
|
||||
build_path = /obj/item/weapon/aiModule/tyrant
|
||||
category = list("AI Modules")
|
||||
|
||||
Reference in New Issue
Block a user