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 Oct 10, 2024
1 parent e42f422 commit 1cadb31
Showing 1 changed file with 58 additions and 33 deletions.
91 changes: 58 additions & 33 deletions code/modules/mob/mob_misc_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -261,44 +261,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/list/newphrase = list()
var/newletter
while(counter >= 1)
newletter = copytext_char(phrase, (leng - counter) + 1, (leng - counter) + 2)
if(prob(33.33))
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) == "a")
newletter = "ah"
if(lowertext(newletter) == "а")
newletter = "ах"
if(lowertext(newletter) == "c")
newletter = "k"
if(lowertext(newletter) == "ц")
newletter = "сц"
if(prob(60))
if(prob(11.11))
var/newphrase = ""
var/newletter = ""
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
if(prob(50))
newletter = lowertext(newletter)
else
newletter = uppertext(newletter)
pass()

Check failure on line 310 in code/modules/mob/mob_misc_procs.dm

View workflow job for this annotation

GitHub Actions / Run Linters

undefined proc: "pass" on (global)

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

newphrase += newletter
counter -= 1
return newphrase.Join("")

return sanitize(newphrase)

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

0 comments on commit 1cadb31

Please sign in to comment.