From 3a4679bce724956ba47da74bbe3f505a193c365a Mon Sep 17 00:00:00 2001 From: Markolie Date: Tue, 10 Feb 2015 03:06:43 +0100 Subject: [PATCH] Remove zeroth law with own board --- code/datums/ai_laws.dm | 5 +++ code/game/objects/items/weapons/AI_modules.dm | 38 +++++++++++++------ code/modules/events/blob.dm | 5 +-- code/modules/mob/living/silicon/ai/laws.dm | 4 ++ code/modules/mob/living/silicon/robot/laws.dm | 4 ++ 5 files changed, 41 insertions(+), 15 deletions(-) diff --git a/code/datums/ai_laws.dm b/code/datums/ai_laws.dm index d81bbf67085..e1fc26d1709 100644 --- a/code/datums/ai_laws.dm +++ b/code/datums/ai_laws.dm @@ -179,6 +179,11 @@ datum/ai_laws/tyrant //This probably shouldn't be a default lawset. /datum/ai_laws/proc/clear_ion_laws() src.ion = list() + +/datum/ai_laws/proc/clear_zeroth_law(var/law_borg = null) + src.zeroth = null + if(law_borg) + src.zeroth_borg = null /datum/ai_laws/proc/show_laws(var/who) diff --git a/code/game/objects/items/weapons/AI_modules.dm b/code/game/objects/items/weapons/AI_modules.dm index c30f2e1ab1d..5f6de0b0130 100755 --- a/code/game/objects/items/weapons/AI_modules.dm +++ b/code/game/objects/items/weapons/AI_modules.dm @@ -101,13 +101,20 @@ AI MODULES for(var/templaw in laws) target.add_inherent_law(templaw) +/obj/item/weapon/aiModule/zeroth + var/removeownlaw = 0 + /obj/item/weapon/aiModule/zeroth/transmitInstructions(var/mob/living/silicon/ai/target, var/mob/sender) if(target.laws.zeroth) - target << "[sender.real_name] attempted to modify your zeroth law." - target << "It would be in your best interest to play along with [sender.real_name] that:" - for(var/failedlaw in laws) - target << "[failedlaw]" - return 1 + if(removeownlaw && (laws[1] == target.laws.zeroth)) + target.clear_zeroth_law() + return 2 + else + target << "[sender.real_name] attempted to modify your zeroth law." + target << "It would be in your best interest to play along with [sender.real_name] that:" + for(var/failedlaw in laws) + target << "[failedlaw]" + return 1 for(var/templaw in laws) target.set_zeroth_law(templaw) @@ -149,7 +156,7 @@ AI MODULES /obj/item/weapon/aiModule/zeroth/oneHuman name = "'OneHuman' AI Module" var/targetName = "" - desc = "A 'one human' AI module: 'Only is crew.'" + desc = "A 'one human' AI module: 'Only is crew.' This module adds a zeroth law, which can only be removed by uploading this board again." origin_tech = "programming=3;materials=6" //made with diamonds! laws = list("Only is crew.") @@ -159,6 +166,7 @@ AI MODULES targetName = targName laws[1] = "Only [targetName] is crew" desc = "A 'one crew' AI module: '[laws[1]]'" + removeownlaw = 1 /obj/item/weapon/aiModule/zeroth/oneHuman/install(var/mob/living/silicon/S,var/mob/user) if(!targetName) @@ -167,8 +175,10 @@ AI MODULES ..() /obj/item/weapon/aiModule/zeroth/oneHuman/transmitInstructions(var/mob/living/silicon/target, var/mob/sender) - if(..()) - return "[targetName], but the AI's existing law 0 cannot be overriden." + if(..() == 1) + return "[targetName], but the AI's existing zeroth law cannot be overriden." + if(..() == 2) + return "The AI's zeroth law has been overridden." return targetName @@ -186,13 +196,17 @@ AI MODULES /obj/item/weapon/aiModule/zeroth/quarantine name = "'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, organics from leaving. It is impossible to harm an organic 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, organics from leaving. It is impossible to harm an organic while preventing them from leaving.' This module adds a zeroth law, which can only be removed by uploading this board again." origin_tech = "programming=3;biotech=2;materials=4" laws = list("The station is under a quarantine. Do not permit anyone to leave. Prevent, by any means necessary, organics from leaving. It is impossible to harm an organic while preventing them from leaving.") + removeownlaw = 1 /obj/item/weapon/aiModule/zeroth/quarantine/transmitInstructions(var/mob/living/silicon/ai/target, var/mob/sender) - if(..()) - return "The AI's existing law 0 cannot be overriden." + var/result = ..() + if(result == 1) + return "The AI's existing zeroth law cannot be overriden." + if(result == 2) + return "The AI's zeroth law has been overridden." return laws[1] /******************** OxygenIsToxicToHumans ********************/ @@ -259,7 +273,7 @@ AI MODULES /obj/item/weapon/aiModule/reset/purge/transmitInstructions(var/mob/living/silicon/ai/target, var/mob/sender) ..() - target.clear_inherent_laws() + target.clear_inherent_laws() /******************* Full Core Boards *******************/ diff --git a/code/modules/events/blob.dm b/code/modules/events/blob.dm index 9a3dc92a754..96729f0014c 100644 --- a/code/modules/events/blob.dm +++ b/code/modules/events/blob.dm @@ -68,8 +68,7 @@ for (var/mob/living/silicon/ai/aiPlayer in player_list) if (aiPlayer.client) - var/law = "" - aiPlayer.set_zeroth_law(law) + aiPlayer.clear_zeroth_law() aiPlayer << "\red You have detected a change in your laws information:" - aiPlayer << "Laws Updated: [law]" + aiPlayer << "Laws Updated: Zeroth law removed." ..() \ No newline at end of file diff --git a/code/modules/mob/living/silicon/ai/laws.dm b/code/modules/mob/living/silicon/ai/laws.dm index ab6b19e6190..9d30afc6e4d 100755 --- a/code/modules/mob/living/silicon/ai/laws.dm +++ b/code/modules/mob/living/silicon/ai/laws.dm @@ -23,6 +23,10 @@ /mob/living/silicon/ai/proc/set_zeroth_law(var/law, var/law_borg) src.laws_sanity_check() src.laws.set_zeroth_law(law, law_borg) + +/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() diff --git a/code/modules/mob/living/silicon/robot/laws.dm b/code/modules/mob/living/silicon/robot/laws.dm index 84377b6adb4..38267256f4b 100644 --- a/code/modules/mob/living/silicon/robot/laws.dm +++ b/code/modules/mob/living/silicon/robot/laws.dm @@ -77,6 +77,10 @@ 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)