mirror of
https://github.com/dragonfireclient/dragonfireclient.git
synced 2025-01-08 23:29:52 -05:00
36 lines
723 B
Lua
36 lines
723 B
Lua
chat = {}
|
|
|
|
chat.rainbow = dofile(minetest.get_modpath("chat") .. "/rainbow.lua")
|
|
|
|
function chat.send(message)
|
|
local starts_with = message:sub(1, 1)
|
|
|
|
if starts_with == "/" or starts_with == "." then return end
|
|
|
|
local reverse = minetest.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 color = minetest.settings:get("chat_color")
|
|
|
|
if color then
|
|
local msg
|
|
if color == "rainbow" then
|
|
msg = chat.rainbow(message)
|
|
else
|
|
msg = minetest.colorize(color, message)
|
|
end
|
|
message = msg
|
|
end
|
|
|
|
minetest.send_chat_message(message)
|
|
return true
|
|
end
|
|
|
|
minetest.register_on_sending_chat_message(chat.send)
|