mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-11 07:03:30 +01:00
Prevent language-switching in the middle of a word or number. (#29721)
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user