mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-23 13:05:44 +01:00
Unicode support in drunken speech and whispers (#18616)
* fix(slur): use functions that support Unicode Replaces Dreammaker's standard functions with Unicode-enabled anlogs. Fixes a problem with displaying Cyrillic characters in drunk characters' words. * refactor(mob_helpers): use switch in `slur` proc * feature: unicode support in `whisper` Allows you to use the Cyrillic alphabet while whispering * chore: add changelog for #18616 * style(whisper): add spaces to `capytext_char` call Requested-by: FluffyGhoster
This commit is contained in:
@@ -28,11 +28,11 @@
|
||||
|
||||
if(!had_speaking)
|
||||
if(speaking)
|
||||
message = copytext(message,2+length(speaking.key))
|
||||
message = copytext_char(message, 2 + length(speaking.key))
|
||||
else
|
||||
speaking = get_default_language()
|
||||
|
||||
if(length(message) >= 1 && copytext(message, 1, 2) == "%")
|
||||
if(length_char(message) >= 1 && copytext_char(message, 1, 2) == "%")
|
||||
if(speaking?.sing_verb)
|
||||
is_singing = TRUE
|
||||
|
||||
|
||||
@@ -368,7 +368,7 @@ var/list/global/organ_rel_size = list(
|
||||
p = 1
|
||||
var/intag = 0
|
||||
while(p <= n)
|
||||
var/char = copytext(te, p, p + 1)
|
||||
var/char = copytext_char(te, p, p + 1)
|
||||
if (char == "<") //let's try to not break tags
|
||||
intag = !intag
|
||||
if (intag || char == " " || prob(pr))
|
||||
@@ -382,28 +382,35 @@ var/list/global/organ_rel_size = list(
|
||||
|
||||
/proc/slur(phrase, strength = 100)
|
||||
phrase = html_decode(phrase)
|
||||
var/leng=length(phrase)
|
||||
var/counter=length(phrase)
|
||||
var/newphrase=""
|
||||
var/newletter=""
|
||||
while(counter>=1)
|
||||
newletter=copytext(phrase,(leng-counter)+1,(leng-counter)+2)
|
||||
if(prob(strength))
|
||||
if(rand(1,3)==3)
|
||||
if(lowertext(newletter)=="o") newletter="u"
|
||||
if(lowertext(newletter)=="s") newletter="ch"
|
||||
if(lowertext(newletter)=="a") newletter="ah"
|
||||
if(lowertext(newletter)=="c") newletter="k"
|
||||
switch(rand(1,15))
|
||||
if(1,3,5,8)
|
||||
newletter="[lowertext(newletter)]"
|
||||
if(2,4,6,15)
|
||||
newletter="[uppertext(newletter)]"
|
||||
if(7)
|
||||
newletter+="'"
|
||||
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 (prob(strength))
|
||||
if (rand(1, 3) == 3)
|
||||
switch (lowertext(newletter))
|
||||
if ("o")
|
||||
newletter = "u"
|
||||
if ("s")
|
||||
newletter = "ch"
|
||||
if ("a")
|
||||
newletter = "ah"
|
||||
if ("c")
|
||||
newletter = "k"
|
||||
|
||||
switch (rand(1, 15))
|
||||
if (1, 3, 5, 8)
|
||||
newletter = "[lowertext(newletter)]"
|
||||
if (2, 4, 6, 15)
|
||||
newletter = "[uppertext(newletter)]"
|
||||
if (7)
|
||||
newletter += "'"
|
||||
else
|
||||
. = null // For dreamchecker, does nothing
|
||||
newphrase+="[newletter]";counter-=1
|
||||
newphrase += "[newletter]"
|
||||
counter -= 1
|
||||
return newphrase
|
||||
|
||||
/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
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
################################
|
||||
# Example Changelog File
|
||||
#
|
||||
# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
|
||||
#
|
||||
# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
|
||||
# When it is, any changes listed below will disappear.
|
||||
#
|
||||
# Valid Prefixes:
|
||||
# bugfix
|
||||
# wip (For works in progress)
|
||||
# tweak
|
||||
# soundadd
|
||||
# sounddel
|
||||
# rscadd (general adding of nice things)
|
||||
# rscdel (general deleting of nice things)
|
||||
# imageadd
|
||||
# imagedel
|
||||
# maptweak
|
||||
# spellcheck (typo fixes)
|
||||
# experiment
|
||||
# balance
|
||||
# admin
|
||||
# backend
|
||||
# security
|
||||
# refactor
|
||||
#################################
|
||||
|
||||
# Your name.
|
||||
author: SidVeld
|
||||
|
||||
# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
|
||||
delete-after: True
|
||||
|
||||
# Any changes you've made. See valid prefix list above.
|
||||
# INDENT WITH TWO SPACES. NOT TABS. SPACES.
|
||||
# SCREW THIS UP AND IT WON'T WORK.
|
||||
# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
|
||||
# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
|
||||
changes:
|
||||
- tweak: "Slur and whisper procs support unicode."
|
||||
Reference in New Issue
Block a user