From 3d761e4b5f8b49caf10bc4ae39a22957d25089f1 Mon Sep 17 00:00:00 2001
From: QuoteFox <49098813+quotefox@users.noreply.github.com>
Date: Sun, 7 Feb 2021 02:57:51 +0000
Subject: [PATCH] autocorrect toggle
---
code/__HELPERS/text.dm | 2 ++
code/modules/client/preferences.dm | 4 ++++
code/modules/client/preferences_savefile.dm | 2 ++
code/modules/mob/living/say.dm | 5 ++++-
4 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/code/__HELPERS/text.dm b/code/__HELPERS/text.dm
index 27420be0..9ed263d5 100644
--- a/code/__HELPERS/text.dm
+++ b/code/__HELPERS/text.dm
@@ -809,6 +809,8 @@ GLOBAL_LIST_INIT(binary, list("0","1"))
"couldnt"="couldn’t",
"wouldnt"="wouldn’t",
"mustnt"="mustn’t",
+ " alot "=" a lot ",
+ " allthough"=" although",
"shouldnt"="shouldn’t"
))
diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm
index f5d1db1a..149f66a5 100644
--- a/code/modules/client/preferences.dm
+++ b/code/modules/client/preferences.dm
@@ -46,6 +46,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
var/buttons_locked = FALSE
var/hotkeys = FALSE
var/chat_on_map = TRUE
+ var/autocorrect = TRUE
var/radiosounds = TRUE
var/max_chat_length = CHAT_MESSAGE_MAX_LENGTH
var/see_chat_non_mob = TRUE
@@ -921,6 +922,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
dat += "Chat Bubbles message char limit: [max_chat_length]
"
dat += "Chat Bubbles for non-mobs: [see_chat_non_mob ? "Enabled" : "Disabled"]
"
dat += "
"
+ dat += "Autocorrect: [(autocorrect) ? "On" : "Off"]
"
dat += "Radio Sounds: [radiosounds ? "Enabled" : "Disabled"]
"
dat += "
"
dat += "Action Buttons: [(buttons_locked) ? "Locked In Place" : "Unlocked"]
"
@@ -2480,6 +2482,8 @@ GLOBAL_LIST_EMPTY(preferences_datums)
buttons_locked = !buttons_locked
if("chat_on_map")
chat_on_map = !chat_on_map
+ if("autocorrect")
+ autocorrect = !autocorrect
if("radiosounds")
radiosounds = !radiosounds
if("see_chat_non_mob")
diff --git a/code/modules/client/preferences_savefile.dm b/code/modules/client/preferences_savefile.dm
index d2548164..90b4d0d8 100644
--- a/code/modules/client/preferences_savefile.dm
+++ b/code/modules/client/preferences_savefile.dm
@@ -108,6 +108,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
S["uses_glasses_colour"]>> uses_glasses_colour
S["clientfps"] >> clientfps
S["chat_on_map"] >> chat_on_map
+ S["autocorrect"] >> autocorrect
S["radiosounds"] >> radiosounds
S["max_chat_length"] >> max_chat_length
S["see_chat_non_mob"] >> see_chat_non_mob
@@ -146,6 +147,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
lastchangelog = sanitize_text(lastchangelog, initial(lastchangelog))
UI_style = sanitize_inlist(UI_style, GLOB.available_ui_styles, GLOB.available_ui_styles[1])
hotkeys = sanitize_integer(hotkeys, 0, 1, initial(hotkeys))
+ autocorrect = sanitize_integer(autocorrect, 0, 1, initial(autocorrect))
chat_on_map = sanitize_integer(chat_on_map, 0, 1, initial(chat_on_map))
radiosounds = sanitize_integer(radiosounds, 0, 1, initial(radiosounds))
max_chat_length = sanitize_integer(max_chat_length, 1, CHAT_MESSAGE_MAX_LENGTH, initial(max_chat_length))
diff --git a/code/modules/mob/living/say.dm b/code/modules/mob/living/say.dm
index 42d6011a..6c72662e 100644
--- a/code/modules/mob/living/say.dm
+++ b/code/modules/mob/living/say.dm
@@ -174,7 +174,10 @@ GLOBAL_LIST_INIT(department_radio_keys, list(
src.log_talk(message, LOG_SAY, forced_by=forced)
message = treat_message(message) // unfortunately we still need this
- message = autocorrect(message)
+
+ if(client?.prefs.autocorrect)
+ message = autocorrect(message)
+
var/sigreturn = SEND_SIGNAL(src, COMSIG_MOB_SAY, args)
if (sigreturn & COMPONENT_UPPERCASE_SPEECH)
message = uppertext(message)