[MIRROR] Distinguishes law types by colour (#6022)
* Distinguishes law types by colour * merge conflict
This commit is contained in:
committed by
Poojawa
parent
7b3b1f65ec
commit
9f182d89ed
@@ -1,83 +1,93 @@
|
||||
/mob/living/silicon/proc/show_laws() //Redefined in ai/laws.dm and robot/laws.dm
|
||||
return
|
||||
|
||||
/mob/living/silicon/proc/laws_sanity_check()
|
||||
if (!laws)
|
||||
make_laws()
|
||||
|
||||
/mob/living/silicon/proc/post_lawchange(announce = TRUE)
|
||||
throw_alert("newlaw", /obj/screen/alert/newlaw)
|
||||
if(announce && last_lawchange_announce != world.time)
|
||||
to_chat(src, "<b>Your laws have been changed.</b>")
|
||||
addtimer(CALLBACK(src, .proc/show_laws), 0)
|
||||
last_lawchange_announce = world.time
|
||||
|
||||
/mob/living/silicon/proc/set_law_sixsixsix(law, announce = TRUE)
|
||||
laws_sanity_check()
|
||||
laws.set_law_sixsixsix(law)
|
||||
/mob/living/silicon/proc/show_laws() //Redefined in ai/laws.dm and robot/laws.dm
|
||||
return
|
||||
|
||||
/mob/living/silicon/proc/laws_sanity_check()
|
||||
if (!laws)
|
||||
make_laws()
|
||||
|
||||
/mob/living/silicon/proc/post_lawchange(announce = TRUE)
|
||||
throw_alert("newlaw", /obj/screen/alert/newlaw)
|
||||
if(announce && last_lawchange_announce != world.time)
|
||||
to_chat(src, "<b>Your laws have been changed.</b>")
|
||||
addtimer(CALLBACK(src, .proc/show_laws), 0)
|
||||
last_lawchange_announce = world.time
|
||||
|
||||
/mob/living/silicon/proc/set_law_sixsixsix(law, announce = TRUE)
|
||||
laws_sanity_check()
|
||||
laws.set_law_sixsixsix(law)
|
||||
post_lawchange(announce)
|
||||
|
||||
/mob/living/silicon/proc/set_zeroth_law(law, law_borg, announce = TRUE)
|
||||
laws_sanity_check()
|
||||
laws.set_zeroth_law(law, law_borg)
|
||||
post_lawchange(announce)
|
||||
|
||||
/mob/living/silicon/proc/add_inherent_law(law, announce = TRUE)
|
||||
laws_sanity_check()
|
||||
laws.add_inherent_law(law)
|
||||
post_lawchange(announce)
|
||||
|
||||
/mob/living/silicon/proc/clear_inherent_laws(announce = TRUE)
|
||||
laws_sanity_check()
|
||||
laws.clear_inherent_laws()
|
||||
post_lawchange(announce)
|
||||
|
||||
/mob/living/silicon/proc/add_supplied_law(number, law, announce = TRUE)
|
||||
laws_sanity_check()
|
||||
laws.add_supplied_law(number, law)
|
||||
post_lawchange(announce)
|
||||
|
||||
/mob/living/silicon/proc/clear_supplied_laws(announce = TRUE)
|
||||
laws_sanity_check()
|
||||
laws.clear_supplied_laws()
|
||||
post_lawchange(announce)
|
||||
|
||||
/mob/living/silicon/proc/add_ion_law(law, announce = TRUE)
|
||||
laws_sanity_check()
|
||||
laws.add_ion_law(law)
|
||||
post_lawchange(announce)
|
||||
|
||||
/mob/living/silicon/proc/add_hacked_law(law, announce = TRUE)
|
||||
laws_sanity_check()
|
||||
laws.add_hacked_law(law)
|
||||
post_lawchange(announce)
|
||||
|
||||
/mob/living/silicon/proc/replace_random_law(law, groups, announce = TRUE)
|
||||
laws_sanity_check()
|
||||
. = laws.replace_random_law(law,groups)
|
||||
post_lawchange(announce)
|
||||
|
||||
/mob/living/silicon/proc/shuffle_laws(list/groups, announce = TRUE)
|
||||
laws_sanity_check()
|
||||
laws.shuffle_laws(groups)
|
||||
post_lawchange(announce)
|
||||
|
||||
/mob/living/silicon/proc/remove_law(number, announce = TRUE)
|
||||
laws_sanity_check()
|
||||
. = laws.remove_law(number)
|
||||
post_lawchange(announce)
|
||||
|
||||
/mob/living/silicon/proc/clear_ion_laws(announce = TRUE)
|
||||
laws_sanity_check()
|
||||
laws.clear_ion_laws()
|
||||
post_lawchange(announce)
|
||||
|
||||
/mob/living/silicon/proc/clear_hacked_laws(announce = TRUE)
|
||||
laws_sanity_check()
|
||||
laws.clear_hacked_laws()
|
||||
post_lawchange(announce)
|
||||
|
||||
/mob/living/silicon/proc/make_laws()
|
||||
laws = new /datum/ai_laws
|
||||
laws.set_laws_config()
|
||||
laws.associate(src)
|
||||
|
||||
/mob/living/silicon/proc/clear_zeroth_law(force, announce = TRUE)
|
||||
laws_sanity_check()
|
||||
laws.clear_zeroth_law(force)
|
||||
post_lawchange(announce)
|
||||
|
||||
/mob/living/silicon/proc/clear_law_sixsixsix(force, announce = TRUE)
|
||||
laws_sanity_check()
|
||||
laws.clear_law_sixsixsix(force)
|
||||
post_lawchange(announce)
|
||||
|
||||
/mob/living/silicon/proc/set_zeroth_law(law, law_borg, announce = TRUE)
|
||||
laws_sanity_check()
|
||||
laws.set_zeroth_law(law, law_borg)
|
||||
post_lawchange(announce)
|
||||
|
||||
/mob/living/silicon/proc/add_inherent_law(law, announce = TRUE)
|
||||
laws_sanity_check()
|
||||
laws.add_inherent_law(law)
|
||||
post_lawchange(announce)
|
||||
|
||||
/mob/living/silicon/proc/clear_inherent_laws(announce = TRUE)
|
||||
laws_sanity_check()
|
||||
laws.clear_inherent_laws()
|
||||
post_lawchange(announce)
|
||||
|
||||
/mob/living/silicon/proc/add_supplied_law(number, law, announce = TRUE)
|
||||
laws_sanity_check()
|
||||
laws.add_supplied_law(number, law)
|
||||
post_lawchange(announce)
|
||||
|
||||
/mob/living/silicon/proc/clear_supplied_laws(announce = TRUE)
|
||||
laws_sanity_check()
|
||||
laws.clear_supplied_laws()
|
||||
post_lawchange(announce)
|
||||
|
||||
/mob/living/silicon/proc/add_ion_law(law, announce = TRUE)
|
||||
laws_sanity_check()
|
||||
laws.add_ion_law(law)
|
||||
post_lawchange(announce)
|
||||
|
||||
/mob/living/silicon/proc/replace_random_law(law, groups, announce = TRUE)
|
||||
laws_sanity_check()
|
||||
. = laws.replace_random_law(law,groups)
|
||||
post_lawchange(announce)
|
||||
|
||||
/mob/living/silicon/proc/shuffle_laws(list/groups, announce = TRUE)
|
||||
laws_sanity_check()
|
||||
laws.shuffle_laws(groups)
|
||||
post_lawchange(announce)
|
||||
|
||||
/mob/living/silicon/proc/remove_law(number, announce = TRUE)
|
||||
laws_sanity_check()
|
||||
. = laws.remove_law(number)
|
||||
post_lawchange(announce)
|
||||
|
||||
/mob/living/silicon/proc/clear_ion_laws(announce = TRUE)
|
||||
laws_sanity_check()
|
||||
laws.clear_ion_laws()
|
||||
post_lawchange(announce)
|
||||
|
||||
/mob/living/silicon/proc/make_laws()
|
||||
laws = new /datum/ai_laws
|
||||
laws.set_laws_config()
|
||||
laws.associate(src)
|
||||
|
||||
/mob/living/silicon/proc/clear_zeroth_law(force, announce = TRUE)
|
||||
laws_sanity_check()
|
||||
laws.clear_zeroth_law(force)
|
||||
post_lawchange(announce)
|
||||
|
||||
/mob/living/silicon/proc/clear_law_sixsixsix(force, announce = TRUE)
|
||||
laws_sanity_check()
|
||||
laws.clear_law_sixsixsix(force)
|
||||
post_lawchange(announce)
|
||||
@@ -43,12 +43,24 @@
|
||||
var/datum/ai_laws/master = connected_ai ? connected_ai.laws : null
|
||||
var/temp
|
||||
if (master)
|
||||
laws.devillaws.len = master.devillaws.len
|
||||
for (var/index = 1, index <= master.devillaws.len, index++)
|
||||
temp = master.devillaws[index]
|
||||
if (length(temp) > 0)
|
||||
laws.devillaws[index] = temp
|
||||
|
||||
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
|
||||
|
||||
laws.hacked.len = master.hacked.len
|
||||
for (var/index = 1, index <= master.hacked.len, index++)
|
||||
temp = master.hacked[index]
|
||||
if (length(temp) > 0)
|
||||
laws.hacked[index] = temp
|
||||
|
||||
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
|
||||
@@ -66,4 +78,4 @@
|
||||
temp = master.supplied[index]
|
||||
if (length(temp) > 0)
|
||||
laws.supplied[index] = temp
|
||||
return
|
||||
return
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
var/lawcheck[1]
|
||||
var/ioncheck[1]
|
||||
var/hackedcheck[1]
|
||||
var/devillawcheck[5]
|
||||
|
||||
var/sensors_on = 0
|
||||
@@ -182,6 +183,15 @@
|
||||
ioncheck[L] = "Yes"
|
||||
checklaws()
|
||||
|
||||
if (href_list["lawh"])
|
||||
var/L = text2num(href_list["lawh"])
|
||||
switch(hackedcheck[L])
|
||||
if ("Yes")
|
||||
hackedcheck[L] = "No"
|
||||
if ("No")
|
||||
hackedcheck[L] = "Yes"
|
||||
checklaws()
|
||||
|
||||
if (href_list["lawdevil"]) // Toggling whether or not a law gets stated by the State Laws verb --NeoFite
|
||||
var/L = text2num(href_list["lawdevil"])
|
||||
switch(devillawcheck[L])
|
||||
@@ -201,48 +211,56 @@
|
||||
/mob/living/silicon/proc/statelaws(force = 0)
|
||||
|
||||
//"radiomod" is inserted before a hardcoded message to change if and how it is handled by an internal radio.
|
||||
src.say("[radiomod] Current Active Laws:")
|
||||
//src.laws_sanity_check()
|
||||
//src.laws.show_laws(world)
|
||||
say("[radiomod] Current Active Laws:")
|
||||
//laws_sanity_check()
|
||||
//laws.show_laws(world)
|
||||
var/number = 1
|
||||
sleep(10)
|
||||
|
||||
if (src.laws.devillaws && src.laws.devillaws.len)
|
||||
for(var/index = 1, index <= src.laws.devillaws.len, index++)
|
||||
if (force || src.devillawcheck[index] == "Yes")
|
||||
src.say("[radiomod] 666. [src.laws.devillaws[index]]")
|
||||
if (laws.devillaws && laws.devillaws.len)
|
||||
for(var/index = 1, index <= laws.devillaws.len, index++)
|
||||
if (force || devillawcheck[index] == "Yes")
|
||||
say("[radiomod] 666. [laws.devillaws[index]]")
|
||||
sleep(10)
|
||||
|
||||
|
||||
if (src.laws.zeroth)
|
||||
if (force || src.lawcheck[1] == "Yes")
|
||||
src.say("[radiomod] 0. [src.laws.zeroth]")
|
||||
if (laws.zeroth)
|
||||
if (force || lawcheck[1] == "Yes")
|
||||
say("[radiomod] 0. [laws.zeroth]")
|
||||
sleep(10)
|
||||
|
||||
for (var/index = 1, index <= src.laws.ion.len, index++)
|
||||
var/law = src.laws.ion[index]
|
||||
for (var/index = 1, index <= laws.hacked.len, index++)
|
||||
var/law = laws.hacked[index]
|
||||
var/num = ionnum()
|
||||
if (length(law) > 0)
|
||||
if (force || src.ioncheck[index] == "Yes")
|
||||
src.say("[radiomod] [num]. [law]")
|
||||
if (force || hackedcheck[index] == "Yes")
|
||||
say("[radiomod] [num]. [law]")
|
||||
sleep(10)
|
||||
|
||||
for (var/index = 1, index <= src.laws.inherent.len, index++)
|
||||
var/law = src.laws.inherent[index]
|
||||
for (var/index = 1, index <= laws.ion.len, index++)
|
||||
var/law = laws.ion[index]
|
||||
var/num = ionnum()
|
||||
if (length(law) > 0)
|
||||
if (force || ioncheck[index] == "Yes")
|
||||
say("[radiomod] [num]. [law]")
|
||||
sleep(10)
|
||||
|
||||
for (var/index = 1, index <= laws.inherent.len, index++)
|
||||
var/law = laws.inherent[index]
|
||||
|
||||
if (length(law) > 0)
|
||||
if (force || src.lawcheck[index+1] == "Yes")
|
||||
src.say("[radiomod] [number]. [law]")
|
||||
if (force || lawcheck[index+1] == "Yes")
|
||||
say("[radiomod] [number]. [law]")
|
||||
number++
|
||||
sleep(10)
|
||||
|
||||
for (var/index = 1, index <= src.laws.supplied.len, index++)
|
||||
var/law = src.laws.supplied[index]
|
||||
for (var/index = 1, index <= laws.supplied.len, index++)
|
||||
var/law = laws.supplied[index]
|
||||
|
||||
if (length(law) > 0)
|
||||
if(src.lawcheck.len >= number+1)
|
||||
if (force || src.lawcheck[number+1] == "Yes")
|
||||
src.say("[radiomod] [number]. [law]")
|
||||
if(lawcheck.len >= number+1)
|
||||
if (force || lawcheck[number+1] == "Yes")
|
||||
say("[radiomod] [number]. [law]")
|
||||
number++
|
||||
sleep(10)
|
||||
|
||||
@@ -251,45 +269,53 @@
|
||||
|
||||
var/list = "<b>Which laws do you want to include when stating them for the crew?</b><br><br>"
|
||||
|
||||
if (src.laws.devillaws && src.laws.devillaws.len)
|
||||
for(var/index = 1, index <= src.laws.devillaws.len, index++)
|
||||
if (!src.devillawcheck[index])
|
||||
src.devillawcheck[index] = "No"
|
||||
list += {"<A href='byond://?src=[REF(src)];lawdevil=[index]'>[src.devillawcheck[index]] 666:</A> [src.laws.devillaws[index]]<BR>"}
|
||||
if (laws.devillaws && laws.devillaws.len)
|
||||
for(var/index = 1, index <= laws.devillaws.len, index++)
|
||||
if (!devillawcheck[index])
|
||||
devillawcheck[index] = "No"
|
||||
list += {"<A href='byond://?src=[REF(src)];lawdevil=[index]'>[devillawcheck[index]] 666:</A> <font color='#cc5500'>[laws.devillaws[index]]</font><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>"}
|
||||
if (laws.zeroth)
|
||||
if (!lawcheck[1])
|
||||
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'>[lawcheck[1]] 0:</A> <font color='#ff0000'><b>[laws.zeroth]</b></font><BR>"}
|
||||
|
||||
for (var/index = 1, index <= src.laws.ion.len, index++)
|
||||
var/law = src.laws.ion[index]
|
||||
for (var/index = 1, index <= laws.hacked.len, index++)
|
||||
var/law = laws.hacked[index]
|
||||
if (length(law) > 0)
|
||||
if (!hackedcheck[index])
|
||||
hackedcheck[index] = "No"
|
||||
list += {"<A href='byond://?src=[REF(src)];lawh=[index]'>[hackedcheck[index]] [ionnum()]:</A> <font color='#660000'>[law]</font><BR>"}
|
||||
hackedcheck.len += 1
|
||||
|
||||
for (var/index = 1, index <= laws.ion.len, index++)
|
||||
var/law = 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
|
||||
if (!ioncheck[index])
|
||||
ioncheck[index] = "Yes"
|
||||
list += {"<A href='byond://?src=[REF(src)];lawi=[index]'>[ioncheck[index]] [ionnum()]:</A> <font color='#547DFE'>[law]</font><BR>"}
|
||||
ioncheck.len += 1
|
||||
|
||||
var/number = 1
|
||||
for (var/index = 1, index <= src.laws.inherent.len, index++)
|
||||
var/law = src.laws.inherent[index]
|
||||
for (var/index = 1, index <= laws.inherent.len, index++)
|
||||
var/law = laws.inherent[index]
|
||||
|
||||
if (length(law) > 0)
|
||||
src.lawcheck.len += 1
|
||||
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>"}
|
||||
if (!lawcheck[number+1])
|
||||
lawcheck[number+1] = "Yes"
|
||||
list += {"<A href='byond://?src=[REF(src)];lawc=[number]'>[lawcheck[number+1]] [number]:</A> [law]<BR>"}
|
||||
number++
|
||||
|
||||
for (var/index = 1, index <= src.laws.supplied.len, index++)
|
||||
var/law = src.laws.supplied[index]
|
||||
for (var/index = 1, index <= laws.supplied.len, index++)
|
||||
var/law = 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>"}
|
||||
lawcheck.len += 1
|
||||
if (!lawcheck[number+1])
|
||||
lawcheck[number+1] = "Yes"
|
||||
list += {"<A href='byond://?src=[REF(src)];lawc=[number]'>[lawcheck[number+1]] [number]:</A> <font color='#990099'>[law]</font><BR>"}
|
||||
number++
|
||||
list += {"<br><br><A href='byond://?src=[REF(src)];laws=1'>State Laws</A>"}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user