mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-28 11:03:19 +00:00
Code refactoring
AIs and borgs now share law statement procs, rather than have 95% identical code variants. Improved handling available law-statement channels. Now lists all available radio channels + any additional variants (such as "Binary", "Holopad", etc.) Fixes a bug where synths could not state laws on the binary channel due to improper return-value.
This commit is contained in:
@@ -1016,6 +1016,7 @@
|
|||||||
#include "code\modules\mob\living\carbon\monkey\update_icons.dm"
|
#include "code\modules\mob\living\carbon\monkey\update_icons.dm"
|
||||||
#include "code\modules\mob\living\silicon\alarm.dm"
|
#include "code\modules\mob\living\silicon\alarm.dm"
|
||||||
#include "code\modules\mob\living\silicon\death.dm"
|
#include "code\modules\mob\living\silicon\death.dm"
|
||||||
|
#include "code\modules\mob\living\silicon\laws.dm"
|
||||||
#include "code\modules\mob\living\silicon\login.dm"
|
#include "code\modules\mob\living\silicon\login.dm"
|
||||||
#include "code\modules\mob\living\silicon\say.dm"
|
#include "code\modules\mob\living\silicon\say.dm"
|
||||||
#include "code\modules\mob\living\silicon\silicon.dm"
|
#include "code\modules\mob\living\silicon\silicon.dm"
|
||||||
|
|||||||
@@ -44,6 +44,21 @@ var/list/department_radio_keys = list(
|
|||||||
":<3A>" = "Supply", "#<23>" = "Supply", ".<2E>" = "Supply",
|
":<3A>" = "Supply", "#<23>" = "Supply", ".<2E>" = "Supply",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
var/list/channel_to_radio_key = new
|
||||||
|
proc/get_radio_key_from_channel(var/channel)
|
||||||
|
var/key = channel_to_radio_key[channel]
|
||||||
|
if(!key)
|
||||||
|
for(var/radio_key in department_radio_keys)
|
||||||
|
if(department_radio_keys[radio_key] == channel)
|
||||||
|
key = radio_key
|
||||||
|
break
|
||||||
|
if(!key)
|
||||||
|
key = ""
|
||||||
|
channel_to_radio_key[channel] = key
|
||||||
|
|
||||||
|
return key
|
||||||
|
|
||||||
/mob/living/proc/binarycheck()
|
/mob/living/proc/binarycheck()
|
||||||
|
|
||||||
if (istype(src, /mob/living/silicon/pai))
|
if (istype(src, /mob/living/silicon/pai))
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ var/list/ai_verbs_default = list(
|
|||||||
/mob/living/silicon/ai/proc/ai_roster,
|
/mob/living/silicon/ai/proc/ai_roster,
|
||||||
/mob/living/silicon/ai/proc/ai_statuschange,
|
/mob/living/silicon/ai/proc/ai_statuschange,
|
||||||
/mob/living/silicon/ai/proc/ai_store_location,
|
/mob/living/silicon/ai/proc/ai_store_location,
|
||||||
/mob/living/silicon/ai/proc/checklaws,
|
/mob/living/silicon/ai/proc/ai_checklaws,
|
||||||
/mob/living/silicon/ai/proc/control_integrated_radio,
|
/mob/living/silicon/ai/proc/control_integrated_radio,
|
||||||
/mob/living/silicon/ai/proc/core,
|
/mob/living/silicon/ai/proc/core,
|
||||||
/mob/living/silicon/ai/proc/pick_icon,
|
/mob/living/silicon/ai/proc/pick_icon,
|
||||||
@@ -49,11 +49,7 @@ var/list/ai_verbs_default = list(
|
|||||||
var/obj/machinery/camera/camera = null
|
var/obj/machinery/camera/camera = null
|
||||||
var/list/connected_robots = list()
|
var/list/connected_robots = list()
|
||||||
var/aiRestorePowerRoutine = 0
|
var/aiRestorePowerRoutine = 0
|
||||||
//var/list/laws = list()
|
|
||||||
var/viewalerts = 0
|
var/viewalerts = 0
|
||||||
var/lawcheck[1]
|
|
||||||
var/ioncheck[1]
|
|
||||||
var/lawchannel = "Common" // Default channel on which to state laws
|
|
||||||
var/icon/holo_icon//Default is assigned when AI is created.
|
var/icon/holo_icon//Default is assigned when AI is created.
|
||||||
var/obj/item/device/pda/ai/aiPDA = null
|
var/obj/item/device/pda/ai/aiPDA = null
|
||||||
var/obj/item/device/multitool/aiMulti = null
|
var/obj/item/device/multitool/aiMulti = null
|
||||||
@@ -121,7 +117,11 @@ var/list/ai_verbs_default = list(
|
|||||||
|
|
||||||
aiMulti = new(src)
|
aiMulti = new(src)
|
||||||
aiRadio = new(src)
|
aiRadio = new(src)
|
||||||
|
common_radio = aiRadio
|
||||||
aiRadio.myAi = src
|
aiRadio.myAi = src
|
||||||
|
additional_law_channels += "Binary"
|
||||||
|
additional_law_channels += "Holopad"
|
||||||
|
|
||||||
aiCamera = new/obj/item/device/camera/siliconcam/ai_camera(src)
|
aiCamera = new/obj/item/device/camera/siliconcam/ai_camera(src)
|
||||||
|
|
||||||
if (istype(loc, /turf))
|
if (istype(loc, /turf))
|
||||||
@@ -152,7 +152,7 @@ var/list/ai_verbs_default = list(
|
|||||||
src << "To use something, simply click on it."
|
src << "To use something, simply click on it."
|
||||||
src << "Use say :b to speak to your cyborgs through binary."
|
src << "Use say :b to speak to your cyborgs through binary."
|
||||||
src << "For department channels, use the following say commands:"
|
src << "For department channels, use the following say commands:"
|
||||||
src << ":o AI Private, :c - Command, :s - Security, :e - Engineering, :u - Supply, :m - Medical, :n - Science."
|
src << ":o - AI Private, :c - Command, :s - Security, :e - Engineering, :u - Supply, :m - Medical, :n - Science."
|
||||||
if (!(ticker && ticker.mode && (mind in ticker.mode.malf_ai)))
|
if (!(ticker && ticker.mode && (mind in ticker.mode.malf_ai)))
|
||||||
show_laws()
|
show_laws()
|
||||||
src << "<b>These laws may be changed by other players, or by you being the traitor.</b>"
|
src << "<b>These laws may be changed by other players, or by you being the traitor.</b>"
|
||||||
@@ -429,7 +429,8 @@ var/list/ai_verbs_default = list(
|
|||||||
/mob/living/silicon/ai/Topic(href, href_list)
|
/mob/living/silicon/ai/Topic(href, href_list)
|
||||||
if(usr != src)
|
if(usr != src)
|
||||||
return
|
return
|
||||||
..()
|
if(..())
|
||||||
|
return
|
||||||
if (href_list["mach_close"])
|
if (href_list["mach_close"])
|
||||||
if (href_list["mach_close"] == "aialerts")
|
if (href_list["mach_close"] == "aialerts")
|
||||||
viewalerts = 0
|
viewalerts = 0
|
||||||
@@ -457,13 +458,6 @@ var/list/ai_verbs_default = list(
|
|||||||
// src << text ("Switching Law [L]'s report status to []", lawcheck[L+1])
|
// src << text ("Switching Law [L]'s report status to []", lawcheck[L+1])
|
||||||
checklaws()
|
checklaws()
|
||||||
|
|
||||||
if (href_list["lawr"]) // Selects on which channel to state laws
|
|
||||||
var/setchannel = input(usr, "Specify channel.", "Channel selection") in list("State","Common","Science","Command","Medical","Engineering","Security","Supply","Binary","Private","Holopad", "Cancel")
|
|
||||||
if(setchannel == "Cancel")
|
|
||||||
return
|
|
||||||
lawchannel = setchannel
|
|
||||||
checklaws()
|
|
||||||
|
|
||||||
if (href_list["lawi"]) // Toggling whether or not a law gets stated by the State Laws verb --NeoFite
|
if (href_list["lawi"]) // Toggling whether or not a law gets stated by the State Laws verb --NeoFite
|
||||||
var/L = text2num(href_list["lawi"])
|
var/L = text2num(href_list["lawi"])
|
||||||
switch(ioncheck[L])
|
switch(ioncheck[L])
|
||||||
|
|||||||
@@ -15,22 +15,6 @@
|
|||||||
src.laws_sanity_check()
|
src.laws_sanity_check()
|
||||||
src.laws.show_laws(who)
|
src.laws.show_laws(who)
|
||||||
|
|
||||||
/mob/living/silicon/ai/proc/laws_sanity_check()
|
|
||||||
if (!src.laws)
|
|
||||||
src.laws = new base_law_type
|
|
||||||
|
|
||||||
/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/add_inherent_law(var/law)
|
|
||||||
src.laws_sanity_check()
|
|
||||||
src.laws.add_inherent_law(law)
|
|
||||||
|
|
||||||
/mob/living/silicon/ai/proc/clear_inherent_laws()
|
|
||||||
src.laws_sanity_check()
|
|
||||||
src.laws.clear_inherent_laws()
|
|
||||||
|
|
||||||
/mob/living/silicon/ai/proc/add_ion_law(var/law)
|
/mob/living/silicon/ai/proc/add_ion_law(var/law)
|
||||||
src.laws_sanity_check()
|
src.laws_sanity_check()
|
||||||
src.laws.add_ion_law(law)
|
src.laws.add_ion_law(law)
|
||||||
@@ -38,121 +22,7 @@
|
|||||||
if(R.lawupdate && (R.connected_ai == src))
|
if(R.lawupdate && (R.connected_ai == src))
|
||||||
R << "\red " + law + "\red...LAWS UPDATED"
|
R << "\red " + law + "\red...LAWS UPDATED"
|
||||||
|
|
||||||
/mob/living/silicon/ai/proc/clear_ion_laws()
|
/mob/living/silicon/ai/proc/ai_checklaws()
|
||||||
src.laws_sanity_check()
|
|
||||||
src.laws.clear_ion_laws()
|
|
||||||
|
|
||||||
/mob/living/silicon/ai/proc/add_supplied_law(var/number, var/law)
|
|
||||||
src.laws_sanity_check()
|
|
||||||
src.laws.add_supplied_law(number, law)
|
|
||||||
|
|
||||||
/mob/living/silicon/ai/proc/clear_supplied_laws()
|
|
||||||
src.laws_sanity_check()
|
|
||||||
src.laws.clear_supplied_laws()
|
|
||||||
|
|
||||||
/mob/living/silicon/ai/proc/statelaws() // -- TLE
|
|
||||||
// set category = "AI Commands"
|
|
||||||
// set name = "State Laws"
|
|
||||||
/var/prefix = ""
|
|
||||||
switch(lawchannel)
|
|
||||||
if("Common") prefix = ";"
|
|
||||||
if("Science") prefix = ":n "
|
|
||||||
if("Command") prefix = ":c "
|
|
||||||
if("Medical") prefix = ":m "
|
|
||||||
if("Engineering") prefix = ":e "
|
|
||||||
if("Security") prefix = ":s "
|
|
||||||
if("Supply") prefix = ":u "
|
|
||||||
if("Binary") prefix = ":b "
|
|
||||||
if("Private") prefix = ":o "
|
|
||||||
if("Holopad") prefix = ":h "
|
|
||||||
else prefix = ""
|
|
||||||
|
|
||||||
if(src.say("[prefix]Current Active Laws:") != 1)
|
|
||||||
return
|
|
||||||
|
|
||||||
//src.laws_sanity_check()
|
|
||||||
//src.laws.show_laws(world)
|
|
||||||
var/number = 1
|
|
||||||
sleep(10)
|
|
||||||
|
|
||||||
if (src.laws.zeroth)
|
|
||||||
if (src.lawcheck[1] == "Yes") //This line and the similar lines below make sure you don't state a law unless you want to. --NeoFite
|
|
||||||
src.say("[prefix]0. [src.laws.zeroth]")
|
|
||||||
sleep(10)
|
|
||||||
|
|
||||||
for (var/index = 1, index <= src.laws.ion.len, index++)
|
|
||||||
var/law = src.laws.ion[index]
|
|
||||||
var/num = ionnum()
|
|
||||||
if (length(law) > 0)
|
|
||||||
if (src.ioncheck[index] == "Yes")
|
|
||||||
src.say("[prefix][num]. [law]")
|
|
||||||
sleep(10)
|
|
||||||
|
|
||||||
for (var/index = 1, index <= src.laws.inherent.len, index++)
|
|
||||||
var/law = src.laws.inherent[index]
|
|
||||||
|
|
||||||
if (length(law) > 0)
|
|
||||||
if (src.lawcheck[index+1] == "Yes")
|
|
||||||
src.say("[prefix][number]. [law]")
|
|
||||||
sleep(10)
|
|
||||||
number++
|
|
||||||
|
|
||||||
for (var/index = 1, index <= src.laws.supplied.len, index++)
|
|
||||||
var/law = src.laws.supplied[index]
|
|
||||||
|
|
||||||
if (length(law) > 0)
|
|
||||||
if(src.lawcheck.len >= number+1)
|
|
||||||
if (src.lawcheck[number+1] == "Yes")
|
|
||||||
src.say("[prefix][number]. [law]")
|
|
||||||
sleep(10)
|
|
||||||
number++
|
|
||||||
|
|
||||||
/mob/living/silicon/ai/proc/checklaws() //Gives you a link-driven interface for deciding what laws the statelaws() proc will share with the crew. --NeoFite
|
|
||||||
set category = "AI Commands"
|
set category = "AI Commands"
|
||||||
set name = "State Laws"
|
set name = "State Laws"
|
||||||
|
checklaws()
|
||||||
var/list = "<b>Which laws do you want to include when stating them for the crew?</b><br><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>"}
|
|
||||||
|
|
||||||
for (var/index = 1, index <= src.laws.ion.len, index++)
|
|
||||||
var/law = src.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
|
|
||||||
|
|
||||||
var/number = 1
|
|
||||||
for (var/index = 1, index <= src.laws.inherent.len, index++)
|
|
||||||
var/law = src.laws.inherent[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>"}
|
|
||||||
number++
|
|
||||||
|
|
||||||
for (var/index = 1, index <= src.laws.supplied.len, index++)
|
|
||||||
var/law = src.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>"}
|
|
||||||
number++
|
|
||||||
|
|
||||||
list += {"<br><A href='byond://?src=\ref[src];lawr=1'>Channel: [src.lawchannel]</A><br>"}
|
|
||||||
list += {"<A href='byond://?src=\ref[src];laws=1'>State Laws</A>"}
|
|
||||||
|
|
||||||
usr << browse(list, "window=laws")
|
|
||||||
|
|||||||
128
code/modules/mob/living/silicon/laws.dm
Normal file
128
code/modules/mob/living/silicon/laws.dm
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
/mob/living/silicon/proc/laws_sanity_check()
|
||||||
|
if (!src.laws)
|
||||||
|
laws = new base_law_type
|
||||||
|
|
||||||
|
/mob/living/silicon/proc/set_zeroth_law(var/law, var/law_borg)
|
||||||
|
laws_sanity_check()
|
||||||
|
laws.set_zeroth_law(law, law_borg)
|
||||||
|
|
||||||
|
/mob/living/silicon/proc/add_inherent_law(var/law)
|
||||||
|
laws_sanity_check()
|
||||||
|
laws.add_inherent_law(law)
|
||||||
|
|
||||||
|
/mob/living/silicon/proc/clear_inherent_laws()
|
||||||
|
laws_sanity_check()
|
||||||
|
laws.clear_inherent_laws()
|
||||||
|
|
||||||
|
/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)
|
||||||
|
laws_sanity_check()
|
||||||
|
laws.add_supplied_law(number, law)
|
||||||
|
|
||||||
|
/mob/living/silicon/proc/clear_supplied_laws()
|
||||||
|
laws_sanity_check()
|
||||||
|
laws.clear_supplied_laws()
|
||||||
|
|
||||||
|
/mob/living/silicon/proc/statelaws() // -- TLE
|
||||||
|
if(stating_laws)
|
||||||
|
src << "<span class='notice'>You are currently stating laws.</span>"
|
||||||
|
return
|
||||||
|
stating_laws = 1
|
||||||
|
|
||||||
|
var/prefix = ""
|
||||||
|
switch(lawchannel)
|
||||||
|
if(MAIN_CHANNEL) prefix = ";" // Apparently defines are not constant expressions?
|
||||||
|
if("Binary") prefix = ":b "
|
||||||
|
else
|
||||||
|
prefix = get_radio_key_from_channel(lawchannel == "Holopad" ? "department" : lawchannel) + " "
|
||||||
|
|
||||||
|
if(src.say("[prefix]Current Active Laws:") != 1)
|
||||||
|
return
|
||||||
|
|
||||||
|
//src.laws_sanity_check()
|
||||||
|
//src.laws.show_laws(world)
|
||||||
|
var/number = 1
|
||||||
|
sleep(10)
|
||||||
|
|
||||||
|
if (src.laws.zeroth)
|
||||||
|
if (src.lawcheck[1] == "Yes") //This line and the similar lines below make sure you don't state a law unless you want to. --NeoFite
|
||||||
|
src.say("[prefix]0. [src.laws.zeroth]")
|
||||||
|
sleep(10)
|
||||||
|
|
||||||
|
for (var/index = 1, index <= src.laws.ion.len, index++)
|
||||||
|
var/law = src.laws.ion[index]
|
||||||
|
var/num = ionnum()
|
||||||
|
if (length(law) > 0)
|
||||||
|
if (src.ioncheck[index] == "Yes")
|
||||||
|
src.say("[prefix][num]. [law]")
|
||||||
|
sleep(10)
|
||||||
|
|
||||||
|
for (var/index = 1, index <= src.laws.inherent.len, index++)
|
||||||
|
var/law = src.laws.inherent[index]
|
||||||
|
|
||||||
|
if (length(law) > 0)
|
||||||
|
if (src.lawcheck[index+1] == "Yes")
|
||||||
|
src.say("[prefix][number]. [law]")
|
||||||
|
sleep(10)
|
||||||
|
number++
|
||||||
|
|
||||||
|
for (var/index = 1, index <= src.laws.supplied.len, index++)
|
||||||
|
var/law = src.laws.supplied[index]
|
||||||
|
|
||||||
|
if (length(law) > 0)
|
||||||
|
if(src.lawcheck.len >= number+1)
|
||||||
|
if (src.lawcheck[number+1] == "Yes")
|
||||||
|
src.say("[prefix][number]. [law]")
|
||||||
|
sleep(10)
|
||||||
|
number++
|
||||||
|
|
||||||
|
stating_laws = 0
|
||||||
|
|
||||||
|
/mob/living/silicon/proc/checklaws() //Gives you a link-driven interface for deciding what laws the statelaws() proc will share with the crew. --NeoFite
|
||||||
|
var/list = "<b>Which laws do you want to include when stating them for the crew?</b><br><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>"}
|
||||||
|
|
||||||
|
for (var/index = 1, index <= src.laws.ion.len, index++)
|
||||||
|
var/law = src.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
|
||||||
|
|
||||||
|
var/number = 1
|
||||||
|
for (var/index = 1, index <= src.laws.inherent.len, index++)
|
||||||
|
var/law = src.laws.inherent[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>"}
|
||||||
|
number++
|
||||||
|
|
||||||
|
for (var/index = 1, index <= src.laws.supplied.len, index++)
|
||||||
|
var/law = src.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>"}
|
||||||
|
number++
|
||||||
|
|
||||||
|
list += {"<br><A href='byond://?src=\ref[src];lawr=1'>Channel: [src.lawchannel]</A><br>"}
|
||||||
|
list += {"<A href='byond://?src=\ref[src];laws=1'>State Laws</A>"}
|
||||||
|
|
||||||
|
usr << browse(list, "window=laws")
|
||||||
@@ -69,113 +69,11 @@
|
|||||||
laws.supplied[index] = temp
|
laws.supplied[index] = temp
|
||||||
return
|
return
|
||||||
|
|
||||||
/mob/living/silicon/robot/proc/laws_sanity_check()
|
|
||||||
if (!laws)
|
|
||||||
laws = new base_law_type
|
|
||||||
|
|
||||||
/mob/living/silicon/robot/proc/set_zeroth_law(var/law)
|
|
||||||
laws_sanity_check()
|
|
||||||
laws.set_zeroth_law(law)
|
|
||||||
|
|
||||||
/mob/living/silicon/robot/proc/add_inherent_law(var/law)
|
|
||||||
laws_sanity_check()
|
|
||||||
laws.add_inherent_law(law)
|
|
||||||
|
|
||||||
/mob/living/silicon/robot/proc/clear_inherent_laws()
|
|
||||||
laws_sanity_check()
|
|
||||||
laws.clear_inherent_laws()
|
|
||||||
|
|
||||||
/mob/living/silicon/robot/proc/add_supplied_law(var/number, var/law)
|
|
||||||
laws_sanity_check()
|
|
||||||
laws.add_supplied_law(number, law)
|
|
||||||
|
|
||||||
/mob/living/silicon/robot/proc/clear_supplied_laws()
|
|
||||||
laws_sanity_check()
|
|
||||||
laws.clear_supplied_laws()
|
|
||||||
|
|
||||||
/mob/living/silicon/robot/proc/add_ion_law(var/law)
|
/mob/living/silicon/robot/proc/add_ion_law(var/law)
|
||||||
laws_sanity_check()
|
laws_sanity_check()
|
||||||
laws.add_ion_law(law)
|
laws.add_ion_law(law)
|
||||||
|
|
||||||
/mob/living/silicon/robot/proc/clear_ion_laws()
|
/mob/living/silicon/robot/proc/robot_checklaws() //Gives you a link-driven interface for deciding what laws the statelaws() proc will share with the crew. --NeoFite
|
||||||
laws_sanity_check()
|
|
||||||
laws.clear_ion_laws()
|
|
||||||
|
|
||||||
/mob/living/silicon/robot/proc/statelaws() // -- TLE
|
|
||||||
// set category = "AI Commands"
|
|
||||||
// set name = "State Laws"
|
|
||||||
src.say("Current Active Laws:")
|
|
||||||
//src.laws_sanity_check()
|
|
||||||
//src.laws.show_laws(world)
|
|
||||||
var/number = 1
|
|
||||||
sleep(10)
|
|
||||||
|
|
||||||
if (src.laws.zeroth)
|
|
||||||
if (src.lawcheck[1] == "Yes") //This line and the similar lines below make sure you don't state a law unless you want to. --NeoFite
|
|
||||||
src.say("0. [src.laws.zeroth]")
|
|
||||||
sleep(10)
|
|
||||||
|
|
||||||
for (var/index = 1, index <= src.laws.ion.len, index++)
|
|
||||||
var/law = src.laws.ion[index]
|
|
||||||
var/num = ionnum()
|
|
||||||
if (length(law) > 0)
|
|
||||||
if (src.ioncheck[index] == "Yes")
|
|
||||||
src.say("[num]. [law]")
|
|
||||||
sleep(10)
|
|
||||||
|
|
||||||
for (var/index = 1, index <= src.laws.inherent.len, index++)
|
|
||||||
var/law = src.laws.inherent[index]
|
|
||||||
if (length(law) > 0)
|
|
||||||
if (src.lawcheck[index+1] == "Yes")
|
|
||||||
src.say("[number]. [law]")
|
|
||||||
sleep(10)
|
|
||||||
number++
|
|
||||||
|
|
||||||
for (var/index = 1, index <= src.laws.supplied.len, index++)
|
|
||||||
var/law = src.laws.supplied[index]
|
|
||||||
|
|
||||||
if (length(law) > 0)
|
|
||||||
if(src.lawcheck.len >= number+1)
|
|
||||||
if (src.lawcheck[number+1] == "Yes")
|
|
||||||
src.say("[number]. [law]")
|
|
||||||
sleep(10)
|
|
||||||
number++
|
|
||||||
|
|
||||||
/mob/living/silicon/robot/verb/checklaws() //Gives you a link-driven interface for deciding what laws the statelaws() proc will share with the crew. --NeoFite
|
|
||||||
set category = "Robot Commands"
|
set category = "Robot Commands"
|
||||||
set name = "State Laws"
|
set name = "State Laws"
|
||||||
var/list = "<b>Which laws do you want to include when stating them for the crew?</b><br><br>"
|
checklaws()
|
||||||
|
|
||||||
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>"}
|
|
||||||
|
|
||||||
for (var/index = 1, index <= src.laws.ion.len, index++)
|
|
||||||
var/law = src.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
|
|
||||||
|
|
||||||
var/number = 1
|
|
||||||
for (var/index = 1, index <= src.laws.inherent.len, index++)
|
|
||||||
var/law = src.laws.inherent[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>"}
|
|
||||||
number++
|
|
||||||
|
|
||||||
for (var/index = 1, index <= src.laws.supplied.len, index++)
|
|
||||||
var/law = src.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>"}
|
|
||||||
number++
|
|
||||||
list += {"<br><br><A href='byond://?src=\ref[src];laws=1'>State Laws</A>"}
|
|
||||||
usr << browse(list, "window=laws")
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
var/list/robot_verbs_default = list(
|
var/list/robot_verbs_default = list(
|
||||||
/mob/living/silicon/robot/proc/sensor_mode
|
/mob/living/silicon/robot/proc/sensor_mode,
|
||||||
|
/mob/living/silicon/robot/proc/robot_checklaws
|
||||||
)
|
)
|
||||||
|
|
||||||
#define CYBORG_POWER_USAGE_MULTIPLIER 2.5 // Multiplier for amount of power cyborgs use.
|
#define CYBORG_POWER_USAGE_MULTIPLIER 2.5 // Multiplier for amount of power cyborgs use.
|
||||||
@@ -68,8 +69,6 @@ var/list/robot_verbs_default = list(
|
|||||||
var/weapon_lock = 0
|
var/weapon_lock = 0
|
||||||
var/weaponlock_time = 120
|
var/weaponlock_time = 120
|
||||||
var/lawupdate = 1 //Cyborgs will sync their laws with their AI by default
|
var/lawupdate = 1 //Cyborgs will sync their laws with their AI by default
|
||||||
var/lawcheck[1] //For stating laws.
|
|
||||||
var/ioncheck[1] //Ditto.
|
|
||||||
var/lockcharge //Used when locking down a borg to preserve cell charge
|
var/lockcharge //Used when locking down a borg to preserve cell charge
|
||||||
var/speed = 0 //Cause sec borgs gotta go fast //No they dont!
|
var/speed = 0 //Cause sec borgs gotta go fast //No they dont!
|
||||||
var/scrambledcodes = 0 // Used to determine if a borg shows up on the robotics console. Setting to one hides them.
|
var/scrambledcodes = 0 // Used to determine if a borg shows up on the robotics console. Setting to one hides them.
|
||||||
@@ -102,6 +101,7 @@ var/list/robot_verbs_default = list(
|
|||||||
init()
|
init()
|
||||||
|
|
||||||
radio = new /obj/item/device/radio/borg(src)
|
radio = new /obj/item/device/radio/borg(src)
|
||||||
|
common_radio = radio
|
||||||
if(!scrambledcodes && !camera)
|
if(!scrambledcodes && !camera)
|
||||||
camera = new /obj/machinery/camera(src)
|
camera = new /obj/machinery/camera(src)
|
||||||
camera.c_tag = real_name
|
camera.c_tag = real_name
|
||||||
@@ -143,6 +143,7 @@ var/list/robot_verbs_default = list(
|
|||||||
/mob/living/silicon/robot/proc/init()
|
/mob/living/silicon/robot/proc/init()
|
||||||
aiCamera = new/obj/item/device/camera/siliconcam/robot_camera(src)
|
aiCamera = new/obj/item/device/camera/siliconcam/robot_camera(src)
|
||||||
laws = new /datum/ai_laws/nanotrasen()
|
laws = new /datum/ai_laws/nanotrasen()
|
||||||
|
additional_law_channels += "Binary"
|
||||||
connected_ai = select_active_ai_with_fewest_borgs()
|
connected_ai = select_active_ai_with_fewest_borgs()
|
||||||
if(connected_ai)
|
if(connected_ai)
|
||||||
connected_ai.connected_robots += src
|
connected_ai.connected_robots += src
|
||||||
@@ -1074,10 +1075,10 @@ var/list/robot_verbs_default = list(
|
|||||||
|
|
||||||
|
|
||||||
/mob/living/silicon/robot/Topic(href, href_list)
|
/mob/living/silicon/robot/Topic(href, href_list)
|
||||||
..()
|
|
||||||
|
|
||||||
if(usr != src)
|
if(usr != src)
|
||||||
return
|
return
|
||||||
|
if(..())
|
||||||
|
return
|
||||||
|
|
||||||
if (href_list["showalerts"])
|
if (href_list["showalerts"])
|
||||||
robot_alerts()
|
robot_alerts()
|
||||||
|
|||||||
@@ -76,7 +76,7 @@
|
|||||||
|
|
||||||
if(speaking.flags & HIVEMIND)
|
if(speaking.flags & HIVEMIND)
|
||||||
speaking.broadcast(src,trim(message))
|
speaking.broadcast(src,trim(message))
|
||||||
return
|
return 1
|
||||||
|
|
||||||
// Currently used by drones.
|
// Currently used by drones.
|
||||||
if(local_transmit)
|
if(local_transmit)
|
||||||
@@ -92,11 +92,11 @@
|
|||||||
continue
|
continue
|
||||||
else if(M.stat == 2 && M.client.prefs.toggles & CHAT_GHOSTEARS)
|
else if(M.stat == 2 && M.client.prefs.toggles & CHAT_GHOSTEARS)
|
||||||
if(M.client) M << "<b>[src]</b> transmits, \"[message]\""
|
if(M.client) M << "<b>[src]</b> transmits, \"[message]\""
|
||||||
return
|
return 1
|
||||||
|
|
||||||
if(message_mode && bot_type == IS_ROBOT && !R.is_component_functioning("radio"))
|
if(message_mode && bot_type == IS_ROBOT && !R.is_component_functioning("radio"))
|
||||||
src << "\red Your radio isn't functional at this time."
|
src << "\red Your radio isn't functional at this time."
|
||||||
return
|
return 0
|
||||||
|
|
||||||
switch(message_mode)
|
switch(message_mode)
|
||||||
if("department")
|
if("department")
|
||||||
@@ -117,7 +117,7 @@
|
|||||||
if(IS_AI)
|
if(IS_AI)
|
||||||
if (AI.aiRadio.disabledAi || AI.aiRestorePowerRoutine || AI.stat)
|
if (AI.aiRadio.disabledAi || AI.aiRestorePowerRoutine || AI.stat)
|
||||||
src << "\red System Error - Transceiver Disabled"
|
src << "\red System Error - Transceiver Disabled"
|
||||||
return
|
return 0
|
||||||
else
|
else
|
||||||
log_say("[key_name(src)] : [message]")
|
log_say("[key_name(src)] : [message]")
|
||||||
AI.aiRadio.talk_into(src,message,null,verb,speaking)
|
AI.aiRadio.talk_into(src,message,null,verb,speaking)
|
||||||
@@ -135,7 +135,7 @@
|
|||||||
if(IS_AI)
|
if(IS_AI)
|
||||||
if (AI.aiRadio.disabledAi || AI.aiRestorePowerRoutine || AI.stat)
|
if (AI.aiRadio.disabledAi || AI.aiRestorePowerRoutine || AI.stat)
|
||||||
src << "\red System Error - Transceiver Disabled"
|
src << "\red System Error - Transceiver Disabled"
|
||||||
return
|
return 0
|
||||||
else
|
else
|
||||||
log_say("[key_name(src)] : [message]")
|
log_say("[key_name(src)] : [message]")
|
||||||
AI.aiRadio.talk_into(src,message,message_mode,verb,speaking)
|
AI.aiRadio.talk_into(src,message,message_mode,verb,speaking)
|
||||||
|
|||||||
@@ -3,6 +3,14 @@
|
|||||||
voice_name = "synthesized voice"
|
voice_name = "synthesized voice"
|
||||||
var/syndicate = 0
|
var/syndicate = 0
|
||||||
var/datum/ai_laws/laws = null//Now... THEY ALL CAN ALL HAVE LAWS
|
var/datum/ai_laws/laws = null//Now... THEY ALL CAN ALL HAVE LAWS
|
||||||
|
var/list/additional_law_channels = list("State")
|
||||||
|
var/const/MAIN_CHANNEL = "Main Frequency"
|
||||||
|
var/lawchannel = MAIN_CHANNEL // Default channel on which to state laws
|
||||||
|
var/lawcheck[1]
|
||||||
|
var/ioncheck[1]
|
||||||
|
var/stating_laws = 0
|
||||||
|
var/obj/item/device/radio/common_radio
|
||||||
|
|
||||||
immune_to_ssd = 1
|
immune_to_ssd = 1
|
||||||
var/list/hud_list[9]
|
var/list/hud_list[9]
|
||||||
var/list/speech_synthesizer_langs = list() //which languages can be vocalized by the speech synthesizer
|
var/list/speech_synthesizer_langs = list() //which languages can be vocalized by the speech synthesizer
|
||||||
@@ -222,4 +230,24 @@
|
|||||||
flavor_text = copytext(sanitize(input(usr, "Please enter your new flavour text.", "Flavour text", null) as text), 1)
|
flavor_text = copytext(sanitize(input(usr, "Please enter your new flavour text.", "Flavour text", null) as text), 1)
|
||||||
|
|
||||||
/mob/living/silicon/binarycheck()
|
/mob/living/silicon/binarycheck()
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
/mob/living/silicon/Topic(href, href_list)
|
||||||
|
..()
|
||||||
|
|
||||||
|
if (href_list["lawr"]) // Selects on which channel to state laws
|
||||||
|
var/list/channels = list(MAIN_CHANNEL)
|
||||||
|
if(common_radio)
|
||||||
|
for (var/ch_name in common_radio.channels)
|
||||||
|
channels += ch_name
|
||||||
|
|
||||||
|
channels += additional_law_channels
|
||||||
|
channels += "Cancel"
|
||||||
|
|
||||||
|
var/setchannel = input(usr, "Specify channel.", "Channel selection") in channels
|
||||||
|
if(setchannel != "Cancel")
|
||||||
|
lawchannel = setchannel
|
||||||
|
checklaws()
|
||||||
|
return 1
|
||||||
|
|
||||||
|
return 0
|
||||||
|
|||||||
@@ -117,7 +117,7 @@
|
|||||||
O << "To use something, simply click on it."
|
O << "To use something, simply click on it."
|
||||||
O << {"Use say ":b to speak to your cyborgs through binary."}
|
O << {"Use say ":b to speak to your cyborgs through binary."}
|
||||||
O << "For department channels, use the following say commands:"
|
O << "For department channels, use the following say commands:"
|
||||||
O << ":o AI Private, :c - Command, :s - Security, :e - Engineering, :u - Supply, :m - Medical, :n - Science."
|
O << ":o - AI Private, :c - Command, :s - Security, :e - Engineering, :u - Supply, :m - Medical, :n - Science."
|
||||||
if (!(ticker && ticker.mode && (O.mind in ticker.mode.malf_ai)))
|
if (!(ticker && ticker.mode && (O.mind in ticker.mode.malf_ai)))
|
||||||
O.show_laws()
|
O.show_laws()
|
||||||
O << "<b>These laws may be changed by other players, or by you being the traitor.</b>"
|
O << "<b>These laws may be changed by other players, or by you being the traitor.</b>"
|
||||||
|
|||||||
Reference in New Issue
Block a user