diff --git a/code/__HELPERS/text.dm b/code/__HELPERS/text.dm index 36dcfed6cfea..967967790b28 100644 --- a/code/__HELPERS/text.dm +++ b/code/__HELPERS/text.dm @@ -30,6 +30,11 @@ text = replacetext(text, char, repl_chars[char]) return text +///Helper for only alphanumeric characters plus common punctuation, spaces, underscore and hyphen _ -. +/proc/replace_non_alphanumeric_plus(text) + var/regex/alphanumeric = regex(@{"[^a-z0-9 ,.?!\-_&]"}, "gi") + return alphanumeric.Replace(text, "") + /proc/readd_quotes(text) var/list/repl_chars = list(""" = "\"", "'" = "'") for(var/char in repl_chars) diff --git a/code/modules/mob/living/carbon/xenomorph/Abilities.dm b/code/modules/mob/living/carbon/xenomorph/Abilities.dm index 0a6e0ff2ca26..cb46b3c6cc26 100644 --- a/code/modules/mob/living/carbon/xenomorph/Abilities.dm +++ b/code/modules/mob/living/carbon/xenomorph/Abilities.dm @@ -75,6 +75,7 @@ X.tunnel_delay = 1 addtimer(CALLBACK(src, PROC_REF(cooldown_end)), 4 MINUTES) var/msg = strip_html(input("Add a description to the tunnel:", "Tunnel Description") as text|null) + msg = replace_non_alphanumeric_plus(msg) var/description if(msg) description = msg diff --git a/code/modules/mob/living/carbon/xenomorph/abilities/burrower/burrower_powers.dm b/code/modules/mob/living/carbon/xenomorph/abilities/burrower/burrower_powers.dm index 6a2071fafc3b..3276705ce9b7 100644 --- a/code/modules/mob/living/carbon/xenomorph/abilities/burrower/burrower_powers.dm +++ b/code/modules/mob/living/carbon/xenomorph/abilities/burrower/burrower_powers.dm @@ -177,6 +177,7 @@ return var/new_name = strip_html(input("Change the description of the tunnel:", "Tunnel Description") as text|null) + new_name = replace_non_alphanumeric_plus(new_name) if(new_name) new_name = "[new_name] ([get_area_name(T)])" log_admin("[key_name(src)] has renamed the tunnel \"[T.tunnel_desc]\" as \"[new_name]\".")