unicode support port wip

This commit is contained in:
Ghommie
2020-01-31 05:32:00 +01:00
parent 55a0e4e55d
commit 188f726ffd
115 changed files with 818 additions and 828 deletions

View File

@@ -232,14 +232,16 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER)
var/b_val
var/g_val
var/color_format = length(input_color)
if(color_format != length_char(input_color))
return 0
if(color_format == 3)
r_val = hex2num(copytext(input_color, 1, 2))*16
g_val = hex2num(copytext(input_color, 2, 3))*16
b_val = hex2num(copytext(input_color, 3, 0))*16
r_val = hex2num(copytext(input_color, 1, 2)) * 16
g_val = hex2num(copytext(input_color, 2, 3)) * 16
b_val = hex2num(copytext(input_color, 3, 0)) * 16
else if(color_format == 6)
r_val = hex2num(copytext(input_color, 1, 3))
g_val = hex2num(copytext(input_color, 3, 5))
b_val = hex2num(copytext(input_color, 5, 0))
b_val = hex2num(copytext(input_color, 5, 7))
else
return 0 //If the color format is not 3 or 6, you're using an unexpected way to represent a color.
@@ -253,7 +255,7 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER)
if(b_val > 255)
b_val = 255
return num2hex(r_val, 2) + num2hex(g_val, 2) + num2hex(b_val, 2)
return copytext(rgb(r_val, g_val, b_val), 2)
/*
Transfer_mind is there to check if mob is being deleted/not going to have a body.
@@ -263,7 +265,7 @@ Works together with spawning an observer, noted above.
/mob/proc/ghostize(can_reenter_corpse = TRUE, special = FALSE, penalize = FALSE, voluntary = FALSE)
penalize = suiciding || penalize // suicide squad.
voluntary_ghosted = voluntary
if(!key || cmptext(copytext(key,1,2),"@") || (SEND_SIGNAL(src, COMSIG_MOB_GHOSTIZE, can_reenter_corpse, special, penalize) & COMPONENT_BLOCK_GHOSTING))
if(!key || key[1] == "@" || (SEND_SIGNAL(src, COMSIG_MOB_GHOSTIZE, can_reenter_corpse, special, penalize) & COMPONENT_BLOCK_GHOSTING))
return //mob has no key, is an aghost or some component hijacked.
stop_sound_channel(CHANNEL_HEARTBEAT) //Stop heartbeat sounds because You Are A Ghost Now
var/mob/dead/observer/ghost = new(src) // Transfer safety to observer spawning proc.
@@ -365,7 +367,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
if(!can_reenter_corpse)
to_chat(src, "<span class='warning'>You cannot re-enter your body.</span>")
return
if(mind.current.key && copytext(mind.current.key,1,2)!="@") //makes sure we don't accidentally kick any clients
if(mind.current.key && mind.current.key[1] != "@") //makes sure we don't accidentally kick any clients
to_chat(usr, "<span class='warning'>Another consciousness is in your body...It is resisting you.</span>")
return
client.change_view(CONFIG_GET(string/default_view))

View File

@@ -1,13 +1,12 @@
/mob/dead/observer/say(message, bubble_type, var/list/spans = list(), sanitize = TRUE, datum/language/language = null, ignore_spam = FALSE, forced = null)
message = trim(copytext(sanitize(message), 1, MAX_MESSAGE_LEN))
message = trim(copytext_char(sanitize(message), 1, MAX_MESSAGE_LEN))
if (!message)
return
var/message_mode = get_message_mode(message)
if(client && (message_mode == MODE_ADMIN || message_mode == MODE_DEADMIN))
message = copytext(message, 3)
if(findtext(message, " ", 1, 2))
message = copytext(message, 2)
message = copytext_char(message, 3)
message = trim_left(message)
if(message_mode == MODE_ADMIN)
client.cmd_admin_say(message)

View File

@@ -4,7 +4,7 @@
var/param = message
var/custom_param = findchar(act, " ")
if(custom_param)
param = copytext(act, custom_param + 1, length(act) + 1)
param = copytext(act, custom_param + length(act[custom_param]))
act = copytext(act, 1, custom_param)
var/datum/emote/E

View File

@@ -185,7 +185,7 @@
var/datum/disease/D = thing
blood_data["viruses"] += D.Copy()
blood_data["blood_DNA"] = copytext(dna.unique_enzymes,1,0)
blood_data["blood_DNA"] = dna.unique_enzymes
blood_data["bloodcolor"] = bloodtype_to_color(dna.blood_type)
if(disease_resistances && disease_resistances.len)
blood_data["resistances"] = disease_resistances.Copy()
@@ -204,7 +204,7 @@
if(!suiciding)
blood_data["cloneable"] = 1
blood_data["blood_type"] = copytext(dna.blood_type,1,0)
blood_data["blood_type"] = dna.blood_type
blood_data["gender"] = gender
blood_data["real_name"] = real_name
blood_data["features"] = dna.features

View File

@@ -120,7 +120,8 @@ Des: Removes all infected images from the alien.
/mob/living/carbon/alien/proc/RemoveInfectionImages()
if (client)
for(var/image/I in client.images)
if(dd_hasprefix_case(I.icon_state, "infected"))
var/searchfor = "infected"
if(findtext(I.icon_state, searchfor, 1, length(searchfor) + 1))
qdel(I)
return

View File

@@ -135,5 +135,6 @@ Des: Removes all images from the mob infected by this embryo
for(var/mob/living/carbon/alien/alien in GLOB.player_list)
if(alien.client)
for(var/image/I in alien.client.images)
if(dd_hasprefix_case(I.icon_state, "infected") && I.loc == C)
var/searchfor = "infected"
if(I.loc == owner && findtext(I.icon_state, searchfor, 1, length(searchfor) + 1))
qdel(I)

View File

@@ -411,17 +411,10 @@
message = null
/datum/emote/living/custom/proc/check_invalid(mob/user, input)
. = TRUE
if(copytext(input,1,5) == "says")
if(stop_bad_mime.Find(input, 1, 1))
to_chat(user, "<span class='danger'>Invalid emote.</span>")
else if(copytext(input,1,9) == "exclaims")
to_chat(user, "<span class='danger'>Invalid emote.</span>")
else if(copytext(input,1,6) == "yells")
to_chat(user, "<span class='danger'>Invalid emote.</span>")
else if(copytext(input,1,5) == "asks")
to_chat(user, "<span class='danger'>Invalid emote.</span>")
else
. = FALSE
return TRUE
return FALSE
/datum/emote/living/custom/run_emote(mob/user, params, type_override = null)
if(jobban_isbanned(user, "emote"))
@@ -433,7 +426,7 @@
to_chat(user, "You cannot send IC messages (muted).")
return FALSE
else if(!params)
var/custom_emote = copytext(sanitize(input("Choose an emote to display.") as message|null), 1, MAX_MESSAGE_LEN) //CIT CHANGE - expands emote textbox
var/custom_emote = stripped_multiline_input("Choose an emote to display.", "Custom Emote", null, MAX_MESSAGE_LEN)
if(custom_emote && !check_invalid(user, custom_emote))
var/type = input("Is this a visible or hearable emote?") as null|anything in list("Visible", "Hearable")
switch(type)

View File

@@ -89,7 +89,7 @@ GLOBAL_LIST_INIT(department_radio_keys, list(
var/static/list/one_character_prefix = list(MODE_HEADSET = TRUE, MODE_ROBOT = TRUE, MODE_WHISPER = TRUE)
if(sanitize)
message = trim(copytext(sanitize(message), 1, MAX_MESSAGE_LEN))
message = trim(copytext_char(sanitize(message), 1, MAX_MESSAGE_LEN))
if(!message || message == "")
return
@@ -99,11 +99,10 @@ GLOBAL_LIST_INIT(department_radio_keys, list(
var/in_critical = InCritical()
if(one_character_prefix[message_mode])
message = copytext(message, 2)
message = copytext_char(message, 2)
else if(message_mode || saymode)
message = copytext(message, 3)
if(findtext(message, " ", 1, 2))
message = copytext(message, 2)
message = copytext_char(message, 3)
message = trim_left(message)
if(message_mode == MODE_ADMIN)
if(client)
@@ -135,11 +134,10 @@ GLOBAL_LIST_INIT(department_radio_keys, list(
// No, you cannot speak in xenocommon just because you know the key
if(can_speak_in_language(message_language))
language = message_language
message = copytext(message, 3)
message = copytext_char(message, 3)
// Trim the space if they said ",0 I LOVE LANGUAGES"
if(findtext(message, " ", 1, 2))
message = copytext(message, 2)
message = trim_left(message)
if(!language)
language = get_default_language()
@@ -167,8 +165,8 @@ GLOBAL_LIST_INIT(department_radio_keys, list(
if(fullcrit)
var/health_diff = round(-HEALTH_THRESHOLD_DEAD + health)
// If we cut our message short, abruptly end it with a-..
var/message_len = length(message)
message = copytext(message, 1, health_diff) + "[message_len > health_diff ? "-.." : "..."]"
var/message_len = length_char(message)
message = copytext_char(message, 1, health_diff) + "[message_len > health_diff ? "-.." : "..."]"
message = Ellipsis(message, 10, 1)
message_mode = MODE_WHISPER_CRIT
succumbed = TRUE
@@ -326,13 +324,13 @@ GLOBAL_LIST_INIT(department_radio_keys, list(
return 1
/mob/living/proc/get_key(message)
var/key = copytext(message, 1, 2)
var/key = message[1]
if(key in GLOB.department_radio_prefixes)
return lowertext(copytext(message, 2, 3))
return lowertext(message[1 + length(key)])
/mob/living/proc/get_message_language(message)
if(copytext(message, 1, 2) == ",")
var/key = copytext(message, 2, 3)
if(message[1] == ",")
var/key = message[1 + length(message[1])]
for(var/ld in GLOB.all_languages)
var/datum/language/LD = ld
if(initial(LD.key) == key)

View File

@@ -82,7 +82,7 @@
if(!client)
return
msg = copytext(msg, 1, MAX_MESSAGE_LEN)
msg = copytext_char(msg, 1, MAX_MESSAGE_LEN)
if(type)
if(type & MSG_VISUAL && eye_blind )//Vision related
@@ -414,7 +414,7 @@ mob/visible_message(message, self_message, blind_message, vision_distance = DEFA
set name = "Add Note"
set category = "IC"
msg = copytext(msg, 1, MAX_MESSAGE_LEN)
msg = copytext_char(msg, 1, MAX_MESSAGE_LEN)
msg = sanitize(msg)
if(mind)
@@ -513,7 +513,7 @@ GLOBAL_VAR_INIT(exploit_warn_spam_prevention, 0)
if(href_list["flavor2_more"])
usr << browse(text("<HTML><HEAD><TITLE>[]</TITLE></HEAD><BODY><TT>[]</TT></BODY></HTML>", name, replacetext(flavor_text_2, "\n", "<BR>")), text("window=[];size=500x200", name))
onclose(usr, "[name]")
if(href_list["flavor_change"])
update_flavor_text()

View File

@@ -42,128 +42,131 @@
else
return 0
/proc/stars(n, pr)
n = html_encode(n)
if (pr == null)
pr = 25
if (pr <= 0)
return null
else
if (pr >= 100)
return n
var/te = n
var/t = ""
n = length(n)
var/p = null
p = 1
while(p <= n)
if ((copytext(te, p, p + 1) == " " || prob(pr)))
t = text("[][]", t, copytext(te, p, p + 1))
/**
* Convert random parts of a passed in message to stars
*
* * phrase - the string to convert
* * probability - probability any character gets changed
*
* This proc is dangerously laggy, avoid it or die
*/
/proc/stars(phrase, probability = 25)
if(probability <= 0)
return phrase
phrase = html_decode(phrase)
var/leng = length(phrase)
. = ""
var/char = ""
for(var/i = 1, i <= leng, i += length(char))
char = phrase[i]
if(char == " " || !prob(probability))
. += char
else
t = text("[]*", t)
p++
return sanitize(t)
. += "*"
return sanitize(.)
/proc/slur(n,var/strength=50)
strength = min(strength,50)
var/phrase = html_decode(n)
/**
* Makes you speak like you're drunk
*/
/proc/slur(phrase, strength = 50)
strength = min(50, strength)
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(rand(1,100)<=strength*0.5)
if(lowertext(newletter)=="o")
newletter="u"
if(lowertext(newletter)=="s")
newletter="ch"
if(lowertext(newletter)=="a")
newletter="ah"
if(lowertext(newletter)=="u")
newletter="oo"
if(lowertext(newletter)=="c")
newletter="k"
if(rand(1,100) <= strength*0.25)
if(newletter==" ")
newletter="...huuuhhh..."
if(newletter==".")
newletter=" BURP!"
if(rand(1,100) <= strength*0.5)
if(rand(1,5) == 1)
newletter+="'"
if(rand(1,5) == 1)
newletter+="[newletter]"
if(rand(1,5) == 1)
newletter+="[newletter][newletter]"
newphrase+="[newletter]";counter-=1
return newphrase
/proc/cultslur(n) // Inflicted on victims of a stun talisman
var/phrase = html_decode(n)
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(rand(1,2)==2)
if(lowertext(newletter)=="o")
newletter="u"
if(lowertext(newletter)=="t")
newletter="ch"
if(lowertext(newletter)=="a")
newletter="ah"
if(lowertext(newletter)=="u")
newletter="oo"
if(lowertext(newletter)=="c")
newletter=" NAR "
if(lowertext(newletter)=="s")
newletter=" SIE "
if(rand(1,4)==4)
if(newletter==" ")
newletter=" no hope... "
if(newletter=="H")
newletter=" IT COMES... "
switch(rand(1,15))
. = ""
var/newletter = ""
var/rawchar = ""
for(var/i = 1, i <= leng, i += length(rawchar))
rawchar = newletter = phrase[i]
if(rand(1,100)<=strength * 0.5)
var/lowerletter = lowertext(newletter)
if(lowerletter == "o")
newletter = "u"
else if(lowerletter == "s")
newletter = "ch"
else if(lowerletter == "a")
newletter = "ah"
else if(lowerletter == "u")
newletter = "oo"
else if(lowerletter == "c")
newletter = "k"
if(rand(1,100) <= strength * 0.25)
if(newletter == " ")
newletter = "...huuuhhh..."
else if(newletter == ".")
newletter = " *BURP*."
switch(rand(1,100) <= strength * 0.5)
if(1)
newletter="'"
newletter += "'"
if(10)
newletter += "[newletter]"
if(20)
newletter += "[newletter][newletter]"
. += "[newletter]"
return sanitize(.)
/// Makes you talk like you got cult stunned, which is slurring but with some dark messages
/proc/cultslur(phrase) // Inflicted on victims of a stun talisman
phrase = html_decode(phrase)
var/leng = length(phrase)
. = ""
var/newletter = ""
var/rawchar = ""
for(var/i = 1, i <= leng, i += length(rawchar))
rawchar = newletter = phrase[i]
if(rand(1, 2) == 2)
var/lowerletter = lowertext(newletter)
if(lowerletter == "o")
newletter = "u"
else if(lowerletter == "t")
newletter = "ch"
else if(lowerletter == "a")
newletter = "ah"
else if(lowerletter == "u")
newletter = "oo"
else if(lowerletter == "c")
newletter = " NAR "
else if(lowerletter == "s")
newletter = " SIE "
if(rand(1, 4) == 4)
if(newletter == " ")
newletter = " no hope... "
else if(newletter == "H")
newletter = " IT COMES... "
switch(rand(1, 15))
if(1)
newletter = "'"
if(2)
newletter+="agn"
newletter += "agn"
if(3)
newletter="fth"
newletter = "fth"
if(4)
newletter="nglu"
newletter = "nglu"
if(5)
newletter="glor"
newphrase+="[newletter]";counter-=1
return newphrase
newletter = "glor"
. += newletter
return sanitize(.)
/proc/stutter(n)
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/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]-[n_letter]-[n_letter]-[n_letter]")//replaces the current letter with this instead.
///Adds stuttering to the message passed in
/proc/stutter(phrase)
phrase = html_decode(phrase)
var/leng = length(phrase)
. = ""
var/newletter = ""
var/rawchar
for(var/i = 1, i <= leng, i += length(rawchar))
rawchar = newletter = phrase[i]
if(prob(80) && !(lowertext(newletter) in list("a", "e", "i", "o", "u", " ")))
if(prob(10))
newletter = "[newletter]-[newletter]-[newletter]-[newletter]"
else if(prob(20))
newletter = "[newletter]-[newletter]-[newletter]"
else if (prob(5))
newletter = ""
else
if (prob(20))
n_letter = text("[n_letter]-[n_letter]-[n_letter]")
else
if (prob(5))
n_letter = null
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 copytext(sanitize(t),1,MAX_MESSAGE_LEN)
newletter = "[newletter]-[newletter]"
. += newletter
return sanitize(.)
/proc/derpspeech(message, stuttering)
message = replacetext(message, " am ", " ")
@@ -183,52 +186,42 @@
return message
/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! */
var/returntext = ""
for(var/i = 1, i <= length(t), i++)
var/letter = copytext(t, i, i+1)
if(prob(50))
if(p >= 70)
/proc/Gibberish(text, replace_characters = FALSE, chance = 50)
text = html_decode(text)
. = ""
var/rawchar = ""
var/letter = ""
var/lentext = length(text)
for(var/i = 1, i <= lentext, i += length(rawchar))
rawchar = letter = text[i]
if(prob(chance))
if(replace_characters)
letter = ""
for(var/j in 1 to rand(0, 2))
letter += pick("#", "@", "*", "&", "%", "$", "/", "<", ">", ";", "*", "*", "*", "*", "*", "*", "*")
. += letter
return sanitize(.)
for(var/j = 1, j <= rand(0, 2), j++)
letter += pick("#","@","*","&","%","$","/", "<", ">", ";","*","*","*","*","*","*","*")
returntext += letter
return returntext
/proc/ninjaspeak(n) //NINJACODE
/*
The difference with stutter is that this proc can stutter more than 1 letter
The issue here is that anything that does not have a space is treated as one word (in many instances). For instance, "LOOKING," is a word, including the comma.
It's fairly easy to fix if dealing with single letters but not so much with compounds of letters./N
*/
var/te = html_decode(n)
var/t = ""
n = length(n)
var/p = 1
while(p <= n)
var/n_letter
var/n_mod = rand(1,4)
if(p+n_mod>n+1)
n_letter = copytext(te, p, n+1)
else
n_letter = copytext(te, p, p+n_mod)
/proc/ninjaspeak(phrase) //NINJACODE
. = ""
var/lentext = length_char(phrase)
var/rawchars = ""
var/letter = ""
for(var/i = 1, i <= lentext, i += length_char(rawchars))
var/end = i + rand(1,4)
letter = rawchars = copytext_char(phrase, i, end > lentext ? 0 : end)
if (prob(50))
if (prob(30))
n_letter = text("[n_letter]-[n_letter]-[n_letter]")
letter = "[letter]-[letter]-[letter]"
else
n_letter = text("[n_letter]-[n_letter]")
else
n_letter = text("[n_letter]")
t = text("[t][n_letter]")
p=p+n_mod
return copytext(sanitize(t),1,MAX_MESSAGE_LEN)
letter = "[letter]-[letter]"
. += letter
return copytext_char(sanitize(.),1,MAX_MESSAGE_LEN)
/proc/shake_camera(mob/M, duration, strength=1)
if(!M || !M.client || duration < 1)

