diff options
Diffstat (limited to 'builtin/client/cheats')
-rw-r--r-- | builtin/client/cheats/chat.lua | 35 | ||||
-rw-r--r-- | builtin/client/cheats/init.lua | 8 |
2 files changed, 40 insertions, 3 deletions
diff --git a/builtin/client/cheats/chat.lua b/builtin/client/cheats/chat.lua index 1b8094768..1f3ecbaa2 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("use_chat_color") + local color = core.settings:get("chat_color") + + if 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) + diff --git a/builtin/client/cheats/init.lua b/builtin/client/cheats/init.lua index 8d634a766..6fd78b8b8 100644 --- a/builtin/client/cheats/init.lua +++ b/builtin/client/cheats/init.lua @@ -37,8 +37,8 @@ core.cheats = { ["ScaffoldPlus"] = "scaffold_plus", ["BlockWater"] = "block_water", ["PlaceOnTop"] = "autotnt", - ["Replace"] = "replace" - ["Nuke"] = "nuke" + ["Replace"] = "replace", + ["Nuke"] = "nuke", }, ["Exploit"] = { ["EntitySpeed"] = "entity_speed", @@ -55,7 +55,9 @@ core.cheats = { }, ["Chat"] = { ["IgnoreStatus"] = "ignore_status_messages", - ["Deathmessages"] = "mark_deathmessages" + ["Deathmessages"] = "mark_deathmessages", + ["ColoredChat"] = "use_chat_color", + ["ReversedChat"] = "chat_reverse", }, ["Inventory"] = { ["AutoEject"] = "autoeject", |