From fd0e59b45a1dd61e78fcb80330aca174a2bda595 Mon Sep 17 00:00:00 2001 From: oranges Date: Tue, 6 Mar 2018 00:32:28 +0000 Subject: [PATCH] Minor say code cleanup Remove two unused procs and move another to the mob/living say where it is used --- code/modules/flufftext/TextFilters.dm | 64 --------------------------- code/modules/mob/living/say.dm | 25 ++++++++++- tgstation.dme | 1 - 3 files changed, 24 insertions(+), 66 deletions(-) delete mode 100644 code/modules/flufftext/TextFilters.dm diff --git a/code/modules/flufftext/TextFilters.dm b/code/modules/flufftext/TextFilters.dm deleted file mode 100644 index 35a78cd49f9..00000000000 --- a/code/modules/flufftext/TextFilters.dm +++ /dev/null @@ -1,64 +0,0 @@ - - -//is this shit even used at all -/proc/NewStutter(phrase,stun) - phrase = html_decode(phrase) - - var/list/split_phrase = splittext(phrase," ") //Split it up into words. - - var/list/unstuttered_words = split_phrase.Copy() - var/i = rand(1,3) - if(stun) i = split_phrase.len - for(,i > 0,i--) //Pick a few words to stutter on. - - if (!unstuttered_words.len) - break - var/word = pick(unstuttered_words) - unstuttered_words -= word //Remove from unstuttered words so we don't stutter it again. - var/index = split_phrase.Find(word) //Find the word in the split phrase so we can replace it. - - //Search for dipthongs (two letters that make one sound.) - var/first_sound = copytext(word,1,3) - var/first_letter = copytext(word,1,2) - if(lowertext(first_sound) in list("ch","th","sh")) - first_letter = first_sound - - //Repeat the first letter to create a stutter. - var/rnum = rand(1,3) - switch(rnum) - if(1) - word = "[first_letter]-[word]" - if(2) - word = "[first_letter]-[first_letter]-[word]" - if(3) - word = "[first_letter]-[word]" - - split_phrase[index] = word - - return sanitize(jointext(split_phrase," ")) - -/proc/Stagger(mob/M,d) //Technically not a filter, but it relates to drunkenness. - step(M, pick(d,turn(d,90),turn(d,-90))) - -/proc/Ellipsis(original_msg, chance = 50, keep_words) - if(chance <= 0) - return "..." - if(chance >= 100) - return original_msg - - var/list - words = splittext(original_msg," ") - new_words = list() - - var/new_msg = "" - - for(var/w in words) - if(prob(chance)) - new_words += "..." - if(!keep_words) - continue - new_words += w - - new_msg = jointext(new_words," ") - - return new_msg diff --git a/code/modules/mob/living/say.dm b/code/modules/mob/living/say.dm index 737069a44d9..11c57c9bbc0 100644 --- a/code/modules/mob/living/say.dm +++ b/code/modules/mob/living/say.dm @@ -59,6 +59,29 @@ GLOBAL_LIST_INIT(department_radio_keys, list( "รท" = "cords" )) +/mob/living/proc/Ellipsis(original_msg, chance = 50, keep_words) + if(chance <= 0) + return "..." + if(chance >= 100) + return original_msg + + var/list + words = splittext(original_msg," ") + new_words = list() + + var/new_msg = "" + + for(var/w in words) + if(prob(chance)) + new_words += "..." + if(!keep_words) + continue + new_words += w + + new_msg = jointext(new_words," ") + + return new_msg + /mob/living/say(message, bubble_type,var/list/spans = list(), sanitize = TRUE, datum/language/language = null, ignore_spam = FALSE) var/static/list/crit_allowed_modes = list(MODE_WHISPER = TRUE, MODE_CHANGELING = TRUE, MODE_ALIEN = TRUE) var/static/list/unconscious_allowed_modes = list(MODE_CHANGELING = TRUE, MODE_ALIEN = TRUE) @@ -381,4 +404,4 @@ GLOBAL_LIST_INIT(department_radio_keys, list( if(.) return . - . = ..() \ No newline at end of file + . = ..() diff --git a/tgstation.dme b/tgstation.dme index f02672076dc..6643901e1d4 100755 --- a/tgstation.dme +++ b/tgstation.dme @@ -1472,7 +1472,6 @@ #include "code\modules\fields\turf_objects.dm" #include "code\modules\flufftext\Dreaming.dm" #include "code\modules\flufftext\Hallucination.dm" -#include "code\modules\flufftext\TextFilters.dm" #include "code\modules\food_and_drinks\food.dm" #include "code\modules\food_and_drinks\pizzabox.dm" #include "code\modules\food_and_drinks\drinks\drinks.dm"