Skip to content

Commit

Permalink
Refactor and improve slurring
Browse files Browse the repository at this point in the history
  • Loading branch information
dj-34 committed Sep 16, 2024
1 parent 36ebc77 commit 2dae363
Showing 1 changed file with 57 additions and 16 deletions.
73 changes: 57 additions & 16 deletions code/modules/mob/mob_misc_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -250,28 +250,69 @@
for(var/datum/multilingual_say_piece/S in message_pieces)
S.message = stars(S.message, pr)

/proc/slur(phrase, list/slurletters = ("'"))//use a different list as an input if you want to make robots slur with $#@%! characters
// SS220 EDIT. Note: Fully rewrites proc, adding additional phrases
/proc/slur(phrase, list/slurletters = ("'"), strength = 50)
strength = min(50, strength)
phrase = html_decode(phrase)
var/leng = length_char(phrase)
var/counter = length_char(phrase)
var/newphrase = ""
var/newletter = ""
while(counter >= 1)
newletter=copytext_char(phrase, (leng - counter) + 1, (leng - counter) + 2)
if(rand(1,3)==3)
if(lowertext(newletter)=="o") newletter="u"; if(lowertext(newletter)=="о") newletter="у"; if(lowertext(newletter)=="э") newletter="и"
if(lowertext(newletter)=="s") newletter="ch"; if(lowertext(newletter)=="с") newletter="сш"; if(lowertext(newletter)=="г") newletter="х"
if(lowertext(newletter)=="a") newletter="ah"; if(lowertext(newletter)=="а") newletter="ах"
if(lowertext(newletter)=="c") newletter="k"; if(lowertext(newletter)=="ц") newletter="сц"
switch(rand(1,15))
if(1,3,5,8) newletter="[lowertext(newletter)]"
if(2,4,6,15) newletter="[uppertext(newletter)]"
if(7) newletter+=pick(slurletters)
var/lowerletter = ""

for(var/counter = 1 to leng)
newletter = copytext_char(phrase, counter, counter + 1)
lowerletter = lowertext(newletter)

// Character conversion
if(rand(1, 3) == 3)
switch(lowerletter)
if("o")
newletter = "u"
if("о")
newletter = "у"
if("э")
newletter = "и"
if("s")
newletter = "ch"
if("с")
newletter = "сш"
if("г")
newletter = "х"
if("a")
newletter = "ah"
if("а")
newletter = "ах"
if("c")
newletter = "k"
if("ц")
newletter = "сц"

// Random case replacement and adding characters from the slurletters list
switch(rand(1, 15))
if(1, 3, 5, 8)
newletter = lowerletter
if(2, 4, 6, 15)
newletter = uppertext(newletter)
if(7)
newletter += pick(slurletters)
else
pass()
newphrase+="[newletter]"
counter-=1
return newphrase

// Additional phrases
if(rand(1, 100) <= strength * 0.25)
switch(newletter)
if(" ")
newletter = "...эээ..."
if(".")
newletter = "...ммм..."
if("!")
newletter = "...а!..."
if("?")
newletter = "...а?..."

newphrase += newletter

return sanitize(newphrase)

/proc/stutter(phrase, stamina_loss = 0, robotic = FALSE)
phrase = html_decode(phrase)
Expand Down

0 comments on commit 2dae363

Please sign in to comment.