]> git.lizzy.rs Git - chateffects.git/commitdiff
Initial Commit
authorElias Fleckenstein <eliasfleckenstein@web.de>
Fri, 11 Dec 2020 17:08:59 +0000 (18:08 +0100)
committerElias Fleckenstein <eliasfleckenstein@web.de>
Fri, 11 Dec 2020 17:08:59 +0000 (18:08 +0100)
README [new file with mode: 0644]
init.lua [new file with mode: 0644]
mod.conf [new file with mode: 0644]
settingtypes.txt [new file with mode: 0644]

diff --git a/README b/README
new file mode 100644 (file)
index 0000000..f729304
--- /dev/null
+++ b/README
@@ -0,0 +1,2 @@
+# chateffects
+A dragonfire CSM that adds Chat Effects (Color, Reversed)
diff --git a/init.lua b/init.lua
new file mode 100644 (file)
index 0000000..4170cca
--- /dev/null
+++ b/init.lua
@@ -0,0 +1,39 @@
+chateffects = {}
+
+function chateffects.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 use_chat_color = minetest.settings:get_bool("use_chat_color")
+       local color = minetest.settings:get("chat_color")
+
+       if use_chat_color and color then
+               local msg
+               if color == "rainbow" then
+                       msg = minetest.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(chateffects.send)
+
+minetest.register_cheat("Colored", "Chat", "use_chat_color")
+minetest.register_cheat("Reversed", "Chat", "chat_reverse")
diff --git a/mod.conf b/mod.conf
new file mode 100644 (file)
index 0000000..55ea2d8
--- /dev/null
+++ b/mod.conf
@@ -0,0 +1,3 @@
+name = chateffects
+author = Fleckenstein
+description = A dragonfire CSM that adds Chat Effects (Color, Reversed)
diff --git a/settingtypes.txt b/settingtypes.txt
new file mode 100644 (file)
index 0000000..07a5bc7
--- /dev/null
@@ -0,0 +1,3 @@
+use_chat_color (Colored) bool false
+chat_reverse (Reversed) bool false
+chat_color (Chat Color) string rainbow