mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-18 02:24:11 +01:00
Autohiss
This commit adds a system (fully client-toggled) to allow unathi and tajaran to "auto-hiss". This means that, for unathi, "S" will be automatically extended to "Ss", "Sss", or "Ssss". Which one it changes is based on a random pick(). There are three modes, off, basic, full. Off, is obviously, off. It does nothing. This is the default setting. Basic, for unathi, enables the S extensions, and for tajaran, enables the "R" extending. Full, for unathi, enables the S extensions, alongside replacing "X" with "Ks". It does not currently do anything extra for Tajaran. Sinta'Unathi is unaffected for Unathi, Siik'Tajr is unaffected for Tajaran. On baystation, NO_STUTTER languages would also be unaffected (the noise language). However, we do not have NO_STUTTER languages. So it hilariously does affect the noise language. "Zartulnal Hharar dancess."
This commit is contained in:
@@ -0,0 +1,95 @@
|
||||
|
||||
#define AUTOHISS_OFF 0
|
||||
#define AUTOHISS_BASIC 1
|
||||
#define AUTOHISS_FULL 2
|
||||
|
||||
#define AUTOHISS_NUM 3
|
||||
|
||||
|
||||
/mob/living/proc/handle_autohiss(message, datum/language/L)
|
||||
return message // no autohiss at this level
|
||||
|
||||
/mob/living/carbon/human/handle_autohiss(message, datum/language/L)
|
||||
if(!client || client.autohiss_mode == AUTOHISS_OFF) // no need to process if there's no client or they have autohiss off
|
||||
return message
|
||||
return species.handle_autohiss(message, L, client.autohiss_mode)
|
||||
|
||||
/client
|
||||
var/autohiss_mode = AUTOHISS_OFF
|
||||
|
||||
/client/verb/toggle_autohiss()
|
||||
set name = "Toggle Auto-Hiss"
|
||||
set desc = "Toggle automatic hissing as Unathi and r-rolling as Taj"
|
||||
set category = "OOC"
|
||||
|
||||
autohiss_mode = (autohiss_mode + 1) % AUTOHISS_NUM
|
||||
switch(autohiss_mode)
|
||||
if(AUTOHISS_OFF)
|
||||
src << "Auto-hiss is now OFF."
|
||||
if(AUTOHISS_BASIC)
|
||||
src << "Auto-hiss is now BASIC."
|
||||
if(AUTOHISS_FULL)
|
||||
src << "Auto-hiss is now FULL."
|
||||
else
|
||||
autohiss_mode = AUTOHISS_OFF
|
||||
src << "Auto-hiss is now OFF."
|
||||
|
||||
/datum/species
|
||||
var/list/autohiss_basic_map = null
|
||||
var/list/autohiss_extra_map = null
|
||||
var/list/autohiss_exempt = null
|
||||
|
||||
/datum/species/unathi
|
||||
autohiss_basic_map = list(
|
||||
"s" = list("ss", "sss", "ssss")
|
||||
)
|
||||
autohiss_extra_map = list(
|
||||
"x" = list("ks", "kss", "ksss")
|
||||
)
|
||||
autohiss_exempt = list("Sinta'unathi")
|
||||
|
||||
/datum/species/tajaran
|
||||
autohiss_basic_map = list(
|
||||
"r" = list("rr", "rrr", "rrrr")
|
||||
)
|
||||
autohiss_exempt = list("Siik'tajr")
|
||||
|
||||
|
||||
/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
|
||||
|
||||
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))
|
||||
. += capitalize(pick(map[min_char]))
|
||||
else
|
||||
. += pick(map[min_char])
|
||||
message = copytext(message, min_index + 1)
|
||||
|
||||
return list2text(.)
|
||||
|
||||
#undef AUTOHISS_OFF
|
||||
#undef AUTOHISS_BASIC
|
||||
#undef AUTOHISS_FULL
|
||||
#undef AUTOHISS_NUM
|
||||
@@ -152,6 +152,8 @@ proc/get_radio_key_from_channel(var/channel)
|
||||
|
||||
message = trim_left(message)
|
||||
|
||||
message = handle_autohiss(message, speaking)
|
||||
|
||||
var/list/handle_s = handle_speech_problems(message, verb)
|
||||
message = handle_s[1]
|
||||
verb = handle_s[2]
|
||||
|
||||
Reference in New Issue
Block a user