Allows the AI to state laws over the holopad. Modifies say-code to return true on success.

Say-code updated to return true on success.
This allows for quitting early when stating laws without having to duplicating the checks made in the say-code.
This commit is contained in:
PsiOmega
2014-07-17 12:43:41 +02:00
parent 7f16a35265
commit dfcf25ce49
5 changed files with 29 additions and 23 deletions

View File

@@ -93,7 +93,7 @@ var/list/department_radio_keys = list(
if (speaking.flags & SIGNLANG)
say_signlang(message, pick(speaking.signlang_verb), speaking)
return
return 1
//speaking into radios
if(used_radios.len)
@@ -116,13 +116,13 @@ var/list/department_radio_keys = list(
if(pressure < SAY_MINIMUM_PRESSURE)
italics = 1
message_range = 1
if (speech_sound)
sound_vol *= 0.5 //muffle the sound a bit, so it's like we're actually talking through contact
var/list/listening = list()
var/list/listening_obj = list()
if(T)
var/list/hear = hear(message_range, T)
var/list/hearturfs = list()
@@ -144,7 +144,7 @@ var/list/department_radio_keys = list(
var/obj/O = I
hearturfs += O.locs[1]
listening_obj |= O
for(var/mob/M in player_list)
if(M.stat == DEAD && M.client && (M.client.prefs.toggles & CHAT_GHOSTEARS))
@@ -165,8 +165,9 @@ var/list/department_radio_keys = list(
spawn(0)
if(O) //It's possible that it could be deleted in the meantime.
O.hear_talk(src, message, verb, speaking)
log_say("[name]/[key] : [message]")
return 1
/mob/living/proc/say_signlang(var/message, var/verb="gestures", var/datum/language/language)
for (var/mob/O in viewers(src, null))

View File

@@ -392,11 +392,10 @@ var/list/ai_list = list()
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","Cancel")
var/setchannel = input(usr, "Specify channel.", "Channel selection") in list("State","Common","Science","Command","Medical","Engineering","Security","Supply","Binary","Holopad", "Cancel")
if(setchannel == "Cancel")
return
lawchannel = setchannel
checklaws()
//Uncomment this line of code if you are enabling the AI Vocal (VOX) announcements.

View File

@@ -64,8 +64,12 @@
if("Security") prefix = ":s "
if("Supply") prefix = ":u "
if("Binary") prefix = ":b "
if("Holopad") prefix = ":h "
else prefix = ""
if(src.say("[prefix]Current Active Laws:") != 1)
return
src.say("[prefix]Current Active Laws:")
//src.laws_sanity_check()
//src.laws.show_laws(world)
var/number = 1

View File

@@ -1,9 +1,8 @@
/mob/living/silicon/ai/say(var/message)
if(parent && istype(parent) && parent.stat != 2)
parent.say(message)
return
return parent.say(message)
//If there is a defined "parent" AI, it is actually an AI, and it is alive, anything the AI tries to say is said by the parent instead.
..(message)
return ..(message)
// These Verbs are commented out since we've disabled the AI vocal (VOX) announcements.
// If you re-enable them there is 3 lines in ai.dm Topic() that you need to uncomment as well.

View File

@@ -60,7 +60,7 @@
return
var/verb = say_quote(message)
//parse radio key and consume it
var/message_mode = parse_message_mode(message, "general")
if (message_mode)
@@ -68,31 +68,31 @@
message = trim(copytext(message,2))
else
message = trim(copytext(message,3))
if(message_mode && bot_type == IS_ROBOT && message_mode != "binary" && !R.is_component_functioning("radio"))
src << "\red Your radio isn't functional at this time."
return
//parse language key and consume it
var/datum/language/speaking = parse_language(message)
if (speaking)
verb = speaking.speech_verb
message = copytext(message,3)
switch(message_mode)
if("department")
switch(bot_type)
if(IS_AI)
AI.holopad_talk(message)
return AI.holopad_talk(message)
if(IS_ROBOT)
log_say("[key_name(src)] : [message]")
R.radio.talk_into(src,message,message_mode,verb,speaking)
if(IS_PAI)
log_say("[key_name(src)] : [message]")
P.radio.talk_into(src,message,message_mode,verb,speaking)
return
return 1
if("binary")
switch(bot_type)
@@ -105,12 +105,13 @@
return
robot_talk(message)
return
return 1
if("general")
switch(bot_type)
if(IS_AI)
if (AI.aiRadio.disabledAi)
src << "\red System Error - Transceiver Disabled"
return
else
log_say("[key_name(src)] : [message]")
AI.aiRadio.talk_into(src,message,null,verb,speaking)
@@ -120,7 +121,7 @@
if(IS_PAI)
log_say("[key_name(src)] : [message]")
P.radio.talk_into(src,message,null,verb,speaking)
return
return 1
else
if(message_mode && message_mode in radiochannels)
@@ -128,6 +129,7 @@
if(IS_AI)
if (AI.aiRadio.disabledAi)
src << "\red System Error - Transceiver Disabled"
return
else
log_say("[key_name(src)] : [message]")
AI.aiRadio.talk_into(src,message,message_mode,verb,speaking)
@@ -137,7 +139,7 @@
if(IS_PAI)
log_say("[key_name(src)] : [message]")
P.radio.talk_into(src,message,message_mode,verb,speaking)
return
return 1
return ..(message,speaking,verb)
@@ -172,7 +174,8 @@
This is another way of saying that we won't bother dealing with them.*/
else
src << "No holopad connected."
return
return
return 1
/mob/living/proc/robot_talk(var/message)