Fix AI message classes not going through intercomms. (Tested)

This commit is contained in:
Rob Nelson
2015-10-16 13:01:10 -07:00
parent be67a2d084
commit 19d0257afa
4 changed files with 46 additions and 37 deletions

View File

@@ -59,8 +59,11 @@
clone.message = language.scramble(message)
return clone
/datum/speech/proc/render_wrapper_classes()
return list2text(wrapper_classes, " ")
/datum/speech/proc/render_wrapper_classes(var/sep=" ")
return list2text(wrapper_classes, sep)
/datum/speech/proc/render_message_classes(var/sep=" ")
return list2text(message_classes, sep)
/datum/speech/proc/render_message()
#ifdef SAY_DEBUG

View File

@@ -226,29 +226,23 @@
*/
/obj/item/device/radio/talk_into(var/datum/speech/speech_orig, var/channel=null)
var/datum/speech/speech=speech_orig.clone()
speech.radio=src
say_testing(loc, "\[Radio\] - Got radio/talk_into([html_encode(speech_orig.message)], [channel]).")
say_testing(loc, "\[Radio\] - Got radio/talk_into([html_encode(speech_orig.message)], [channel!=null ? channel : "null"]).")
if(!on)
say_testing(loc, "\[Radio\] - Not on.")
returnToPool(speech)
return // the device has to be on
// Fix for permacell radios, but kinda eh about actually fixing them.
if(!speech.speaker || !speech.message)
say_testing(loc, "\[Radio\] - speech.speaker or speech.message are null. [speech.speaker], [html_encode(speech.message)]")
returnToPool(speech)
if(!speech_orig.speaker || !speech_orig.message)
say_testing(loc, "\[Radio\] - speech.speaker or speech.message are null. [speech_orig.speaker], [html_encode(speech_orig.message)]")
return
// Uncommenting this. To the above comment:
// The permacell radios aren't suppose to be able to transmit, this isn't a bug and this "fix" is just making radio wires useless. -Giacom
if(isWireCut(WIRE_TRANSMIT)) // The device has to have all its wires and shit intact
say_testing(loc, "\[Radio\] - TRANSMIT wire cut.")
returnToPool(speech)
return
if(!speech.speaker.IsVocal())
if(!speech_orig.speaker.IsVocal())
say_testing(loc, "\[Radio\] - Speaker not vocal.")
returnToPool(speech)
return
/* Quick introduction:
@@ -264,6 +258,14 @@
/*
be prepared to disregard any comments in all of tcomms code. i tried my best to keep them somewhat up-to-date, but eh
*/
var/datum/speech/speech=speech_orig.clone()
speech.radio=src
#ifdef SAY_DEBUG
var/msgclasses = speech.render_message_classes(", ")
var/wrapclasses = speech.render_wrapper_classes(", ")
say_testing(loc, "\[Radio\] - Cloned speech - language=[speech.language], message_classes={[msgclasses]}, wrapper_classes={[wrapclasses]}")
#endif
var/skip_freq_search=0
switch(channel)
if(MODE_HEADSET,null) // Used for ";" prefix, which always sends to src.frequency.
@@ -442,6 +444,9 @@
"r_quote" = speech.rquote,
"l_quote" = speech.lquote,
"message_classes" = speech.message_classes.Copy(),
"wrapper_classes" = speech.wrapper_classes.Copy(),
)
signal.frequency = speech.frequency // Quick frequency set

View File

@@ -70,36 +70,36 @@
interpreter.container = src
interpreter.SetVar("PI" , 3.141592653) // value of pi
interpreter.SetVar("E" , 2.718281828) // value of e
interpreter.SetVar("SQURT2" , 1.414213562) // value of the square root of 2
interpreter.SetVar("FALSE" , 0) // boolean shortcut to 0
interpreter.SetVar("false" , 0) // boolean shortcut to 0
interpreter.SetVar("TRUE" , 1) // boolean shortcut to 1
interpreter.SetVar("true" , 1) // boolean shortcut to 1
interpreter.SetVar("PI", 3.141592653) // value of pi
interpreter.SetVar("E", 2.718281828) // value of e
interpreter.SetVar("SQURT2", 1.414213562) // value of the square root of 2
interpreter.SetVar("FALSE", 0) // boolean shortcut to 0
interpreter.SetVar("false", 0) // boolean shortcut to 0
interpreter.SetVar("TRUE", 1) // boolean shortcut to 1
interpreter.SetVar("true", 1) // boolean shortcut to 1
interpreter.SetVar("NORTH" , NORTH) // NORTH (1)
interpreter.SetVar("SOUTH" , SOUTH) // SOUTH (2)
interpreter.SetVar("EAST" , EAST) // EAST (4)
interpreter.SetVar("WEST" , WEST) // WEST (8)
interpreter.SetVar("NORTH", NORTH) // NORTH (1)
interpreter.SetVar("SOUTH", SOUTH) // SOUTH (2)
interpreter.SetVar("EAST", EAST) // EAST (4)
interpreter.SetVar("WEST", WEST) // WEST (8)
// Channel macros
interpreter.SetVar("$common", 1459)
interpreter.SetVar("$science", 1351)
interpreter.SetVar("$command", 1353)
interpreter.SetVar("$medical", 1355)
interpreter.SetVar("$engineering",1357)
interpreter.SetVar("$security", 1359)
interpreter.SetVar("$supply", 1347)
interpreter.SetVar("$common", 1459)
interpreter.SetVar("$science", 1351)
interpreter.SetVar("$command", 1353)
interpreter.SetVar("$medical", 1355)
interpreter.SetVar("$engineering", 1357)
interpreter.SetVar("$security", 1359)
interpreter.SetVar("$supply", 1347)
// Signal data
interpreter.SetVar("$content", signal.data["message"])
interpreter.SetVar("$freq" , signal.frequency)
interpreter.SetVar("$source" , signal.data["name"])
interpreter.SetVar("$job" , signal.data["job"])
interpreter.SetVar("$sign" , signal)
interpreter.SetVar("$pass" , !(signal.data["reject"])) // if the signal isn't rejected, pass = 1; if the signal IS rejected, pass = 0
interpreter.SetVar("$content", signal.data["message"])
interpreter.SetVar("$freq", signal.frequency)
interpreter.SetVar("$source", signal.data["name"])
interpreter.SetVar("$job", signal.data["job"])
interpreter.SetVar("$sign", signal)
interpreter.SetVar("$pass", !(signal.data["reject"])) // if the signal isn't rejected, pass = 1; if the signal IS rejected, pass = 0
// Set up the script procs