From 146b2a35f2c74a6194de54951d6eb369672f1502 Mon Sep 17 00:00:00 2001 From: Putnam Date: Fri, 21 Feb 2020 00:26:42 -0800 Subject: [PATCH 1/2] fixed temp flavor text (for real) --- code/__HELPERS/_cit_helpers.dm | 11 +++++++++++ code/modules/mob/living/carbon/human/examine.dm | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/code/__HELPERS/_cit_helpers.dm b/code/__HELPERS/_cit_helpers.dm index 26910a916b..84cbe5abeb 100644 --- a/code/__HELPERS/_cit_helpers.dm +++ b/code/__HELPERS/_cit_helpers.dm @@ -139,6 +139,17 @@ GLOBAL_VAR_INIT(miscreants_allowed, FALSE) else return "[html_encode(copytext_char(msg, 1, 37))]... More..." +/mob/proc/print_flavor_text_2(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/mob/living/carbon/human/examine.dm b/code/modules/mob/living/carbon/human/examine.dm index 8e19fa7776..e93340b71e 100644 --- a/code/modules/mob/living/carbon/human/examine.dm +++ b/code/modules/mob/living/carbon/human/examine.dm @@ -397,7 +397,7 @@ var/flavor = print_flavor_text(flavor_text) if(flavor) . += flavor - var/temp_flavor = print_flavor_text(flavor_text_2) + var/temp_flavor = print_flavor_text_2(flavor_text_2) if(temp_flavor) . += temp_flavor SEND_SIGNAL(src, COMSIG_PARENT_EXAMINE, user, .) From d328d554ba6d9e16575347dd021ae344ba6ab616 Mon Sep 17 00:00:00 2001 From: Putnam Date: Sat, 22 Feb 2020 02:38:57 -0800 Subject: [PATCH 2/2] Reduced copypasta --- code/__HELPERS/_cit_helpers.dm | 15 ++------------- code/modules/mob/living/carbon/human/examine.dm | 2 +- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/code/__HELPERS/_cit_helpers.dm b/code/__HELPERS/_cit_helpers.dm index 84cbe5abeb..a26b9285d4 100644 --- a/code/__HELPERS/_cit_helpers.dm +++ b/code/__HELPERS/_cit_helpers.dm @@ -129,7 +129,7 @@ GLOBAL_VAR_INIT(miscreants_allowed, FALSE) flavor_text_2 = new_flavor to_chat(src, "Your temporary flavor text has been updated.") -/mob/proc/print_flavor_text(flavor) +/mob/proc/print_flavor_text(flavor,temp = FALSE) 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. @@ -137,18 +137,7 @@ GLOBAL_VAR_INIT(miscreants_allowed, FALSE) if(length_char(msg) <= 40) return "[html_encode(msg)]" else - return "[html_encode(copytext_char(msg, 1, 37))]... More..." - -/mob/proc/print_flavor_text_2(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..." - + return "[html_encode(copytext_char(msg, 1, 37))]... More..." //LOOC toggles /client/verb/listen_looc() diff --git a/code/modules/mob/living/carbon/human/examine.dm b/code/modules/mob/living/carbon/human/examine.dm index e93340b71e..fec82b357f 100644 --- a/code/modules/mob/living/carbon/human/examine.dm +++ b/code/modules/mob/living/carbon/human/examine.dm @@ -397,7 +397,7 @@ var/flavor = print_flavor_text(flavor_text) if(flavor) . += flavor - var/temp_flavor = print_flavor_text_2(flavor_text_2) + var/temp_flavor = print_flavor_text(flavor_text_2,TRUE) if(temp_flavor) . += temp_flavor SEND_SIGNAL(src, COMSIG_PARENT_EXAMINE, user, .)