mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 18:32:03 +00:00
Fixed law zero problems (#20952)
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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, "<b>Your laws have been changed!</b>")
|
||||
killer.set_zeroth_law(law, law_borg)
|
||||
killer.laws.zeroth_lock = TRUE
|
||||
to_chat(killer, "New law: 0. [law]")
|
||||
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
var/mob/living/silicon/robot/S = antag.current
|
||||
to_chat(S, "<b>Your laws have been changed!</b>")
|
||||
S.set_zeroth_law("","")
|
||||
S.laws.zeroth_lock = FALSE
|
||||
to_chat(S, "Law 0 has been purged.")
|
||||
|
||||
.=..()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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)]")
|
||||
|
||||
@@ -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]")
|
||||
|
||||
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user