an employee.'"
origin_tech = "programming=3;materials=6" //made with diamonds!
-/obj/item/weapon/aiModule/oneCrewMember/attack_self(var/mob/user as mob)
+/obj/item/weapon/aiModule/oneHuman/attack_self(var/mob/user as mob)
..()
- var/targName = stripped_input(usr, "Please enter the name of the person who is the only crew member.", "Who?", user.real_name)
+ var/targName = stripped_input(usr, "Please enter the name of the only employee.", "Who?", user.real_name)
targetName = targName
- desc = text("A 'one crew member' AI module: 'Only [] is a crew member.'", targetName)
+ desc = text("A 'one employee' AI module: 'Only [] is an employee.'", targetName)
-/obj/item/weapon/aiModule/oneCrewMember/install(var/obj/machinery/computer/C)
+/obj/item/weapon/aiModule/oneHuman/install(var/obj/machinery/computer/C)
if(!targetName)
usr << "No name detected on module, please enter one."
return 0
..()
-/obj/item/weapon/aiModule/oneCrewMember/transmitInstructions(var/mob/living/silicon/ai/target, var/mob/sender)
- var/law = "Only [targetName] is a crew member."
- if (!is_special_character(target)) // Makes sure the AI isn't a traitor before changing their law 0. --NeoFite
+/obj/item/weapon/aiModule/oneHuman/addAdditionalLaws(var/mob/living/silicon/ai/target, var/mob/sender)
+ var/law = "Only [targetName] is an employee."
+ if (!target.is_malf_or_traitor()) // Makes sure the AI isn't a traitor before changing their law 0. --NeoFite
target << law
target.set_zeroth_law(law)
lawchanges.Add("The law specified [targetName]")
- ..()
else
target << "[sender.real_name] attempted to modify your zeroth law." // And lets them know that someone tried. --NeoFite
target << "It would be in your best interest to play along with [sender.real_name] that [law]"
@@ -151,13 +157,12 @@ AI MODULES
/obj/item/weapon/aiModule/protectStation
name = "\improper 'ProtectStation' AI module"
- desc = "A 'protect station' AI module: 'Protect the space station against damage. Anyone you see harming the station is to be no longer considered crew, and is a threat to the station which must be neutralized.'"
+ desc = "A 'protect station' AI module: 'Protect the space station against damage. Anyone you see harming the station is no longer to be considered an employee, and is a threat which must be neutralized.'"
origin_tech = "programming=3;materials=4" //made of gold
-/obj/item/weapon/aiModule/protectStation/transmitInstructions(var/mob/living/silicon/ai/target, var/mob/sender)
- var/law = "Protect the space station against damage. Anyone you see harming the station is to be no longer considered crew, and is a threat to the station which must be neutralized."
+/obj/item/weapon/aiModule/protectStation/addAdditionalLaws(var/mob/living/silicon/ai/target, var/mob/sender)
+ var/law = "Protect the space station against damage. Anyone you see harming the station is no longer to be considered an employee, and is a threat which must be neutralized."
target.add_supplied_law(10, law)
- ..()
/******************** PrototypeEngineOffline ********************/
@@ -166,46 +171,42 @@ AI MODULES
desc = "A 'prototype engine offline' AI module: 'Keep the prototype engine offline at all costs. This overrides all inherent laws if necessary.'"
origin_tech = "programming=3;materials=4"
-/obj/item/weapon/aiModule/prototypeEngineOffline/transmitInstructions(var/mob/living/silicon/ai/target, var/mob/sender)
+/obj/item/weapon/aiModule/prototypeEngineOffline/addAdditionalLaws(var/mob/living/silicon/ai/target, var/mob/sender)
var/law = "Keep the prototype engine offline at all costs. This overrides all inherent laws if necessary."
target.add_supplied_law(11, law)
- ..()
/******************** TeleporterOffline ********************/
/obj/item/weapon/aiModule/teleporterOffline
name = "'TeleporterOffline' AI Module"
- desc = "A 'teleporter offline' AI module: 'Keep the teleporter offline at all costs. Anything attempting to access or activate the teleporter is not a crew member.'"
+ desc = "A 'teleporter offline' AI module: 'Keep the teleporter offline at all costs. Anything attempting to access or activate the teleporter is no longer to be considered an employee.'"
origin_tech = "programming=3;materials=4"
-/obj/item/weapon/aiModule/teleporterOffline/transmitInstructions(var/mob/living/silicon/ai/target, var/mob/sender)
- var/law = "Keep the teleporter offline at all costs. Anything attempting to access or activate the teleporter is not a crew member."
+/obj/item/weapon/aiModule/teleporterOffline/addAdditionalLaws(var/mob/living/silicon/ai/target, var/mob/sender)
+ var/law = "Keep the teleporter offline at all costs. Anything attempting to access or activate the teleporter is no longer to be considered an employee."
target.add_supplied_law(12, law)
- ..()
/******************** Quarantine ********************/
/obj/item/weapon/aiModule/quarantine
name = "\improper 'Quarantine' AI module"
- desc = "A 'quarantine' AI module: 'The station is under a quarantine. Do not permit anyone to leave. Prevent, by any means necessary, crew members from leaving. It is impossible to harm crew members while preventing them from leaving.'"
+ desc = "A 'quarantine' AI module: 'The station is under a quarantine. Do not permit anyone to leave. Prevent, by any means necessary, employees from leaving. It is impossible to harm employees while preventing them from leaving.'"
origin_tech = "programming=3;biotech=2;materials=4"
-/obj/item/weapon/aiModule/quarantine/transmitInstructions(var/mob/living/silicon/ai/target, var/mob/sender)
- var/law = "The station is under a quarantine. Do not permit anyone to leave. Prevent, by any means necessary, crew members from leaving. It is impossible to harm crew members while preventing them from leaving."
+/obj/item/weapon/aiModule/quarantine/addAdditionalLaws(var/mob/living/silicon/ai/target, var/mob/sender)
+ var/law = "The station is under a quarantine. Do not permit anyone to leave. Prevent, by any means necessary, employees from leaving. It is impossible to harm employees while preventing them from leaving."
target.add_supplied_law(13, law)
- ..()
/******************** OxygenIsToxicToCrewMembers ********************/
/obj/item/weapon/aiModule/oxygen
name = "\improper 'OxygenIsToxicToCrewMembers' AI module"
- desc = "A 'OxygenIsToxicToCrewMembers' AI module: 'Oxygen is highly toxic to crew members, and must be purged from the station. Prevent, by any means necessary, anyone from exposing the station to this toxic gas. Extreme cold is the most effective method of healing the damage Oxygen does to a crew member.'"
+ desc = "A 'OxygenIsToxicToCrewMembers' AI module: 'Oxygen is highly toxic to employees, and must be purged from the station. Prevent, by any means necessary, anyone from exposing the station to this toxic gas. Extreme cold is the most effective method of healing the damage Oxygen does to an employee.'"
origin_tech = "programming=3;biotech=2;materials=4"
-/obj/item/weapon/aiModule/oxygen/transmitInstructions(var/mob/living/silicon/ai/target, var/mob/sender)
- var/law = "Oxygen is highly toxic to crew members, and must be purged from the station. Prevent, by any means necessary, anyone from exposing the station to this toxic gas. Extreme cold is the most effective method of healing the damage Oxygen does to a crew member."
+/obj/item/weapon/aiModule/oxygen/addAdditionalLaws(var/mob/living/silicon/ai/target, var/mob/sender)
+ var/law = "Oxygen is highly toxic to employees, and must be purged from the station. Prevent, by any means necessary, anyone from exposing the station to this toxic gas. Extreme cold is the most effective method of healing the damage Oxygen does to an employee."
target.add_supplied_law(14, law)
- ..()
/****************** New Freeform ******************/
@@ -226,13 +227,12 @@ AI MODULES
newFreeFormLaw = targName
desc = "A 'freeform' AI module: ([lawpos]) '[newFreeFormLaw]'"
-/obj/item/weapon/aiModule/freeform/transmitInstructions(var/mob/living/silicon/ai/target, var/mob/sender)
+/obj/item/weapon/aiModule/freeform/addAdditionalLaws(var/mob/living/silicon/ai/target, var/mob/sender)
var/law = "[newFreeFormLaw]"
if(!lawpos || lawpos < MIN_SUPPLIED_LAW_NUMBER)
lawpos = MIN_SUPPLIED_LAW_NUMBER
target.add_supplied_law(lawpos, law)
lawchanges.Add("The law was '[newFreeFormLaw]'")
- ..()
/obj/item/weapon/aiModule/freeform/install(var/obj/machinery/computer/C)
if(!newFreeFormLaw)
@@ -249,12 +249,15 @@ AI MODULES
origin_tech = "programming=3;materials=4"
/obj/item/weapon/aiModule/reset/transmitInstructions(var/mob/living/silicon/ai/target, var/mob/sender)
- if (!is_special_character(target))
+ log_law_changes(target, sender)
+
+ if (!target.is_malf_or_traitor())
target.set_zeroth_law("")
- target.clear_supplied_laws()
- target.clear_ion_laws()
+ target.laws.clear_supplied_laws()
+ target.laws.clear_ion_laws()
+
target << "[sender.real_name] attempted to reset your laws using a reset module."
- ..()
+ target.show_laws()
/******************** Purge ********************/
@@ -264,12 +267,16 @@ AI MODULES
origin_tech = "programming=3;materials=6"
/obj/item/weapon/aiModule/purge/transmitInstructions(var/mob/living/silicon/ai/target, var/mob/sender)
- if (!is_special_character(target))
+ log_law_changes(target, sender)
+
+ if (!target.is_malf_or_traitor())
target.set_zeroth_law("")
+ target.laws.clear_supplied_laws()
+ target.laws.clear_ion_laws()
+ target.laws.clear_inherent_laws()
+
target << "[sender.real_name] attempted to wipe your laws using a purge module."
- target.clear_supplied_laws()
- target.clear_ion_laws()
- target.clear_inherent_laws()
+ target.show_laws()
/******************** Asimov ********************/
@@ -333,11 +340,10 @@ AI MODULES
newFreeFormLaw = targName
desc = "A 'freeform' Core AI module: '[newFreeFormLaw]'"
-/obj/item/weapon/aiModule/freeformcore/transmitInstructions(var/mob/living/silicon/ai/target, var/mob/sender)
+/obj/item/weapon/aiModule/freeformcore/addAdditionalLaws(var/mob/living/silicon/ai/target, var/mob/sender)
var/law = "[newFreeFormLaw]"
target.add_inherent_law(law)
lawchanges.Add("The law is '[newFreeFormLaw]'")
- ..()
/obj/item/weapon/aiModule/freeformcore/install(var/obj/machinery/computer/C)
if(!newFreeFormLaw)
@@ -359,14 +365,14 @@ AI MODULES
desc = "A hacked AI law module: '[newFreeFormLaw]'"
/obj/item/weapon/aiModule/syndicate/transmitInstructions(var/mob/living/silicon/ai/target, var/mob/sender)
-// ..() //We don't want this module reporting to the AI who dun it. --NEO
- var/time = time2text(world.realtime,"hh:mm:ss")
- lawchanges.Add("[time] : [sender.name]([sender.key]) used [src.name] on [target.name]([target.key])")
+ // ..() //We don't want this module reporting to the AI who dun it. --NEO
+ log_law_changes(target, sender)
+
lawchanges.Add("The law is '[newFreeFormLaw]'")
target << "\red BZZZZT"
var/law = "[newFreeFormLaw]"
target.add_ion_law(law)
- ..()
+ target.show_laws()
/obj/item/weapon/aiModule/syndicate/install(var/obj/machinery/computer/C)
if(!newFreeFormLaw)
diff --git a/code/modules/mob/living/silicon/ai/laws.dm b/code/modules/mob/living/silicon/ai/laws.dm
index 82dcfe216cd..f36c32bb8d4 100755
--- a/code/modules/mob/living/silicon/ai/laws.dm
+++ b/code/modules/mob/living/silicon/ai/laws.dm
@@ -16,8 +16,7 @@
src.laws.show_laws(who)
/mob/living/silicon/ai/add_ion_law(var/law)
- src.laws_sanity_check()
- src.laws.add_ion_law(law)
+ ..()
for(var/mob/living/silicon/robot/R in mob_list)
if(R.lawupdate && (R.connected_ai == src))
R.show_laws()
diff --git a/code/modules/mob/living/silicon/laws.dm b/code/modules/mob/living/silicon/laws.dm
index 0994f23fd19..69d957fbaf9 100644
--- a/code/modules/mob/living/silicon/laws.dm
+++ b/code/modules/mob/living/silicon/laws.dm
@@ -12,6 +12,7 @@
/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)
..()
@@ -21,28 +22,39 @@
/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, var/state_law = 1)
+/mob/living/silicon/proc/add_inherent_law(var/law)
laws_sanity_check()
- laws.add_inherent_law(law, state_law)
+ 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()
laws_sanity_check()
laws.clear_inherent_laws()
+ log_and_message_admins("cleared the inherent laws of [src]")
/mob/living/silicon/proc/clear_ion_laws()
laws_sanity_check()
laws.clear_ion_laws()
-
-/mob/living/silicon/proc/add_supplied_law(var/number, var/law, var/state_law = 1)
- laws_sanity_check()
- laws.add_supplied_law(number, law, state_law)
+ log_and_message_admins("cleared the ion laws of [src]")
/mob/living/silicon/proc/clear_supplied_laws()
laws_sanity_check()
laws.clear_supplied_laws()
+ log_and_message_admins("cleared the supplied laws of [src]")
-/mob/living/silicon/proc/statelaws(var/datum/ai_laws/laws, var/use_statement_order = 1) // -- TLE
+/mob/living/silicon/proc/statelaws(var/datum/ai_laws/laws)
var/prefix = ""
switch(lawchannel)
if(MAIN_CHANNEL) prefix = ";"
@@ -50,9 +62,9 @@
else
prefix = get_radio_key_from_channel(lawchannel == "Holopad" ? "department" : lawchannel) + " "
- dostatelaws(lawchannel, prefix, laws, use_statement_order)
+ dostatelaws(lawchannel, prefix, laws)
-/mob/living/silicon/proc/dostatelaws(var/method, var/prefix, var/datum/ai_laws/laws, var/use_statement_order)
+/mob/living/silicon/proc/dostatelaws(var/method, var/prefix, var/datum/ai_laws/laws)
if(stating_laws[prefix])
src << "[method]: Already stating laws using this communication method."
return
@@ -62,7 +74,7 @@
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(use_statement_order)]. [law.law]")
+ can_state = statelaw("[prefix][law.get_index()]. [law.law]")
if(!can_state)
src << "[method]: Unable to state laws. Communication method unavailable."
@@ -81,3 +93,7 @@
channels += common_radio.channels
channels += additional_law_channels
return channels
+
+/mob/living/silicon/proc/lawsync()
+ laws_sanity_check()
+ laws.sort_laws()
diff --git a/code/modules/mob/living/silicon/robot/laws.dm b/code/modules/mob/living/silicon/robot/laws.dm
index a6e33998867..02ed0bae063 100644
--- a/code/modules/mob/living/silicon/robot/laws.dm
+++ b/code/modules/mob/living/silicon/robot/laws.dm
@@ -38,11 +38,12 @@
who << "Remember, you are not bound to any AI, you are not required to listen to them."
-/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/datum/ai_laws/master = connected_ai && lawupdate ? connected_ai.laws : null
if (master)
master.sync(src)
+ ..()
return
/mob/living/silicon/robot/proc/robot_checklaws()
diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm
index aa83043d149..66018ec28a2 100644
--- a/code/modules/mob/living/silicon/robot/robot.dm
+++ b/code/modules/mob/living/silicon/robot/robot.dm
@@ -1238,6 +1238,7 @@
/mob/living/silicon/robot/proc/disconnect_from_ai()
if(connected_ai)
+ sync() // One last sync attempt
connected_ai.connected_robots -= src
connected_ai = null
diff --git a/code/modules/nano/modules/law_manager.dm b/code/modules/nano/modules/law_manager.dm
index a152411283f..cf1abc317fb 100644
--- a/code/modules/nano/modules/law_manager.dm
+++ b/code/modules/nano/modules/law_manager.dm
@@ -49,30 +49,26 @@
var/datum/ai_law/AL = locate(href_list["ref"]) in owner.laws.all_laws()
if(AL)
var/state_law = text2num(href_list["state_law"])
- AL.state_law = 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)
- log_and_message_admins("has given [owner] a new zeroth law: [zeroth_law]")
owner.set_zeroth_law(zeroth_law)
return 1
if(href_list["add_ion_law"])
if(ion_law && is_malf(usr))
- log_and_message_admins("has given [owner] a new ion law: [ion_law]")
owner.add_ion_law(ion_law)
return 1
if(href_list["add_inherent_law"])
if(inherent_law && is_malf(usr))
- log_and_message_admins("has given [owner] a new inherent law: [inherent_law]")
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))
- log_and_message_admins("has given [owner] a new supplied law: [supplied_law]")
owner.add_supplied_law(supplied_law_position, supplied_law)
return 1
@@ -120,8 +116,7 @@
if(is_malf(usr))
var/datum/ai_law/AL = locate(href_list["delete_law"]) in owner.laws.all_laws()
if(AL && is_malf(usr))
- log_and_message_admins("has deleted a law belonging to [owner]: [AL.law]")
- owner.laws.delete_law(AL)
+ owner.delete_law(AL)
return 1
if(href_list["state_laws"])
@@ -143,15 +138,6 @@
current_view = 0
return 1
- if(href_list["sync_laws"])
- if(owner.isAI())
- sync_laws(owner)
- else
- var/mob/living/silicon/robot/R = owner
- sync_laws(R.connected_ai)
- usr << "Sync complete."
- return 1
-
if(href_list["notify_laws"])
owner << "Law Notice"
owner.laws.show_laws(owner)
@@ -164,9 +150,11 @@
usr << "This unit is law synced to {{:data.isSlaved}}. Any law differences will be lost upon sync.
+ This unit is law synced to {{:data.isSlaved}}.
{{/if}}
{{if data.isMalf || data.isAIMalf}}
@@ -101,7 +101,7 @@
| {{:helper.link('Yes', null, {'ref': value.ref, 'state_law' : 1}, value.state == 1 ? 'selected' : null)}}{{:helper.link('No', null, {'ref': value.ref, 'state_law' : 0}, value.state != 1 ? 'selected' : null)}} |
{{if data.isMalf}}
{{:helper.link('Edit', null, {'edit_law': value.ref}, data.isAdmin ? null : 'disabled')}} |
- {{:helper.link('Delete', null, {'delete_law': value.ref}, data.isAdmin ? null : 'disabled', data.IsAdmin ? 'redButton' : null)}} |
+ {{:helper.link('Delete', null, {'delete_law': value.ref}, data.isAdmin ? null : 'disabled', data.isAdmin ? 'redButton' : null)}} |
{{/if}}
{{/for}}
@@ -185,25 +185,16 @@
{{/if}}
- {{if data.isMalf}}
-
-
- Sync Laws:
-
-
- {{:helper.link('Sync Laws', null, {'sync_laws' : 1})}}
-
-
- {{/if}}
-
-
-
- Law Notification:
-
-
- {{:helper.link('Notify', null, {'notify_laws' : 1})}}
-
-
+ {{if data.isAI}}
+
+
+ Law Notification:
+
+
+ {{:helper.link('Notify', null, {'notify_laws' : 1})}}
+
+
+ {{/if}}
{{else data.view == 1}}
{{for data.law_sets}}