blob: 5b3ca79711c260ef7114bd6db2fbdfbc79b08e13 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
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)
|