View File

@@ -12,7 +12,7 @@
var/customsayverb = findtext(input, "*")
if(customsayverb && message_mode != MODE_WHISPER_CRIT)
message_mode = MODE_CUSTOM_SAY
return lowertext(copytext(input, 1, customsayverb))
return lowertext(copytext_char(input, 1, customsayverb))
else
return ..()
@@ -35,7 +35,7 @@
to_chat(usr, "<span class='danger'>Speech is currently admin-disabled.</span>")
return
message = trim(copytext(sanitize(message), 1, MAX_MESSAGE_LEN))
message = trim(copytext_char(sanitize(message), 1, MAX_MESSAGE_LEN))
usr.emote("me",1,message,TRUE)
@@ -83,9 +83,9 @@
deadchat_broadcast(rendered, follow_target = src, speaker_key = key)
/mob/proc/check_emote(message)
if(copytext(message, 1, 2) == "*")
emote(copytext(message, 2), intentional = TRUE)
return 1
if(message[1] == "*")
emote(copytext(message, length(message[1]) + 1), intentional = TRUE)
return TRUE
/mob/proc/hivecheck()
return 0
@@ -94,11 +94,11 @@
return LINGHIVE_NONE
/mob/proc/get_message_mode(message)
var/key = copytext(message, 1, 2)
var/key = message[1]
if(key == "#")
return MODE_WHISPER
else if(key == ";")
return MODE_HEADSET
else if(length(message) > 2 && (key in GLOB.department_radio_prefixes))
var/key_symbol = lowertext(copytext(message, 2, 3))
else if((length(message) > (length(key) + 1)) && (key in GLOB.department_radio_prefixes))
var/key_symbol = lowertext(message[length(key) + 1])
return GLOB.department_radio_keys[key_symbol]

