mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-07-20 19:44:46 +01:00
Merge pull request #8486 from PsiOmegaDelta/NanoLaws
NanoUI - Silicon law manager
This commit is contained in:
@@ -47,6 +47,7 @@ var/list/admin_verbs_admin = list(
|
||||
/client/proc/check_words, /*displays cult-words*/
|
||||
/client/proc/check_ai_laws, /*shows AI and borg laws*/
|
||||
/client/proc/rename_silicon, /*properly renames silicons*/
|
||||
/client/proc/manage_silicon_laws, /* Allows viewing and editing silicon laws. */
|
||||
/client/proc/check_antagonists,
|
||||
/client/proc/admin_memo, /*admin memo system. show/delete/write. +SERVER needed to delete admin memos of others*/
|
||||
/client/proc/dsay, /*talk in deadchat using our ckey/fakekey*/
|
||||
@@ -716,7 +717,7 @@ var/list/admin_verbs_mentor = list(
|
||||
if(holder)
|
||||
src.holder.output_ai_laws()
|
||||
|
||||
/client/proc/rename_silicon(mob/living/silicon/S in world)
|
||||
/client/proc/rename_silicon(mob/living/silicon/S in mob_list)
|
||||
set name = "Rename Silicon"
|
||||
set category = "Admin"
|
||||
|
||||
@@ -730,6 +731,18 @@ var/list/admin_verbs_mentor = list(
|
||||
S.SetName(new_name)
|
||||
feedback_add_details("admin_verb","RAI") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
|
||||
/client/proc/manage_silicon_laws(mob/living/silicon/S in mob_list)
|
||||
set name = "Manage Silicon Laws"
|
||||
set category = "Admin"
|
||||
|
||||
if(!istype(S))
|
||||
return
|
||||
|
||||
if(holder)
|
||||
S.subsystem_law_manager()
|
||||
admin_log_and_message_admins("has opened [S]'s law manager.")
|
||||
feedback_add_details("admin_verb","MSL") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
|
||||
/client/proc/change_human_appearance_admin(mob/living/carbon/human/H in world)
|
||||
set name = "Change Mob Appearance - Admin"
|
||||
set desc = "Allows you to change the mob appearance"
|
||||
@@ -743,7 +756,7 @@ var/list/admin_verbs_mentor = list(
|
||||
H.change_appearance(APPEARANCE_ALL, usr, usr, check_species_whitelist = 0)
|
||||
feedback_add_details("admin_verb","CHAA") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
|
||||
/client/proc/change_human_appearance_self(mob/living/carbon/human/H in world)
|
||||
/client/proc/change_human_appearance_self(mob/living/carbon/human/H in mob_list)
|
||||
set name = "Change Mob Appearance - Self"
|
||||
set desc = "Allows the mob to change its appearance"
|
||||
set category = "Admin"
|
||||
@@ -776,7 +789,7 @@ var/list/admin_verbs_mentor = list(
|
||||
// feedback_add_details("admin_verb","MP") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
return
|
||||
|
||||
/client/proc/editappear(mob/living/carbon/human/M as mob in world)
|
||||
/client/proc/editappear(mob/living/carbon/human/M as mob in mob_list)
|
||||
set name = "Edit Appearance"
|
||||
set category = "Fun"
|
||||
|
||||
|
||||
@@ -80,10 +80,12 @@ var/list/ai_verbs_default = list(
|
||||
/mob/living/silicon/ai/proc/add_ai_verbs()
|
||||
src.verbs |= ai_verbs_default
|
||||
src.verbs |= ai_verbs_subsystems
|
||||
src.verbs |= silicon_verbs_subsystems
|
||||
|
||||
/mob/living/silicon/ai/proc/remove_ai_verbs()
|
||||
src.verbs -= ai_verbs_default
|
||||
src.verbs -= ai_verbs_subsystems
|
||||
src.verbs -= silicon_verbs_subsystems
|
||||
|
||||
/mob/living/silicon/ai/New(loc, var/datum/ai_laws/L, var/obj/item/device/mmi/B, var/safety = 0)
|
||||
announcement = new()
|
||||
@@ -428,25 +430,6 @@ var/list/ai_verbs_default = list(
|
||||
else
|
||||
src << "<span class='notice'>Unable to locate the holopad.</span>"
|
||||
|
||||
if (href_list["lawc"]) // Toggling whether or not a law gets stated by the State Laws verb --NeoFite
|
||||
var/L = text2num(href_list["lawc"])
|
||||
switch(lawcheck[L+1])
|
||||
if ("Yes") lawcheck[L+1] = "No"
|
||||
if ("No") lawcheck[L+1] = "Yes"
|
||||
// src << text ("Switching Law [L]'s report status to []", lawcheck[L+1])
|
||||
checklaws()
|
||||
|
||||
if (href_list["lawi"]) // Toggling whether or not a law gets stated by the State Laws verb --NeoFite
|
||||
var/L = text2num(href_list["lawi"])
|
||||
switch(ioncheck[L])
|
||||
if ("Yes") ioncheck[L] = "No"
|
||||
if ("No") ioncheck[L] = "Yes"
|
||||
// src << text ("Switching Law [L]'s report status to []", lawcheck[L+1])
|
||||
checklaws()
|
||||
|
||||
if (href_list["laws"]) // With how my law selection code works, I changed statelaws from a verb to a proc, and call it through my law selection panel. --NeoFite
|
||||
statelaws()
|
||||
|
||||
if (href_list["track"])
|
||||
var/mob/target = locate(href_list["track"]) in mob_list
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/mob/living/silicon/ai/examine(mob/user)
|
||||
if(!..(user))
|
||||
return
|
||||
|
||||
|
||||
var/msg = ""
|
||||
if (src.stat == DEAD)
|
||||
msg += "<span class='deadsay'>It appears to be powered-down.</span>\n"
|
||||
@@ -23,5 +23,14 @@
|
||||
msg += "</span>"
|
||||
msg += "*---------*</span>"
|
||||
|
||||
usr << msg
|
||||
return
|
||||
user << msg
|
||||
user.showLaws(src)
|
||||
|
||||
return
|
||||
|
||||
/mob/proc/showLaws(var/mob/living/silicon/S)
|
||||
return
|
||||
|
||||
/mob/dead/observer/showLaws(var/mob/living/silicon/S)
|
||||
if(antagHUD || is_admin(src))
|
||||
S.laws.show_laws(src)
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
src.laws_sanity_check()
|
||||
src.laws.show_laws(who)
|
||||
|
||||
/mob/living/silicon/ai/proc/add_ion_law(var/law)
|
||||
/mob/living/silicon/ai/add_ion_law(var/law)
|
||||
src.laws_sanity_check()
|
||||
src.laws.add_ion_law(law)
|
||||
for(var/mob/living/silicon/robot/R in mob_list)
|
||||
@@ -25,4 +25,4 @@
|
||||
/mob/living/silicon/ai/proc/ai_checklaws()
|
||||
set category = "AI Commands"
|
||||
set name = "State Laws"
|
||||
checklaws()
|
||||
subsystem_law_manager()
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
var/list/ai_verbs_subsystems = list(
|
||||
/mob/living/silicon/ai/proc/subsystem_alarm_monitor,
|
||||
/mob/living/silicon/ai/proc/subsystem_crew_monitor,
|
||||
/mob/living/silicon/ai/proc/subsystem_power_monitor,
|
||||
/mob/living/silicon/ai/proc/subsystem_rcon
|
||||
)
|
||||
|
||||
/mob/living/silicon/ai
|
||||
var/
|
||||
var/list/ai_verbs_subsystems = list(
|
||||
/mob/living/silicon/ai/proc/subsystem_crew_monitor,
|
||||
/mob/living/silicon/ai/proc/subsystem_power_monitor,
|
||||
/mob/living/silicon/ai/proc/subsystem_rcon
|
||||
)
|
||||
|
||||
var/obj/nano_module/crew_monitor/crew_monitor
|
||||
var/obj/nano_module/rcon/rcon
|
||||
var/obj/nano_module/power_monitor/power_monitor
|
||||
@@ -19,26 +17,20 @@ var/list/ai_verbs_subsystems = list(
|
||||
rcon = new(src)
|
||||
power_monitor = new(src)
|
||||
|
||||
/mob/living/silicon/ai/proc/subsystem_alarm_monitor()
|
||||
set name = "Alarm Monitor"
|
||||
set category = "AI Subystems"
|
||||
|
||||
alarm_monitor.ui_interact(usr)
|
||||
|
||||
/mob/living/silicon/ai/proc/subsystem_crew_monitor()
|
||||
set category = "AI Subystems"
|
||||
set category = "Subystems"
|
||||
set name = "Crew Monitor"
|
||||
|
||||
crew_monitor.ui_interact(usr)
|
||||
|
||||
/mob/living/silicon/ai/proc/subsystem_power_monitor()
|
||||
set category = "AI Subystems"
|
||||
set category = "Subystems"
|
||||
set name = "Power Monitor"
|
||||
|
||||
power_monitor.ui_interact(usr)
|
||||
|
||||
/mob/living/silicon/ai/proc/subsystem_rcon()
|
||||
set category = "AI Subystems"
|
||||
set category = "Subystems"
|
||||
set name = "RCON"
|
||||
|
||||
rcon.ui_interact(usr)
|
||||
|
||||
@@ -1,22 +1,30 @@
|
||||
/mob/living/silicon
|
||||
var/datum/ai_laws/laws = null
|
||||
var/list/additional_law_channels = list("State")
|
||||
|
||||
/mob/living/silicon/proc/laws_sanity_check()
|
||||
if (!src.laws)
|
||||
laws = new base_law_type
|
||||
|
||||
/mob/living/silicon/proc/has_zeroth_law()
|
||||
return laws.zeroth
|
||||
return laws.zeroth_law != null
|
||||
|
||||
/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/robot/set_zeroth_law(var/law, var/law_borg)
|
||||
..()
|
||||
if(tracking_entities)
|
||||
src << "<span class='warning'>Internal camera is currently being accessed.</span>"
|
||||
|
||||
/mob/living/silicon/proc/add_inherent_law(var/law)
|
||||
/mob/living/silicon/proc/add_ion_law(var/law)
|
||||
laws_sanity_check()
|
||||
laws.add_inherent_law(law)
|
||||
laws.add_ion_law(law)
|
||||
|
||||
/mob/living/silicon/proc/add_inherent_law(var/law, var/state_law = 1)
|
||||
laws_sanity_check()
|
||||
laws.add_inherent_law(law, state_law)
|
||||
|
||||
/mob/living/silicon/proc/clear_inherent_laws()
|
||||
laws_sanity_check()
|
||||
@@ -26,15 +34,15 @@
|
||||
laws_sanity_check()
|
||||
laws.clear_ion_laws()
|
||||
|
||||
/mob/living/silicon/proc/add_supplied_law(var/number, var/law)
|
||||
/mob/living/silicon/proc/add_supplied_law(var/number, var/law, var/state_law = 1)
|
||||
laws_sanity_check()
|
||||
laws.add_supplied_law(number, law)
|
||||
laws.add_supplied_law(number, law, state_law)
|
||||
|
||||
/mob/living/silicon/proc/clear_supplied_laws()
|
||||
laws_sanity_check()
|
||||
laws.clear_supplied_laws()
|
||||
|
||||
/mob/living/silicon/proc/statelaws() // -- TLE
|
||||
/mob/living/silicon/proc/statelaws(var/datum/ai_laws/laws, var/use_statement_order = 1) // -- TLE
|
||||
var/prefix = ""
|
||||
switch(lawchannel)
|
||||
if(MAIN_CHANNEL) prefix = ";"
|
||||
@@ -42,9 +50,9 @@
|
||||
else
|
||||
prefix = get_radio_key_from_channel(lawchannel == "Holopad" ? "department" : lawchannel) + " "
|
||||
|
||||
dostatelaws(lawchannel, prefix)
|
||||
dostatelaws(lawchannel, prefix, laws, use_statement_order)
|
||||
|
||||
/mob/living/silicon/proc/dostatelaws(var/method, var/prefix)
|
||||
/mob/living/silicon/proc/dostatelaws(var/method, var/prefix, var/datum/ai_laws/laws, var/use_statement_order)
|
||||
if(stating_laws[prefix])
|
||||
src << "<span class='notice'>[method]: Already stating laws using this communication method.</span>"
|
||||
return
|
||||
@@ -53,34 +61,8 @@
|
||||
|
||||
var/can_state = statelaw("[prefix]Current Active Laws:")
|
||||
|
||||
//src.laws_sanity_check()
|
||||
//src.laws.show_laws(world)
|
||||
if (can_state && 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
|
||||
can_state = statelaw("[prefix]0. [src.laws.zeroth]")
|
||||
|
||||
for (var/index = 1, can_state && index <= src.laws.ion.len, index++)
|
||||
var/law = src.laws.ion[index]
|
||||
var/num = ionnum()
|
||||
if (length(law) > 0)
|
||||
if (src.ioncheck[index] == "Yes")
|
||||
can_state = statelaw("[prefix][num]. [law]")
|
||||
|
||||
var/number = 1
|
||||
for (var/index = 1, can_state && index <= src.laws.inherent.len, index++)
|
||||
var/law = src.laws.inherent[index]
|
||||
if (length(law) > 0)
|
||||
if (src.lawcheck[index+1] == "Yes")
|
||||
can_state = statelaw("[prefix][number]. [law]")
|
||||
number++
|
||||
|
||||
for (var/index = 1, can_state && 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")
|
||||
can_state = statelaw("[prefix][number]. [law]")
|
||||
number++
|
||||
for(var/datum/ai_law/law in laws.laws_to_state())
|
||||
can_state = statelaw("[prefix][law.get_index(use_statement_order)]. [law.law]")
|
||||
|
||||
if(!can_state)
|
||||
src << "<span class='danger'>[method]: Unable to state laws. Communication method unavailable.</span>"
|
||||
@@ -93,43 +75,9 @@
|
||||
|
||||
return 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")
|
||||
/mob/living/silicon/proc/law_channels()
|
||||
var/list/channels = new()
|
||||
channels += MAIN_CHANNEL
|
||||
channels += common_radio.channels
|
||||
channels += additional_law_channels
|
||||
return channels
|
||||
|
||||
@@ -285,7 +285,7 @@
|
||||
return
|
||||
|
||||
/mob/living/silicon/robot/drone/add_robot_verbs()
|
||||
src.verbs |= robot_verbs_subsystems
|
||||
src.verbs |= silicon_verbs_subsystems
|
||||
|
||||
/mob/living/silicon/robot/drone/remove_robot_verbs()
|
||||
src.verbs -= robot_verbs_subsystems
|
||||
src.verbs -= silicon_verbs_subsystems
|
||||
|
||||
@@ -39,4 +39,5 @@
|
||||
msg += "\nIt is [pose]"
|
||||
|
||||
user << msg
|
||||
user.showLaws(src)
|
||||
return
|
||||
|
||||
@@ -41,39 +41,11 @@
|
||||
/mob/living/silicon/robot/proc/lawsync()
|
||||
laws_sanity_check()
|
||||
var/datum/ai_laws/master = connected_ai ? connected_ai.laws : null
|
||||
var/temp
|
||||
if (master)
|
||||
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
|
||||
|
||||
if (!is_special_character(src) || mind.original != src)
|
||||
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]
|
||||
if (length(temp) > 0)
|
||||
laws.inherent[index] = temp
|
||||
|
||||
laws.supplied.len = master.supplied.len
|
||||
for (var/index = 1, index <= master.supplied.len, index++)
|
||||
temp = master.supplied[index]
|
||||
if (length(temp) > 0)
|
||||
laws.supplied[index] = temp
|
||||
master.sync(src)
|
||||
return
|
||||
|
||||
/mob/living/silicon/robot/proc/add_ion_law(var/law)
|
||||
laws_sanity_check()
|
||||
laws.add_ion_law(law)
|
||||
|
||||
/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
|
||||
/mob/living/silicon/robot/proc/robot_checklaws()
|
||||
set category = "Robot Commands"
|
||||
set name = "State Laws"
|
||||
checklaws()
|
||||
subsystem_law_manager()
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
var/list/robot_verbs_default = list(
|
||||
/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.
|
||||
|
||||
/mob/living/silicon/robot
|
||||
@@ -84,6 +79,11 @@ var/list/robot_verbs_default = list(
|
||||
var/tracking_entities = 0 //The number of known entities currently accessing the internal camera
|
||||
var/braintype = "Cyborg"
|
||||
|
||||
var/list/robot_verbs_default = list(
|
||||
/mob/living/silicon/robot/proc/sensor_mode,
|
||||
/mob/living/silicon/robot/proc/robot_checklaws
|
||||
)
|
||||
|
||||
/mob/living/silicon/robot/syndicate
|
||||
lawupdate = 0
|
||||
scrambledcodes = 1
|
||||
@@ -1063,28 +1063,6 @@ var/list/robot_verbs_default = list(
|
||||
src << "Module isn't activated"
|
||||
installed_modules()
|
||||
return 1
|
||||
|
||||
if (href_list["lawc"]) // Toggling whether or not a law gets stated by the State Laws verb --NeoFite
|
||||
var/L = text2num(href_list["lawc"])
|
||||
switch(lawcheck[L+1])
|
||||
if ("Yes") lawcheck[L+1] = "No"
|
||||
if ("No") lawcheck[L+1] = "Yes"
|
||||
// src << text ("Switching Law [L]'s report status to []", lawcheck[L+1])
|
||||
checklaws()
|
||||
return 1
|
||||
|
||||
if (href_list["lawi"]) // Toggling whether or not a law gets stated by the State Laws verb --NeoFite
|
||||
var/L = text2num(href_list["lawi"])
|
||||
switch(ioncheck[L])
|
||||
if ("Yes") ioncheck[L] = "No"
|
||||
if ("No") ioncheck[L] = "Yes"
|
||||
// src << text ("Switching Law [L]'s report status to []", lawcheck[L+1])
|
||||
checklaws()
|
||||
return 1
|
||||
|
||||
if (href_list["laws"]) // With how my law selection code works, I changed statelaws from a verb to a proc, and call it through my law selection panel. --NeoFite
|
||||
statelaws()
|
||||
return 1
|
||||
return
|
||||
|
||||
/mob/living/silicon/robot/proc/radio_menu()
|
||||
@@ -1215,11 +1193,11 @@ var/list/robot_verbs_default = list(
|
||||
|
||||
/mob/living/silicon/robot/proc/add_robot_verbs()
|
||||
src.verbs |= robot_verbs_default
|
||||
src.verbs |= robot_verbs_subsystems
|
||||
src.verbs |= silicon_verbs_subsystems
|
||||
|
||||
/mob/living/silicon/robot/proc/remove_robot_verbs()
|
||||
src.verbs -= robot_verbs_default
|
||||
src.verbs -= robot_verbs_subsystems
|
||||
src.verbs -= silicon_verbs_subsystems
|
||||
|
||||
// Uses power from cyborg's cell. Returns 1 on success or 0 on failure.
|
||||
// Properly converts using CELLRATE now! Amount is in Joules.
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
var/list/robot_verbs_subsystems = list(
|
||||
/mob/living/silicon/robot/proc/subsystem_alarm_monitor
|
||||
)
|
||||
|
||||
/mob/living/silicon/robot/proc/subsystem_alarm_monitor()
|
||||
set name = "Alarm Monitor"
|
||||
set category = "Robot Subystems"
|
||||
|
||||
alarm_monitor.ui_interact(usr)
|
||||
@@ -2,13 +2,9 @@
|
||||
gender = NEUTER
|
||||
voice_name = "synthesized voice"
|
||||
var/syndicate = 0
|
||||
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/list/stating_laws = list()// Channels laws are currently being stated on
|
||||
var/lawcheck[1]
|
||||
var/ioncheck[1]
|
||||
var/obj/item/device/radio/common_radio
|
||||
|
||||
var/list/hud_list[10]
|
||||
@@ -22,9 +18,6 @@
|
||||
var/obj/item/device/camera/siliconcam/aiCamera = null //photography
|
||||
var/local_transmit //If set, can only speak to others of the same type within a short range.
|
||||
|
||||
// Subsystems
|
||||
var/obj/nano_module/alarm_monitor = null
|
||||
|
||||
var/sensor_mode = 0 //Determines the current HUD.
|
||||
|
||||
var/next_alarm_notice
|
||||
@@ -169,13 +162,12 @@
|
||||
|
||||
// This adds the basic clock, shuttle recall timer, and malf_ai info to all silicon lifeforms
|
||||
/mob/living/silicon/Stat()
|
||||
..()
|
||||
statpanel("Status")
|
||||
if (src.client.statpanel == "Status")
|
||||
if(statpanel("Status"))
|
||||
show_station_time()
|
||||
show_emergency_shuttle_eta()
|
||||
show_system_integrity()
|
||||
show_malf_ai()
|
||||
..()
|
||||
|
||||
// this function displays the stations manifest in a separate window
|
||||
/mob/living/silicon/proc/show_station_manifest()
|
||||
@@ -255,27 +247,6 @@
|
||||
/mob/living/silicon/binarycheck()
|
||||
return 1
|
||||
|
||||
/mob/living/silicon/Topic(href, href_list)
|
||||
if(..())
|
||||
return 1
|
||||
|
||||
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
|
||||
|
||||
/mob/living/silicon/ex_act(severity)
|
||||
if(!blinded)
|
||||
flick("flash", flash)
|
||||
@@ -299,6 +270,8 @@
|
||||
|
||||
/mob/living/silicon/proc/init_subsystems()
|
||||
alarm_monitor = new/obj/nano_module/alarm_monitor/borg(src)
|
||||
law_manager = new/obj/nano_module/law_manager(src)
|
||||
|
||||
for(var/datum/alarm_handler/AH in alarm_manager.all_handlers)
|
||||
AH.register(src, /mob/living/silicon/proc/receive_alarm)
|
||||
queued_alarms[AH] = list() // Makes sure alarms remain listed in consistent order
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/mob/living/silicon
|
||||
var/list/silicon_verbs_subsystems = list(
|
||||
/mob/living/silicon/proc/subsystem_alarm_monitor,
|
||||
/mob/living/silicon/proc/subsystem_law_manager
|
||||
)
|
||||
|
||||
// Subsystems
|
||||
var/obj/nano_module/alarm_monitor = null
|
||||
var/obj/nano_module/law_manager = null
|
||||
|
||||
/mob/living/silicon/robot/syndicate
|
||||
silicon_verbs_subsystems = list(
|
||||
/mob/living/silicon/proc/subsystem_law_manager
|
||||
)
|
||||
|
||||
/mob/living/silicon/proc/subsystem_alarm_monitor()
|
||||
set name = "Alarm Monitor"
|
||||
set category = "Subystems"
|
||||
|
||||
alarm_monitor.ui_interact(usr)
|
||||
|
||||
/mob/living/silicon/proc/subsystem_law_manager()
|
||||
set name = "Law Manager"
|
||||
set category = "Subystems"
|
||||
|
||||
law_manager.ui_interact(usr)
|
||||
@@ -75,23 +75,28 @@
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/proc/isAI(A)
|
||||
if(istype(A, /mob/living/silicon/ai))
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/mob/proc/isSilicon()
|
||||
return 0
|
||||
|
||||
/mob/living/silicon/isSilicon()
|
||||
return 1
|
||||
|
||||
/proc/isAI(A)
|
||||
if(istype(A, /mob/living/silicon/ai))
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/mob/proc/isAI()
|
||||
return 0
|
||||
|
||||
/mob/living/silicon/ai/isAI()
|
||||
return 1
|
||||
|
||||
/mob/proc/isRobot()
|
||||
return 0
|
||||
|
||||
/mob/living/silicon/robot/isRobot()
|
||||
return 1
|
||||
|
||||
/proc/ispAI(A)
|
||||
if(istype(A, /mob/living/silicon/pai))
|
||||
return 1
|
||||
@@ -149,7 +154,7 @@ proc/hassensorlevel(A, var/level)
|
||||
var/obj/item/clothing/under/U = H.w_uniform
|
||||
return U.sensor_mode >= level
|
||||
return 0
|
||||
|
||||
|
||||
proc/getsensorlevel(A)
|
||||
var/mob/living/carbon/human/H = A
|
||||
if(istype(H) && istype(H.w_uniform, /obj/item/clothing/under))
|
||||
@@ -157,6 +162,11 @@ proc/getsensorlevel(A)
|
||||
return U.sensor_mode
|
||||
return SUIT_SENSOR_OFF
|
||||
|
||||
|
||||
/proc/is_admin(var/mob/user)
|
||||
return check_rights(R_ADMIN, 0, user) != 0
|
||||
|
||||
|
||||
/proc/hsl2rgb(h, s, l)
|
||||
return //TODO: Implement
|
||||
|
||||
|
||||
@@ -146,9 +146,6 @@
|
||||
/obj/nano_module/appearance_changer/proc/can_change_skin_color()
|
||||
return owner && (flags & APPEARANCE_SKIN) && owner.species.flags & HAS_SKIN_COLOR
|
||||
|
||||
/obj/nano_module/appearance_changer/proc/can_still_topic()
|
||||
return CanUseTopic(usr, list(), default_state) == STATUS_INTERACTIVE
|
||||
|
||||
/obj/nano_module/appearance_changer/proc/cut_and_generate_data()
|
||||
// Making the assumption that the available species remain constant
|
||||
valid_facial_hairstyles.Cut()
|
||||
|
||||
@@ -0,0 +1,238 @@
|
||||
/obj/nano_module/law_manager
|
||||
name = "Law manager"
|
||||
|
||||
var/ion_law = "IonLaw"
|
||||
var/zeroth_law = "ZerothLaw"
|
||||
var/inherent_law = "InherentLaw"
|
||||
var/supplied_law = "SuppliedLaw"
|
||||
var/supplied_law_position = MIN_SUPPLIED_LAW_NUMBER
|
||||
|
||||
var/current_view = 0
|
||||
|
||||
var/global/list/datum/ai_laws/admin_laws
|
||||
var/global/list/datum/ai_laws/player_laws
|
||||
var/mob/living/silicon/owner = null
|
||||
|
||||
/obj/nano_module/law_manager/New(var/mob/living/silicon/S)
|
||||
..()
|
||||
loc = S
|
||||
owner = S
|
||||
|
||||
if(!admin_laws)
|
||||
admin_laws = new()
|
||||
player_laws = new()
|
||||
|
||||
init_subtypes(/datum/ai_laws, admin_laws)
|
||||
admin_laws = dd_sortedObjectList(admin_laws)
|
||||
|
||||
for(var/datum/ai_laws/laws in admin_laws)
|
||||
if(laws.selectable)
|
||||
player_laws += laws
|
||||
|
||||
/obj/nano_module/law_manager/Topic(href, href_list)
|
||||
if(..())
|
||||
return 1
|
||||
|
||||
if(href_list["set_view"])
|
||||
if(is_malf(usr))
|
||||
current_view = text2num(href_list["set_view"])
|
||||
else
|
||||
current_view = 0
|
||||
return 1
|
||||
|
||||
if(href_list["law_channel"])
|
||||
if(href_list["law_channel"] in owner.law_channels())
|
||||
owner.lawchannel = href_list["law_channel"]
|
||||
return 1
|
||||
|
||||
if(href_list["state_law"])
|
||||
var/datum/ai_law/AL = locate(href_list["ref"]) in owner.laws.all_laws()
|
||||
if(AL)
|
||||
var/state_law = text2num(href_list["state_law"])
|
||||
AL.state_law = state_law
|
||||
return 1
|
||||
|
||||
if(href_list["add_zeroth_law"])
|
||||
if(zeroth_law && is_admin(usr) && !owner.laws.zeroth_law)
|
||||
log_and_message_admins("has given [owner] a new zeroth law: [zeroth_law]")
|
||||
owner.set_zeroth_law(zeroth_law)
|
||||
return 1
|
||||
|
||||
if(href_list["add_ion_law"])
|
||||
if(ion_law && is_malf(usr))
|
||||
log_and_message_admins("has given [owner] a new ion law: [ion_law]")
|
||||
owner.add_ion_law(ion_law)
|
||||
return 1
|
||||
|
||||
if(href_list["add_inherent_law"])
|
||||
if(inherent_law && is_malf(usr))
|
||||
log_and_message_admins("has given [owner] a new inherent law: [inherent_law]")
|
||||
owner.add_inherent_law(inherent_law)
|
||||
return 1
|
||||
|
||||
if(href_list["add_supplied_law"])
|
||||
if(supplied_law && supplied_law_position >= 1 && MIN_SUPPLIED_LAW_NUMBER <= MAX_SUPPLIED_LAW_NUMBER)
|
||||
log_and_message_admins("has given [owner] a new supplied law: [supplied_law]")
|
||||
owner.add_supplied_law(supplied_law_position, supplied_law)
|
||||
return 1
|
||||
|
||||
if(href_list["change_zeroth_law"])
|
||||
var/new_law = trim_strip_input(usr, "Enter new law Zero. Leaving the field blank will cancel the edit.", "Edit Law", zeroth_law)
|
||||
if(new_law && new_law != zeroth_law && can_still_topic())
|
||||
zeroth_law = new_law
|
||||
return 1
|
||||
|
||||
if(href_list["change_ion_law"])
|
||||
var/new_law = trim_strip_input(usr, "Enter new ion law. Leaving the field blank will cancel the edit.", "Edit Law", ion_law)
|
||||
if(new_law && new_law != ion_law && can_still_topic())
|
||||
ion_law = new_law
|
||||
return 1
|
||||
|
||||
if(href_list["change_inherent_law"])
|
||||
var/new_law = trim_strip_input(usr, "Enter new inherent law. Leaving the field blank will cancel the edit.", "Edit Law", inherent_law)
|
||||
if(new_law && new_law != inherent_law && can_still_topic())
|
||||
inherent_law = new_law
|
||||
return 1
|
||||
|
||||
if(href_list["change_supplied_law"])
|
||||
var/new_law = trim_strip_input(usr, "Enter new supplied law. Leaving the field blank will cancel the edit.", "Edit Law", supplied_law)
|
||||
if(new_law && new_law != supplied_law && can_still_topic())
|
||||
supplied_law = new_law
|
||||
return 1
|
||||
|
||||
if(href_list["change_supplied_law_position"])
|
||||
var/new_position = input(usr, "Enter new supplied law position between 1 and [MAX_SUPPLIED_LAW_NUMBER], inclusive. Inherent laws at the same index as a supplied law will not be stated.", "Law Position", supplied_law_position) as num|null
|
||||
if(isnum(new_position) && can_still_topic())
|
||||
supplied_law_position = Clamp(new_position, 1, MAX_SUPPLIED_LAW_NUMBER)
|
||||
return 1
|
||||
|
||||
if(href_list["edit_law"])
|
||||
if(is_malf(usr))
|
||||
var/datum/ai_law/AL = locate(href_list["edit_law"]) in owner.laws.all_laws()
|
||||
if(AL)
|
||||
var/new_law = trim_strip_input(usr, "Enter new law. Leaving the field blank will cancel the edit.", "Edit Law", AL.law)
|
||||
if(new_law && new_law != AL.law && is_malf(usr) && can_still_topic())
|
||||
log_and_message_admins("has changed a law of [owner] from '[AL.law]' to '[new_law]'")
|
||||
AL.law = new_law
|
||||
return 1
|
||||
|
||||
if(href_list["delete_law"])
|
||||
if(is_malf(usr))
|
||||
var/datum/ai_law/AL = locate(href_list["delete_law"]) in owner.laws.all_laws()
|
||||
if(AL && is_malf(usr))
|
||||
log_and_message_admins("has deleted a law belonging to [owner]: [AL.law]")
|
||||
owner.laws.delete_law(AL)
|
||||
return 1
|
||||
|
||||
if(href_list["state_laws"])
|
||||
owner.statelaws(owner.laws)
|
||||
return 1
|
||||
|
||||
if(href_list["state_law_set"])
|
||||
var/datum/ai_laws/ALs = locate(href_list["state_law_set"]) in (is_admin(usr) ? admin_laws : player_laws)
|
||||
if(ALs)
|
||||
owner.statelaws(ALs)
|
||||
return 1
|
||||
|
||||
if(href_list["transfer_laws"])
|
||||
var/datum/ai_laws/ALs = locate(href_list["transfer_laws"]) in (is_admin(usr) ? admin_laws : player_laws)
|
||||
if(ALs)
|
||||
log_and_message_admins("has transfered the [ALs.name] laws to [owner].")
|
||||
ALs.sync(owner, 0)
|
||||
current_view = 0
|
||||
return 1
|
||||
|
||||
if(href_list["sync_laws"])
|
||||
if(owner.isAI())
|
||||
sync_laws(owner)
|
||||
else
|
||||
var/mob/living/silicon/robot/R = owner
|
||||
sync_laws(R.connected_ai)
|
||||
usr << "<span class='notice'>Sync complete.</span>"
|
||||
return 1
|
||||
|
||||
if(href_list["notify_laws"])
|
||||
owner << "<span class='danger'>Law Notice</span>"
|
||||
owner.laws.show_laws(owner)
|
||||
if(owner.isAI())
|
||||
var/mob/living/silicon/ai/AI = owner
|
||||
for(var/mob/living/silicon/robot/R in AI.connected_robots)
|
||||
R << "<span class='danger'>Law Notice</span>"
|
||||
R.laws.show_laws(R)
|
||||
if(usr != owner)
|
||||
usr << "<span class='notice>Laws displayed.</span>"
|
||||
return 1
|
||||
|
||||
/obj/nano_module/law_manager/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
var/data[0]
|
||||
owner.laws.sort_laws()
|
||||
|
||||
data["view"] = current_view
|
||||
|
||||
data["ion_law_nr"] = ionnum()
|
||||
data["ion_law"] = ion_law
|
||||
data["zeroth_law"] = zeroth_law
|
||||
data["inherent_law"] = inherent_law
|
||||
data["supplied_law"] = supplied_law
|
||||
data["supplied_law_position"] = supplied_law_position
|
||||
|
||||
package_laws(data, "zeroth_laws", list(owner.laws.zeroth_law, owner.laws.zeroth_law_borg))
|
||||
package_laws(data, "ion_laws", owner.laws.ion_laws)
|
||||
package_laws(data, "inherent_laws", owner.laws.inherent_laws)
|
||||
package_laws(data, "supplied_laws", owner.laws.supplied_laws)
|
||||
|
||||
data["isAI"] = owner.isAI()
|
||||
data["isMalf"] = is_malf(user)
|
||||
data["isSlaved"] = is_slaved()
|
||||
data["isAdmin"] = is_admin(user)
|
||||
|
||||
var/channels[0]
|
||||
for (var/ch_name in owner.law_channels())
|
||||
channels[++channels.len] = list("channel" = ch_name)
|
||||
data["channel"] = owner.lawchannel
|
||||
data["channels"] = channels
|
||||
|
||||
if(data["isMalf"])
|
||||
data["law_sets"] = package_multiple_laws(data["isAdmin"] ? admin_laws : player_laws)
|
||||
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "law_manager.tmpl", sanitize("[src] - [owner]"), 800, is_malf(user) ? 600 : 400)
|
||||
ui.set_initial_data(data)
|
||||
ui.open()
|
||||
ui.set_auto_update(1)
|
||||
|
||||
/obj/nano_module/law_manager/proc/package_laws(var/list/data, var/field, var/list/datum/ai_law/laws)
|
||||
var/packaged_laws[0]
|
||||
for(var/datum/ai_law/AL in laws)
|
||||
packaged_laws[++packaged_laws.len] = list("law" = sanitize(AL.law), "index" = AL.get_index(), "state" = AL.state_law, "ref" = "\ref[AL]")
|
||||
data[field] = packaged_laws
|
||||
data["has_[field]"] = packaged_laws.len
|
||||
|
||||
/obj/nano_module/law_manager/proc/package_multiple_laws(var/list/datum/ai_laws/laws)
|
||||
var/law_sets[0]
|
||||
for(var/datum/ai_laws/ALs in laws)
|
||||
var/packaged_laws[0]
|
||||
package_laws(packaged_laws, "zeroth_laws", list(ALs.zeroth_law, ALs.zeroth_law_borg))
|
||||
package_laws(packaged_laws, "ion_laws", ALs.ion_laws)
|
||||
package_laws(packaged_laws, "inherent_laws", ALs.inherent_laws)
|
||||
package_laws(packaged_laws, "supplied_laws", ALs.supplied_laws)
|
||||
law_sets[++law_sets.len] = list("name" = ALs.name, "header" = ALs.law_header, "ref" = "\ref[ALs]","laws" = packaged_laws)
|
||||
|
||||
return law_sets
|
||||
|
||||
/obj/nano_module/law_manager/proc/is_malf(var/mob/user)
|
||||
return is_admin(user) || (owner.mind && (owner.mind.special_role == "malfunction" || owner.mind.special_role == "traitor"))
|
||||
|
||||
/obj/nano_module/law_manager/proc/is_slaved()
|
||||
if(owner.isRobot())
|
||||
var/mob/living/silicon/robot/R = owner
|
||||
return R.lawupdate && R.connected_ai ? sanitize(R.connected_ai.name) : null
|
||||
return null
|
||||
|
||||
/obj/nano_module/law_manager/proc/sync_laws(var/mob/living/silicon/ai/AI)
|
||||
if(!AI)
|
||||
return
|
||||
for(var/mob/living/silicon/robot/R in AI.connected_robots)
|
||||
R.sync()
|
||||
log_and_message_admins("has syncronized [AI]'s laws with its borgs.")
|
||||
@@ -0,0 +1,2 @@
|
||||
/obj/nano_module/proc/can_still_topic()
|
||||
return CanUseTopic(usr, list(), default_state) == STATUS_INTERACTIVE
|
||||
Reference in New Issue
Block a user