diff --git a/code/__DEFINES/say.dm b/code/__DEFINES/say.dm index beeee22df9..49cfba8cd2 100644 --- a/code/__DEFINES/say.dm +++ b/code/__DEFINES/say.dm @@ -81,6 +81,7 @@ //Don't set this very much higher then 1024 unless you like inviting people in to dos your server with message spam #define MAX_MESSAGE_LEN 2048 //Citadel edit: What's the WORST that could happen? +#define MAX_FAVOR_LEN 4096 //double the maximum message length. #define MAX_NAME_LEN 42 #define MAX_BROADCAST_LEN 512 #define MAX_CHARTER_LEN 80 diff --git a/code/__HELPERS/_cit_helpers.dm b/code/__HELPERS/_cit_helpers.dm index 1bde770045..f91892e41e 100644 --- a/code/__HELPERS/_cit_helpers.dm +++ b/code/__HELPERS/_cit_helpers.dm @@ -108,27 +108,37 @@ GLOBAL_VAR_INIT(miscreants_allowed, FALSE) message_admins("[key_name_admin(usr)] manually reloaded mentors") //Flavor Text -/mob/living/carbon/human/verb/set_flavor() +/mob/proc/set_flavor() set name = "Set Flavor Text" set desc = "Sets an extended description of your character's features." set category = "IC" - var/new_flavor = input(src, "Enter your new flavor text:", "Flavor text", null) as message|null + 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", flavor_text, MAX_FAVOR_LEN, TRUE) if(!isnull(new_flavor)) - flavor_text = sanitize(new_flavor) + flavor_text = new_flavor to_chat(src, "Your flavor text has been updated.") //Flavor Text -/mob/living/carbon/human/verb/set_flavor_2() +/mob/proc/set_flavor_2() set name = "Set Temporary Flavor Text" set desc = "Sets a description of your character's current appearance. Use this for emotions, poses etc." set category = "IC" - var/new_flavor = input(src, "Enter your new temporary flavor text:", "Temporary flavor text", null) as message|null + var/new_flavor = 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", flavor_text_2, MAX_FAVOR_LEN, TRUE) if(!isnull(new_flavor)) - flavor_text_2 = sanitize(new_flavor) + flavor_text_2 = new_flavor to_chat(src, "Your temporary flavor text has been updated.") +/mob/proc/print_flavor_text(flavor) + if(!flavor) + return + // 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, "\n", " ")) + if(length_char(msg) <= 40) + return "[html_encode(msg)]" + else + return "[html_encode(copytext_char(msg, 1, 37))]... More..." + //LOOC toggles /client/verb/listen_looc() set name = "Show/Hide LOOC" diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index ba20fdacd2..793a72c1f7 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -1473,9 +1473,8 @@ GLOBAL_LIST_EMPTY(preferences_datums) age = max(min( round(text2num(new_age)), AGE_MAX),AGE_MIN) if("flavor_text") - 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(features["flavor_text"]), MAX_MESSAGE_LEN, 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", features["flavor_text"], MAX_FAVOR_LEN, TRUE) if(msg) - msg = msg features["flavor_text"] = msg if("hair") diff --git a/code/modules/mob/living/carbon/human/examine.dm b/code/modules/mob/living/carbon/human/examine.dm index 7a5fca3562..8e19fa7776 100644 --- a/code/modules/mob/living/carbon/human/examine.dm +++ b/code/modules/mob/living/carbon/human/examine.dm @@ -394,10 +394,10 @@ if(invisible_man) . += "...?" else - var/flavor = print_flavor_text() + var/flavor = print_flavor_text(flavor_text) if(flavor) . += flavor - var/temp_flavor = print_flavor_text_2() + var/temp_flavor = print_flavor_text(flavor_text_2) if(temp_flavor) . += temp_flavor SEND_SIGNAL(src, COMSIG_PARENT_EXAMINE, user, .) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 2b03e22b77..ef3d4cbb98 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -9,6 +9,8 @@ verbs += /mob/living/proc/mob_sleep verbs += /mob/living/proc/lay_down verbs += /mob/living/carbon/human/proc/underwear_toggle //fwee + verbs += /mob/proc/set_flavor + verbs += /mob/proc/set_flavor_2 //initialize limbs first create_bodyparts() diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 0e39f43263..1ca6299efb 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -512,9 +512,6 @@ GLOBAL_VAR_INIT(exploit_warn_spam_prevention, 0) usr << browse(text("