Merge pull request #4339 from FlattestGuitar/roboslur

Robutts slur and stammer robotically
This commit is contained in:
Fox McCloud
2016-05-05 21:39:30 -04:00
2 changed files with 39 additions and 8 deletions
+10 -4
View File
@@ -70,7 +70,7 @@ proc/get_radio_key_from_channel(var/channel)
/mob/living/proc/handle_speech_problems(var/message, var/verb)
var/list/returns[3]
var/speech_problem_flag = 0
var/robot = isSynthetic()
if((HULK in mutations) && health >= 25 && length(message))
@@ -79,11 +79,17 @@ proc/get_radio_key_from_channel(var/channel)
speech_problem_flag = 1
if(slurring)
message = slur(message)
if(robot)
message = slur(message, list("@", "!", "#", "$", "%", "&", "?"))
else
message = slur(message)
verb = "slurs"
speech_problem_flag = 1
if(stuttering)
message = stutter(message)
if(robot)
message = robostutter(message)
else
message = stutter(message)
verb = "stammers"
speech_problem_flag = 1
@@ -450,4 +456,4 @@ proc/get_radio_key_from_channel(var/channel)
/mob/living/speech_bubble(var/bubble_state = "",var/bubble_loc = src, var/list/bubble_recipients = list())
var/image/I = image('icons/mob/talk.dmi', bubble_loc, bubble_state, MOB_LAYER + 1)
I.appearance_flags = APPEARANCE_UI_IGNORE_ALPHA
flick_overlay(I, bubble_recipients, 30)
flick_overlay(I, bubble_recipients, 30)
+29 -4
View File
@@ -323,7 +323,7 @@ proc/getsensorlevel(A)
p++
return t
proc/slur(phrase)
proc/slur(phrase, var/list/slurletters = ("'"))//use a different list as an input if you want to make robots slur with $#@%! characters
phrase = html_decode(phrase)
var/leng=lentext(phrase)
var/counter=lentext(phrase)
@@ -339,11 +339,12 @@ proc/slur(phrase)
switch(rand(1,15))
if(1,3,5,8) newletter="[lowertext(newletter)]"
if(2,4,6,15) newletter="[uppertext(newletter)]"
if(7) newletter+="'"
if(7) newletter+=pick(slurletters)
//if(9,10) newletter="<b>[newletter]</b>"
//if(11,12) newletter="<big>[newletter]</big>"
//if(13) newletter="<small>[newletter]</small>"
newphrase+="[newletter]";counter-=1
newphrase+="[newletter]"
counter-=1
return newphrase
/proc/stutter(n)
@@ -369,6 +370,30 @@ proc/slur(phrase)
p++//for each letter p is increased to find where the next letter will be.
return sanitize(copytext(t,1,MAX_MESSAGE_LEN))
/proc/robostutter(n) //for robutts
var/te = html_decode(n)
var/t = ""//placed before the message. Not really sure what it's for.
n = length(n)//length of the entire word
var/p = null
p = 1//1 is the start of any word
while(p <= n)//while P, which starts at 1 is less or equal to N which is the length.
var/robotletter = pick("@", "!", "#", "$", "%", "&", "?") //for beep boop
var/n_letter = copytext(te, p, p + 1)//copies text from a certain distance. In this case, only one letter at a time.
if (prob(80) && (ckey(n_letter) in list("b","c","d","f","g","h","j","k","l","m","n","p","q","r","s","t","v","w","x","y","z")))
if (prob(10))
n_letter = text("[n_letter]-[robotletter]-[n_letter]-[n_letter]")//replaces the current letter with this instead.
else
if (prob(20))
n_letter = text("[n_letter]-[robotletter]-[n_letter]")
else
if (prob(5))
n_letter = robotletter
else
n_letter = text("[n_letter]-[n_letter]")
t = text("[t][n_letter]")//since the above is ran through for each letter, the text just adds up back to the original word.
p++//for each letter p is increased to find where the next letter will be.
return sanitize(copytext(t,1,MAX_MESSAGE_LEN))
proc/Gibberish(t, p)//t is the inputted message, and any value higher than 70 for p will cause letters to be replaced instead of added
/* Turn text into complete gibberish! */
@@ -668,4 +693,4 @@ var/list/intents = list(I_HELP,I_DISARM,I_GRAB,I_HARM)
if(!newname) //we'll stick with the oldname then
return
rename_character(oldname, newname)
rename_character(oldname, newname)