mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-27 23:14:18 +01:00
Added toggleable Autohiss for Dionaea (#3881)
The intent is to provide Dionaea players authentic sounding speech according to the currently existing lore. This PR does this by using the already existing autohiss plugin as well as a small custom sentence checker to change the sentence of whatever the player types. This only applies to non-rootsong languages and by default this is disabled. When on basic or full, ellipses are added after the following words: "who","what","when","where","why","how","i'm","i","am","this","they","are","they're","their","his","her","their","the","he","she" When on basic or full, these letters are elongated: "s","z","e" When on full, these letters are elongated: "a","i","o","u" This was made with sleepy wolf's, the dionaea head loremaster, blessing.
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
|
||||
#define AUTOHISS_NUM 3
|
||||
|
||||
|
||||
/mob/living/proc/handle_autohiss(message, datum/language/L)
|
||||
return message // no autohiss at this level
|
||||
|
||||
@@ -39,6 +38,9 @@
|
||||
var/list/autohiss_basic_map = null
|
||||
var/list/autohiss_extra_map = null
|
||||
var/list/autohiss_exempt = null
|
||||
var/list/autohiss_basic_extend = null
|
||||
var/list/autohiss_extra_extend = null
|
||||
var/autohiss_extender = "..."
|
||||
|
||||
/datum/species/unathi
|
||||
autohiss_basic_map = list(
|
||||
@@ -82,45 +84,78 @@
|
||||
)
|
||||
autohiss_exempt = list(LANGUAGE_VAURCA)
|
||||
|
||||
/datum/species/diona
|
||||
|
||||
autohiss_basic_extend = list("who","what","when","where","why","how")
|
||||
autohiss_extra_extend = list("i'm","i","am","this","they","are","they're","their","his","her","their","the","he","she")
|
||||
autohiss_extender = "..."
|
||||
|
||||
autohiss_basic_map = list(
|
||||
"s" = list("ss","sss"),
|
||||
"z" = list("zz","zzz"),
|
||||
"e" = list("ee", "eee")
|
||||
)
|
||||
autohiss_extra_map = list(
|
||||
"a" = list("aa", "aaa"),
|
||||
"i" = list("ii", "iii"),
|
||||
"o" = list("oo", "ooo"),
|
||||
"u" = list("uu", "uuu")
|
||||
)
|
||||
autohiss_exempt = list(
|
||||
LANGUAGE_ROOTSONG
|
||||
)
|
||||
|
||||
/datum/species/proc/handle_autohiss(message, datum/language/lang, mode)
|
||||
if(!autohiss_basic_map)
|
||||
return message
|
||||
|
||||
if(autohiss_exempt && (lang.name in autohiss_exempt))
|
||||
return message
|
||||
// No reason to auto-hiss in sign-language.
|
||||
if (lang.flags && (lang.flags & SIGNLANG))
|
||||
return message
|
||||
|
||||
var/map = autohiss_basic_map.Copy()
|
||||
if(mode == AUTOHISS_FULL && autohiss_extra_map)
|
||||
map |= autohiss_extra_map
|
||||
if(autohiss_extender && autohiss_basic_extend)
|
||||
var/longwords = autohiss_basic_extend.Copy()
|
||||
if(mode == AUTOHISS_FULL && autohiss_extra_extend)
|
||||
longwords |= autohiss_extra_extend
|
||||
|
||||
. = list()
|
||||
var/list/returninglist = list()
|
||||
|
||||
while(length(message))
|
||||
var/min_index = 10000 // if the message is longer than this, the autohiss is the least of your problems
|
||||
var/min_char = null
|
||||
for(var/char in map)
|
||||
var/i = findtext(message, char)
|
||||
if(!i) // no more of this character anywhere in the string, don't even bother searching next time
|
||||
map -= char
|
||||
else if(i < min_index)
|
||||
min_index = i
|
||||
min_char = char
|
||||
if(!min_char) // we didn't find any of the mapping characters
|
||||
. += message
|
||||
break
|
||||
. += copytext(message, 1, min_index)
|
||||
if(copytext(message, min_index, min_index+1) == uppertext(min_char))
|
||||
switch(text2ascii(message, min_index+1))
|
||||
if(65 to 90) // A-Z, uppercase; uppercase R/S followed by another uppercase letter, uppercase the entire replacement string
|
||||
. += uppertext(pick(map[min_char]))
|
||||
else
|
||||
. += capitalize(pick(map[min_char]))
|
||||
else
|
||||
. += pick(map[min_char])
|
||||
message = copytext(message, min_index + 1)
|
||||
for(var/word in text2list(message," ")) // For each word in a message
|
||||
if (lowertext(word) in longwords)
|
||||
word += autohiss_extender
|
||||
returninglist += word
|
||||
message = returninglist.Join(" ")
|
||||
|
||||
if (autohiss_basic_map)
|
||||
var/map = autohiss_basic_map.Copy()
|
||||
if(mode == AUTOHISS_FULL && autohiss_extra_map)
|
||||
map |= autohiss_extra_map
|
||||
|
||||
. = list()
|
||||
|
||||
while(length(message))
|
||||
var/min_index = 10000 // if the message is longer than this, the autohiss is the least of your problems
|
||||
var/min_char = null
|
||||
for(var/char in map)
|
||||
var/i = findtext(message, char)
|
||||
if(!i) // no more of this character anywhere in the string, don't even bother searching next time
|
||||
map -= char
|
||||
else if(i < min_index)
|
||||
min_index = i
|
||||
min_char = char
|
||||
if(!min_char) // we didn't find any of the mapping characters
|
||||
. += message
|
||||
break
|
||||
. += copytext(message, 1, min_index)
|
||||
if(copytext(message, min_index, min_index+1) == uppertext(min_char))
|
||||
switch(text2ascii(message, min_index+1))
|
||||
if(65 to 90) // A-Z, uppercase; uppercase R/S followed by another uppercase letter, uppercase the entire replacement string
|
||||
. += uppertext(pick(map[min_char]))
|
||||
else
|
||||
. += capitalize(pick(map[min_char]))
|
||||
else
|
||||
. += pick(map[min_char])
|
||||
message = copytext(message, min_index + 1)
|
||||
|
||||
return list2text(.)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user