diff options
| author | Och Noe <och_noe@forksworld.de> | 2026-02-25 12:24:00 +0100 |
|---|---|---|
| committer | Och Noe <och_noe@forksworld.de> | 2026-02-25 12:24:00 +0100 |
| commit | 0538faadeba1d51934e1fcb7525ec44f4b3faf78 (patch) | |
| tree | e1b37e32246bd803b46b929f9b796d1a3fe82306 | |
| parent | 65521418802bce55e99673d41ae56483a52cfc65 (diff) | |
| -rw-r--r-- | init.lua | 87 |
1 files changed, 64 insertions, 23 deletions
@@ -337,6 +337,25 @@ local function canTalk() end end + +local function get_status(ausgeben) + local z = true + local sd = modstorage:get("status") + if not sd then z = true + else z = sd == "true" + end + if ausgeben then + minetest.display_chat_message("colourchat is "..((get_status() and "en") or "dis").."abled\n") + end + return z +end + +local function set_status(zustand) + modstorage:set_string("status", tostring(zustand)) + get_status() +end + + local function say(message) if not canTalk() then minetest.display_chat_message("You need 'shout' in order to talk") @@ -397,6 +416,7 @@ function fade(parameter) end register_on_message(function(message) + if not get_status() then return false end if message:sub(1,1) == "/" or modstorage:get_string("colour") == "" or modstorage:get_string("colour") == "white" then return false end @@ -526,29 +546,29 @@ end, -core.register_chatcommand("rainbow", { - description = core.gettext("rainbow text"), - func = function(param) - if not canTalk() then - return false, "You need 'shout' in order to use this command" - end - local step = 360 / param:len() - local hue = 0 - -- iterate the whole 360 degrees - local output = "" - for i = 1, param:len() do - local char = param:sub(i,i) - if char:match("%s") then - output = output .. char - else - output = output .. core.get_color_escape_sequence(color_from_hue(hue)) .. char - end - hue = hue + step - end - say(output) - return true -end, -}) +--core.register_chatcommand("rainbow", { +-- description = core.gettext("rainbow text"), +-- func = function(param) +-- if not canTalk() then +-- return false, "You need 'shout' in order to use this command" +-- end +-- local step = 360 / param:len() +-- local hue = 0 +-- -- iterate the whole 360 degrees +-- local output = "" +-- for i = 1, param:len() do +-- local char = param:sub(i,i) +-- if char:match("%s") then +-- output = output .. char +-- else +-- output = output .. core.get_color_escape_sequence(color_from_hue(hue)) .. char +-- end +-- hue = hue + step +-- end +-- say(output) +-- return true +--end, +--}) core.register_chatcommand("say", { description = core.gettext("Send text without applying colour to it"), @@ -559,6 +579,27 @@ core.register_chatcommand("say", { }) +core.register_chatcommand("colourchat_status", { + description = core.gettext("enable/disable the text colouring"), + func = function(text) + if text == "on" or text == "ein" or + text == "+" or text == "1" then + set_status(true) + elseif text == "off" or text == "aus" + or text == "-" or text == "0" then + set_status(false) + elseif text == "?" or text == "status" + or text == "." or text == "#" + or text == "#" or text == "" then + get_status(true) + else + minetest.display_chat_message(".colourchat_status +|-|1|0..\n") + end + return true + end, +}) + + minetest.display_chat_message( "[CSM colour_chat] loaded") |
