From ddf9827afbb49638c46e0898a0f0cefb48ff0f21 Mon Sep 17 00:00:00 2001 From: SandPoot Date: Thu, 5 Oct 2023 21:24:13 -0300 Subject: [PATCH] lowercasing possible --- code/controllers/configuration/config_entry.dm | 9 +++++++-- code/controllers/configuration/entries/comms.dm | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/code/controllers/configuration/config_entry.dm b/code/controllers/configuration/config_entry.dm index c175e2efb4..a162b87986 100644 --- a/code/controllers/configuration/config_entry.dm +++ b/code/controllers/configuration/config_entry.dm @@ -102,6 +102,8 @@ default = "" abstract_type = /datum/config_entry/string var/auto_trim = TRUE + /// whether the string will be lowercased on ValidateAndSet or not. + var/lowercase = FALSE /datum/config_entry/string/vv_edit_var(var_name, var_value) return var_name != NAMEOF(src, auto_trim) && ..() @@ -110,6 +112,8 @@ if(!VASProcCallGuard(str_val)) return FALSE config_entry_value = auto_trim ? trim(str_val) : str_val + if(lowercase) + config_entry_value = lowertext(config_entry_value) return TRUE /datum/config_entry/number @@ -188,7 +192,8 @@ var/key_mode var/value_mode var/splitter = " " - var/lowercase = TRUE + /// whether the key names will be lowercased on ValidateAndSet or not. + var/lowercase_key = TRUE /datum/config_entry/keyed_list/New() . = ..() @@ -206,7 +211,7 @@ if(key_pos || value_mode == VALUE_MODE_FLAG) key_name = copytext(str_val, 1, key_pos) - if(lowercase) + if(lowercase_key) key_name = lowertext(key_name) if(key_pos) key_value = copytext(str_val, key_pos + length(str_val[key_pos])) diff --git a/code/controllers/configuration/entries/comms.dm b/code/controllers/configuration/entries/comms.dm index 00f1cedf4f..67d214e1c2 100644 --- a/code/controllers/configuration/entries/comms.dm +++ b/code/controllers/configuration/entries/comms.dm @@ -8,6 +8,7 @@ key_mode = KEY_MODE_TEXT value_mode = VALUE_MODE_TEXT protection = CONFIG_ENTRY_LOCKED + lowercase_key = FALSE // The names of the servers are proper nouns. Also required for the cross_comms_name config to work. /datum/config_entry/keyed_list/cross_server/ValidateAndSet(str_val) . = ..()