aboutsummaryrefslogtreecommitdiff
path: root/builtin/client/cheats/chat.lua
diff options
context:
space:
mode:
authorElias Fleckenstein <54945686+EliasFleckenstein03@users.noreply.github.com>2020-11-04 14:40:00 +0100
committerGitHub <noreply@github.com>2020-11-04 14:40:00 +0100
commitfc8c8f01ca15912b1db176fec473bcfb0333032f (patch)
tree08182e80b69d5352f81c6827d3caa4efe13e6f14 /builtin/client/cheats/chat.lua
parent61e2b3a33190d5979bc2e36f9734cebd18465f26 (diff)
parenta7dc1135e94bde5f8c3385d54388563eaffe7553 (diff)
downloaddragonfireclient-fc8c8f01ca15912b1db176fec473bcfb0333032f.tar.xz
Merge branch 'master' into master
Diffstat (limited to 'builtin/client/cheats/chat.lua')
-rw-r--r--builtin/client/cheats/chat.lua35
1 files changed, 35 insertions, 0 deletions
diff --git a/builtin/client/cheats/chat.lua b/builtin/client/cheats/chat.lua
index 1b8094768..0763909df 100644
--- a/builtin/client/cheats/chat.lua
+++ b/builtin/client/cheats/chat.lua
@@ -6,3 +6,38 @@ core.register_on_receiving_chat_message(function(message)
return true
end
end)
+
+function core.send_colorized(message)
+ local starts_with = message:sub(1, 1)
+
+ if starts_with == "/" or starts_with == "." then return end
+
+ local reverse = core.settings:get_bool("chat_reverse")
+
+ if reverse then
+ local msg = ""
+ for i = 1, #message do
+ msg = message:sub(i, i) .. msg
+ end
+ message = msg
+ end
+
+ local use_chat_color = core.settings:get_bool("use_chat_color")
+ local color = core.settings:get("chat_color")
+
+ if use_chat_color and color then
+ local msg
+ if color == "rainbow" then
+ msg = core.rainbow(message)
+ else
+ msg = core.colorize(color, message)
+ end
+ message = msg
+ end
+
+ core.send_chat_message(message)
+ return true
+end
+
+core.register_on_sending_chat_message(core.send_colorized)
+