From 03f4fea43c539fa98876ec92d660f05274fdfcaa Mon Sep 17 00:00:00 2001 From: Kyep Date: Sat, 26 Jan 2019 15:41:46 -0800 Subject: [PATCH 1/3] fixes hear_say.dm,162: list index out of bounds error --- code/modules/mob/hear_say.dm | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/code/modules/mob/hear_say.dm b/code/modules/mob/hear_say.dm index 382eb94b4db..a982cf0d5c7 100644 --- a/code/modules/mob/hear_say.dm +++ b/code/modules/mob/hear_say.dm @@ -97,7 +97,7 @@ if(!can_hear()) // INNATE is the flag for audible-emote-language, so we don't want to show an "x talks but you cannot hear them" message if it's set - // if(!language || !(language.flags & INNATE)) + // if(!language || !(language.flags & INNATE)) if(speaker == src) to_chat(src, "You cannot hear yourself speak!") else @@ -158,14 +158,16 @@ message = strip_html_properly(message) var/list/punctuation = list(",", "!", ".", ";", "?") var/list/messages = splittext(message, " ") - var/R = rand(1, messages.len) - var/heardword = messages[R] - if(copytext(heardword,1, 1) in punctuation) - heardword = copytext(heardword,2) - if(copytext(heardword,-1) in punctuation) - heardword = copytext(heardword,1,lentext(heardword)) - heard = "...You hear something about... '[heardword]'..." - + if(messages.len > 1) + var/R = rand(1, messages.len) + var/heardword = messages[R] + if(copytext(heardword,1, 1) in punctuation) + heardword = copytext(heardword,2) + if(copytext(heardword,-1) in punctuation) + heardword = copytext(heardword,1,lentext(heardword)) + heard = "...You hear something about... '[heardword]'..." + else + heard = "...You almost hear something......" else heard = "...You almost hear someone talking..." From 0872474e34d653c6a799c1549f2e35c87cb870a0 Mon Sep 17 00:00:00 2001 From: Kyep Date: Sat, 26 Jan 2019 15:55:51 -0800 Subject: [PATCH 2/3] fixes hear_sleep call too --- code/modules/mob/hear_say.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/mob/hear_say.dm b/code/modules/mob/hear_say.dm index a982cf0d5c7..40b01e85a5d 100644 --- a/code/modules/mob/hear_say.dm +++ b/code/modules/mob/hear_say.dm @@ -70,7 +70,7 @@ sound_vol *= 0.5 if(sleeping || stat == UNCONSCIOUS) - hear_sleep(message_pieces) + hear_sleep(multilingual_to_message(message_pieces)) return 0 var/speaker_name = speaker.name From 43e2f13226643bd2b20663ef881712dd98874c66 Mon Sep 17 00:00:00 2001 From: Kyep Date: Sat, 26 Jan 2019 17:45:36 -0800 Subject: [PATCH 3/3] revert change causing new handling for single-word messages --- code/modules/mob/hear_say.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/mob/hear_say.dm b/code/modules/mob/hear_say.dm index 40b01e85a5d..641450026ba 100644 --- a/code/modules/mob/hear_say.dm +++ b/code/modules/mob/hear_say.dm @@ -158,7 +158,7 @@ message = strip_html_properly(message) var/list/punctuation = list(",", "!", ".", ";", "?") var/list/messages = splittext(message, " ") - if(messages.len > 1) + if(messages.len > 0) var/R = rand(1, messages.len) var/heardword = messages[R] if(copytext(heardword,1, 1) in punctuation)