Prevent language-switching in the middle of a word or number. (#29721)

This commit is contained in:
Charlie Nolan
2025-07-04 22:27:04 -07:00
committed by GitHub
parent ac8c93e9ce
commit c1085db91d
2 changed files with 11 additions and 1 deletions
+10 -1
View File
@@ -159,8 +159,17 @@
/mob/proc/find_valid_prefixes(message)
var/list/prefixes = list() // [["Common", start, end], ["Gutter", start, end]]
var/lower_message = lowertext(message)
var/is_alphanumeric = FALSE
var/was_alphanumeric = FALSE
for(var/i in 1 to length(message))
var/selection = trim_right(lowertext(copytext(message, i, i + 3)))
was_alphanumeric = is_alphanumeric
is_alphanumeric = GLOB.is_alphanumeric.Find(lower_message[i])
if(was_alphanumeric)
// Language prefixes should not activate in the middle of a word or number.
continue
var/selection = trim_right(copytext(lower_message, i, i + 3))
var/datum/language/L = GLOB.language_keys[selection]
if(L != null && can_speak_language(L)) // What the fuck... remove the L != null check if you ever find out what the fuck is adding `null` to the languages list on absolutely random mobs... seriously what the hell...
prefixes[++prefixes.len] = list(L, i, i + length(selection))