Lets AI and Borgs control auto announcements

The AI and cyborgs can now control if they speak on the radio and the
channel used when stating laws or  (AI only) announcing new player
arrivals.
This commit is contained in:
GunHog
2014-12-02 11:43:36 -06:00
parent e52db34ce3
commit 6ac3d8f2e8
4 changed files with 48 additions and 7 deletions

View File

@@ -31,6 +31,7 @@ var/list/ai_list = list()
var/viewalerts = 0
var/icon/holo_icon//Default is assigned when AI is created.
var/radio_enabled = 1 //Determins if a carded AI can speak with its built in radio or not.
radiomod = ";" //AIs will, by default, state their laws on the internal radio.
var/obj/item/device/pda/ai/aiPDA = null
var/obj/item/device/multitool/aiMulti = null
var/obj/item/device/camera/siliconcam/aicamera = null
@@ -102,7 +103,7 @@ var/list/ai_list = list()
verbs.Add(/mob/living/silicon/ai/proc/ai_network_change, \
/mob/living/silicon/ai/proc/ai_statuschange, /mob/living/silicon/ai/proc/ai_hologram_change, \
/mob/living/silicon/ai/proc/toggle_camera_light, /mob/living/silicon/ai/proc/botcall,\
/mob/living/silicon/ai/proc/control_integrated_radio)
/mob/living/silicon/ai/proc/control_integrated_radio, /mob/living/silicon/ai/proc/set_automatic_say_channel)
if(!safety)//Only used by AIize() to successfully spawn an AI.
if (!B)//If there is no player/brain inside.
@@ -732,6 +733,14 @@ var/list/ai_list = list()
/mob/living/silicon/ai/proc/set_syndie_radio()
if(radio)
radio.make_syndie()
/mob/living/silicon/ai/proc/set_automatic_say_channel()
set name = "Set Auto Announce Mode"
set desc = "Modify the default radio setting for your automatic announcements."
set category = "AI Commands"
set_autosay()
/mob/living/silicon/ai/attack_slime(mob/living/carbon/slime/user)
return

View File

@@ -960,6 +960,12 @@
checklaws()
/mob/living/silicon/robot/verb/set_automatic_say_channel() //Borg version of setting the radio for autosay messages.
set name = "Set Auto Announce Mode"
set desc = "Modify the default radio setting for stating your laws."
set category = "Robot Commands"
set_autosay()
/mob/living/silicon/robot/proc/deconstruct()
var/turf/T = get_turf(src)
if (robot_suit)

View File

@@ -7,6 +7,8 @@
var/list/alarms_to_show = list()
var/list/alarms_to_clear = list()
var/designation = ""
var/radiomod = "" //Radio character used before state laws/arrivals announce to allow department transmissions, default, or none at all.
var/obj/item/device/radio/borg/radio = null //AIs dont use this but this is at the silicon level to advoid copypasta in say()
var/list/alarm_types_show = list("Motion" = 0, "Fire" = 0, "Atmosphere" = 0, "Power" = 0, "Camera" = 0)
@@ -197,7 +199,8 @@
/mob/living/silicon/proc/statelaws()
src.say("Current Active Laws:")
var/r = radiomod //Inserted before a hardcoded message to change if and how it is handled by an internal radio.
src.say("[r] Current Active Laws:")
//src.laws_sanity_check()
//src.laws.show_laws(world)
var/number = 1
@@ -207,7 +210,7 @@
if (src.laws.zeroth)
if (src.lawcheck[1] == "Yes")
src.say("0. [src.laws.zeroth]")
src.say("[r] 0. [src.laws.zeroth]")
sleep(10)
for (var/index = 1, index <= src.laws.ion.len, index++)
@@ -215,7 +218,7 @@
var/num = ionnum()
if (length(law) > 0)
if (src.ioncheck[index] == "Yes")
src.say("[num]. [law]")
src.say("[r] [num]. [law]")
sleep(10)
for (var/index = 1, index <= src.laws.inherent.len, index++)
@@ -223,7 +226,7 @@
if (length(law) > 0)
if (src.lawcheck[index+1] == "Yes")
src.say("[number]. [law]")
src.say("[r] [number]. [law]")
sleep(10)
number++
@@ -234,7 +237,7 @@
if (length(law) > 0)
if(src.lawcheck.len >= number+1)
if (src.lawcheck[number+1] == "Yes")
src.say("[number]. [law]")
src.say("[r] [number]. [law]")
sleep(10)
number++
@@ -281,6 +284,29 @@
usr << browse(list, "window=laws")
/mob/living/silicon/proc/set_autosay() //For allowing the AI and borgs to set the radio behavior of auto announcements (state laws, arrivals).
if(!radio)
src << "Radio not detected."
return
//Ask the user to pick a channel from what it has available.
var/Autochan = input("Select a channel:") as null|anything in list("Default","None") + radio.channels
if(!Autochan)
return
if(Autochan == "Default") //Autospeak on whatever frequency to which the radio is set, usually Common.
radiomod = ";"
Autochan += " ([radio.frequency])"
else if(Autochan == "None") //Prevents use of the radio for automatic annoucements.
radiomod = ""
else //For department channels, if any, given by the internal radio.
for(var/key in department_radio_keys)
if(department_radio_keys[key] == Autochan)
radiomod = key
break
src << "<span class='notice'>Automatic announcements [Autochan == "None" ? "will not use the radio." : "set to [Autochan]."]</span>"
/mob/living/silicon/Bump(atom/movable/AM as mob|obj, yes) //Allows the AI to bump into mobs if it's itself pushed
if ((!( yes ) || now_pushing))
return

View File

@@ -291,7 +291,7 @@
var/mob/living/silicon/ai/announcer = pick(ailist)
if(character.mind)
if((character.mind.assigned_role != "Cyborg") && (character.mind.special_role != "MODE"))
announcer.say("[character.real_name] has signed up as [rank].")
announcer.say("[announcer.radiomod] [character.real_name] has signed up as [rank].")
/mob/new_player/proc/LateChoices()
var/mills = world.time // 1/10 of a second, not real milliseconds but whatever