Merge pull request #17425 from coiax/voiced-skeletons

Some talking toys now audibly chatter
This commit is contained in:
Joan Lung
2016-05-13 14:45:12 -04:00
49 changed files with 1341 additions and 1175 deletions
+2 -1
View File
@@ -1356,9 +1356,10 @@
contains = list(/obj/item/toy/spinningtoy,
/obj/item/toy/sword,
/obj/item/toy/foamblade,
/obj/item/toy/AI,
/obj/item/toy/talking/AI,
/obj/item/toy/talking/owl,
/obj/item/toy/talking/griffin,
/obj/item/toy/talking/skeleton,
/obj/item/toy/nuke,
/obj/item/toy/minimeteor,
/obj/item/toy/carpplushie,
+57
View File
@@ -0,0 +1,57 @@
/proc/chatter(message, phomeme, atom/A)
// We want to transform any message into a list of numbers
// and punctuation marks
// For example:
// "Hi." -> [2, '.']
// "HALP GEROGE MELLONS, that swine, is GRIFFIN ME!"
// -> [4, 6, 7, ',', 4, 5, ',', '2', 7, 2, '!']
// "fuck,thissentenceissquashed" -> [4, ',', 21]
var/list/punctuation = list(",",":",";",".","?","!","\'","-")
var/regex/R = regex("(\[\\l\\d]*)(\[^\\l\\d\\s])?", "g")
var/list/letter_count = list()
while(R.next <= length(message))
R.Find(message)
if(R.group[1])
letter_count += length(R.group[1])
if(R.group[2])
letter_count += R.group[2]
spawn(0)
for(var/item in letter_count)
if (item in punctuation)
// simulate pausing in talking
// ignore semi-colons because of their use in HTML escaping
if (item in list(",", ":"))
sleep(3)
if (item in list("!", "?", "."))
sleep(6)
continue
if(isnum(item))
var/length = min(item, 10)
if (length == 0)
// "verbalise" long spaces
sleep(1)
chatter_speak_word(A.loc, phomeme, length)
/proc/chatter_speak_word(loc, phomeme, length)
var/path = "sound/chatter/[phomeme]_[length].ogg"
playsound(loc, path,
vol = 40, vary = 0, extrarange = 3, falloff = FALSE, surround = 1)
sleep((length + 1) * chatter_get_sleep_multiplier(phomeme))
/proc/chatter_get_sleep_multiplier(phomeme)
// These values are tenths of seconds, so 0.5 == 0.05seconds
. = 1
switch(phomeme)
if("papyrus")
. = 0.5
if("griffin")
. = 0.5
if("sans")
. = 0.7
if("owl")
. = 0.7
@@ -370,7 +370,7 @@
say_mod = "rattles"
attack_verb = list("bitten", "chattered", "chomped", "enamelled", "boned")
var/chatter = FALSE
var/chattering = FALSE
var/phomeme_type = "sans"
var/list/phomeme_types = list("sans", "papyrus")
@@ -381,9 +381,9 @@
/obj/item/organ/tongue/bone/TongueSpeech(var/message)
. = message
if(chatter)
if(chattering)
//Annoy everyone nearby with your chattering.
return
chatter(message, phomeme_type, usr)
/obj/item/organ/tongue/bone/get_spans()
. = ..()
@@ -396,7 +396,7 @@
/obj/item/organ/tongue/bone/chatter
name = "chattering bone \"tongue\""
chatter = TRUE
chattering = TRUE
/obj/item/organ/appendix
name = "appendix"