View File

@@ -9,25 +9,19 @@
set src in usr
if(usr != src)
to_chat(usr, "No.")
var/msg = stripped_multiline_input(usr, "Set the flavor text in your 'examine' verb. This can also be used for OOC notes and preferences!", "Flavor Text", html_decode(flavor_text), MAX_MESSAGE_LEN*2, TRUE)
var/msg = stripped_multiline_input(usr, "Set the flavor text in your 'examine' verb. This can also be used for OOC notes and preferences!", "Flavor Text", html_decode(flavor_text), MAX_MESSAGE_LEN, TRUE)
if(!isnull(msg))
msg = copytext(msg, 1, MAX_MESSAGE_LEN)
msg = html_encode(msg)
flavor_text = msg
if(msg)
flavor_text = html_encode(msg)
/mob/proc/update_flavor_text_2()
set src in usr
if(usr != src)
to_chat(usr, "No.")
var/msg = stripped_multiline_input(usr, "Set the temporary flavor text in your 'examine' verb. This should be used only for things pertaining to the current round!", "Short-Term Flavor Text", html_decode(flavor_text_2), MAX_MESSAGE_LEN*2, TRUE)
var/msg = stripped_multiline_input(usr, "Set the temporary flavor text in your 'examine' verb. This should be used only for things pertaining to the current round!", "Short-Term Flavor Text", html_decode(flavor_text_2), MAX_MESSAGE_LEN, TRUE)
if(!isnull(msg))
msg = copytext(msg, 1, MAX_MESSAGE_LEN)
msg = html_encode(msg)
flavor_text_2 = msg
if(msg)
flavor_text_2 = html_encode(msg)
/mob/proc/warn_flavor_changed()
@@ -39,19 +33,19 @@
if(flavor_text && flavor_text != "")
// We are decoding and then encoding to not only get correct amount of characters, but also to prevent partial escaping characters being shown.
var/msg = html_decode(replacetext(flavor_text, "\n", " "))
if(length(msg) <= 40)
if(length_char(msg) <= 40)
return "<span class='notice'>[html_encode(msg)]</span>"
else
return "<span class='notice'>[html_encode(copytext(msg, 1, 37))]... <a href='?src=[REF(src)];flavor_more=1'>More...</span></a>"
return "<span class='notice'>[html_encode(copytext_char(msg, 1, 37))]... <a href='?src=[REF(src)];flavor_more=1'>More...</span></a>"
/mob/proc/print_flavor_text_2()
if(flavor_text && flavor_text != "")
// We are decoding and then encoding to not only get correct amount of characters, but also to prevent partial escaping characters being shown.
var/msg = html_decode(replacetext(flavor_text_2, "\n", " "))
if(length(msg) <= 40)
if(length_char(msg) <= 40)
return "<span class='notice'>[html_encode(msg)]</span>"
else
return "<span class='notice'>[html_encode(copytext(msg, 1, 37))]... <a href='?src=[REF(src)];flavor2_more=1'>More...</span></a>"
return "<span class='notice'>[html_encode(copytext_char(msg, 1, 37))]... <a href='?src=[REF(src)];flavor2_more=1'>More...</span></a>"
/mob/proc/get_top_level_mob()
@@ -80,17 +74,10 @@ proc/get_top_level_mob(var/mob/S)
/datum/emote/living/subtle/proc/check_invalid(mob/user, input)
. = TRUE
if(copytext(input,1,5) == "says")
if(stop_bad_mime.Find(input, 1, 1))
to_chat(user, "<span class='danger'>Invalid emote.</span>")
else if(copytext(input,1,9) == "exclaims")
to_chat(user, "<span class='danger'>Invalid emote.</span>")
else if(copytext(input,1,6) == "yells")
to_chat(user, "<span class='danger'>Invalid emote.</span>")
else if(copytext(input,1,5) == "asks")
to_chat(user, "<span class='danger'>Invalid emote.</span>")
else
. = FALSE
return TRUE
return FALSE
/datum/emote/living/subtle/run_emote(mob/user, params, type_override = null)
if(jobban_isbanned(user, "emote"))
@@ -100,7 +87,7 @@ proc/get_top_level_mob(var/mob/S)
to_chat(user, "You cannot send IC messages (muted).")
return FALSE
else if(!params)
var/subtle_emote = copytext(sanitize(input("Choose an emote to display.") as message|null), 1, MAX_MESSAGE_LEN)
var/subtle_emote = stripped_multiline_input("Choose an emote to display.", "Subtle", null, MAX_MESSAGE_LEN)
if(subtle_emote && !check_invalid(user, subtle_emote))
var/type = input("Is this a visible or hearable emote?") as null|anything in list("Visible", "Hearable")
switch(type)
@@ -151,17 +138,10 @@ proc/get_top_level_mob(var/mob/S)
/datum/emote/living/subtler/proc/check_invalid(mob/user, input)
. = TRUE
if(copytext(input,1,5) == "says")
if(stop_bad_mime.Find(input, 1, 1))
to_chat(user, "<span class='danger'>Invalid emote.</span>")
else if(copytext(input,1,9) == "exclaims")
to_chat(user, "<span class='danger'>Invalid emote.</span>")
else if(copytext(input,1,6) == "yells")
to_chat(user, "<span class='danger'>Invalid emote.</span>")
else if(copytext(input,1,5) == "asks")
to_chat(user, "<span class='danger'>Invalid emote.</span>")
else
. = FALSE
return TRUE
return FALSE
/datum/emote/living/subtler/run_emote(mob/user, params, type_override = null)
if(jobban_isbanned(user, "emote"))
@@ -171,7 +151,7 @@ proc/get_top_level_mob(var/mob/S)
to_chat(user, "You cannot send IC messages (muted).")
return FALSE
else if(!params)
var/subtle_emote = copytext(sanitize(input("Choose an emote to display.") as message|null), 1, MAX_MESSAGE_LEN)
var/subtle_emote = stripped_multiline_input(user, "Choose an emote to display.", "Subtler" , null, MAX_MESSAGE_LEN)
if(subtle_emote && !check_invalid(user, subtle_emote))
var/type = input("Is this a visible or hearable emote?") as null|anything in list("Visible", "Hearable")
switch(type)

View File

@@ -42,8 +42,8 @@
// hash the original name?
if(tr_flags & TR_HASHNAME)
O.name = "monkey ([copytext(md5(real_name), 2, 6)])"
O.real_name = "monkey ([copytext(md5(real_name), 2, 6)])"
O.name = "monkey ([copytext_char(md5(real_name), 2, 6)])"
O.real_name = "monkey ([copytext_char(md5(real_name), 2, 6)])"
//handle DNA and other attributes
dna.transfer_identity(O)
@@ -202,7 +202,7 @@
dna.transfer_identity(O)
O.updateappearance(mutcolor_update=1)
if(cmptext("monkey",copytext(O.dna.real_name,1,7)))
if(findtext(O.dna.real_name, "monkey", 1, 7)) //7 == length("monkey") + 1
O.real_name = random_unique_name(O.gender)
O.dna.generate_unique_enzymes(O)
else