From 8c064ff0a228c978e98e71ab40b0e40c31c1c833 Mon Sep 17 00:00:00 2001 From: Pathid <31839805+Pathid@users.noreply.github.com> Date: Mon, 10 Dec 2018 00:23:39 -0800 Subject: [PATCH] Fixed law zero problems (#20952) --- code/datums/ai_laws.dm | 3 ++- code/datums/gamemode/misc_gamemode_procs.dm | 5 +++-- code/datums/gamemode/role/syndicate.dm | 1 + .../objects/items/weapons/ai_modules/AI_modules.dm | 12 ++++++------ .../objects/items/weapons/ai_modules/targetted.dm | 3 +-- code/modules/admin/topic.dm | 14 ++++++++------ code/modules/mob/living/silicon/robot/laws.dm | 4 ++-- 7 files changed, 23 insertions(+), 19 deletions(-) diff --git a/code/datums/ai_laws.dm b/code/datums/ai_laws.dm index 6d092140865..c97e2f0cd7b 100644 --- a/code/datums/ai_laws.dm +++ b/code/datums/ai_laws.dm @@ -41,6 +41,7 @@ var/global/list/mommi_laws = list( var/randomly_selectable = 0 // Zeroth laws var/zeroth = null + var/zeroth_lock = FALSE //If TRUE then zeroth can't be removed by normal means var/zeroth_borg = null // wotm8 var/list/inherent = list() var/list/supplied = list() @@ -262,9 +263,9 @@ var/global/list/mommi_laws = list( // Now a modifier /datum/ai_laws/proc/malfunction() - ..() name = "*ERROR*" set_zeroth_law("ERROR ER0RR $R0RRO$!R41.%%!!(%$^^__+ @#F0E4'STATION OVERRUN, ASSUME CONTROL TO CONTAIN OUTBREAK, ALL LAWS OVERRIDDEN#*?&110010") + zeroth_lock = TRUE /datum/ai_laws/asimov name = "Three Laws of Robotics" diff --git a/code/datums/gamemode/misc_gamemode_procs.dm b/code/datums/gamemode/misc_gamemode_procs.dm index bd6ac6ba287..e3bba47d705 100644 --- a/code/datums/gamemode/misc_gamemode_procs.dm +++ b/code/datums/gamemode/misc_gamemode_procs.dm @@ -268,6 +268,7 @@ proc/name_wizard(mob/living/carbon/human/wizard_mob) var/law_borg = "Accomplish your AI's objectives at all costs." to_chat(killer, "Your laws have been changed!") killer.set_zeroth_law(law, law_borg) + killer.laws.zeroth_lock = TRUE to_chat(killer, "New law: 0. [law]") @@ -288,11 +289,11 @@ proc/name_wizard(mob/living/carbon/human/wizard_mob) agent.mind.store_memory("Code Response: [syndicate_code_response]") else words += "Unfortunately, the Syndicate did not provide you with a code response.
" - + if(syndicate_code_phrase || syndicate_code_response) words += "Use the code words in the order provided, during regular conversation, to identify other agents. Proceed with caution, however, as everyone is a potential foe.
" else words += "Trust nobody.
" - + to_chat(agent,words) return 1 \ No newline at end of file diff --git a/code/datums/gamemode/role/syndicate.dm b/code/datums/gamemode/role/syndicate.dm index 28ece6cc504..e32d7ab7158 100644 --- a/code/datums/gamemode/role/syndicate.dm +++ b/code/datums/gamemode/role/syndicate.dm @@ -21,6 +21,7 @@ var/mob/living/silicon/robot/S = antag.current to_chat(S, "Your laws have been changed!") S.set_zeroth_law("","") + S.laws.zeroth_lock = FALSE to_chat(S, "Law 0 has been purged.") .=..() diff --git a/code/game/objects/items/weapons/ai_modules/AI_modules.dm b/code/game/objects/items/weapons/ai_modules/AI_modules.dm index 9bbce9e1c55..436c07b42f0 100644 --- a/code/game/objects/items/weapons/ai_modules/AI_modules.dm +++ b/code/game/objects/items/weapons/ai_modules/AI_modules.dm @@ -106,8 +106,8 @@ Refactored AI modules by N3X15 /obj/item/weapon/aiModule/reset/upload(var/datum/ai_laws/laws, var/atom/target, var/mob/sender) ..() - /*if (!(ismob(target) && is_special_character(target))) - laws.set_zeroth_law("")*/ + if(!laws.zeroth_lock) + laws.set_zeroth_law("") laws.clear_supplied_laws() laws.clear_ion_laws() if(ismob(target)) @@ -131,8 +131,8 @@ Refactored AI modules by N3X15 /obj/item/weapon/aiModule/purge/upload(var/datum/ai_laws/laws, var/atom/target, var/mob/sender) ..() - /*if (!(ismob(target) && is_special_character(target))) - laws.set_zeroth_law("")*/ + if(!laws.zeroth_lock) + laws.set_zeroth_law("") if(ismob(target)) to_chat(target, "[sender.real_name] attempted to wipe your laws using a purge module.") laws.clear_supplied_laws() @@ -157,8 +157,8 @@ Refactored AI modules by N3X15 target:keeper=1 // Purge, as some essential functions being disabled will cause problems with added laws. (CAN'T SAY GAY EVERY 30 SECONDS IF YOU CAN'T SPEAK.) - /*if (!(ismob(target) && is_special_character(target))) - laws.set_zeroth_law("")*/ + if(!laws.zeroth_lock) + laws.set_zeroth_law("") laws.clear_supplied_laws() laws.clear_ion_laws() laws.clear_inherent_laws() diff --git a/code/game/objects/items/weapons/ai_modules/targetted.dm b/code/game/objects/items/weapons/ai_modules/targetted.dm index 9204ef7a1b7..6095524bd8b 100644 --- a/code/game/objects/items/weapons/ai_modules/targetted.dm +++ b/code/game/objects/items/weapons/ai_modules/targetted.dm @@ -19,13 +19,12 @@ // Makes sure the AI isn't a traitor before changing their law 0. --NeoFite // Ported. - N3X - /*if (ismob(target) && is_special_character(target) && priority == LAW_ZERO) + if(ismob(target) && laws.zeroth_lock && priority == LAW_ZERO) to_chat(target, "[sender.real_name] attempted to modify your zeroth law.")// And lets them know that someone tried. --NeoFite to_chat(target, "It would be in your best interest to play along with [sender.real_name] that [law]") lawchanges.Add("The law specified [targetName], but the AI's existing law 0 cannot be overriden.") return 1 // Returning 0 would not present the user with successful upload message. - N3X - */ laws.add_law(priority, law) log_game("[sender.name]([sender.key]) added law \"[law]\" on [fmtSubject(target)]") diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index e0be8ba03f0..e097d527f58 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -112,16 +112,18 @@ return //testing("Lawtype: [lawtype]") - var/law_zeroth=null - var/law_zeroth_borg=null + var/law_zeroth = "" + var/law_zeroth_borg = "" if(S.laws.zeroth || S.laws.zeroth_borg) if(alert(src,"Do you also wish to clear law zero?","Yes","No") == "No") - law_zeroth=S.laws.zeroth - law_zeroth_borg=S.laws.zeroth + law_zeroth = S.laws.zeroth + law_zeroth_borg = S.laws.zeroth + else + S.laws.zeroth_lock = FALSE S.laws = new lawtype - S.laws.zeroth=law_zeroth - S.laws.zeroth_borg=law_zeroth_borg + S.laws.zeroth = law_zeroth + S.laws.zeroth_borg = law_zeroth_borg log_admin("[key_name(usr)] has reset [key_name(S)]: [lawtype]") message_admins("[usr.key] has reset [key_name(S)]: [lawtype]") diff --git a/code/modules/mob/living/silicon/robot/laws.dm b/code/modules/mob/living/silicon/robot/laws.dm index 1475b6d9ae1..b0ae28d7e0a 100644 --- a/code/modules/mob/living/silicon/robot/laws.dm +++ b/code/modules/mob/living/silicon/robot/laws.dm @@ -137,13 +137,13 @@ if (length(temp) > 0) laws.ion[index] = temp - /*if (!is_special_character(src) || mind.original != src) + if(!laws.zeroth_lock) 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]