aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOch Noe <och_noe@forksworld.de>2024-01-14 02:44:49 +0100
committerOch Noe <och_noe@forksworld.de>2024-01-14 02:44:49 +0100
commit65521418802bce55e99673d41ae56483a52cfc65 (patch)
tree5b4b699543d85698b33a490b72a80997eec6ee26
parentdf77095ef5509d3dde54449528f58ddfe60fcfdb (diff)
downloadcolour_chat-master.tar.gz
colour_chat-master.tar.bz2
colour_chat-master.zip
disable itself if server setting disallows chat function accessHEADmaster
-rw-r--r--init.lua45
1 files changed, 45 insertions, 0 deletions
diff --git a/init.lua b/init.lua
index cb53412..1893f77 100644
--- a/init.lua
+++ b/init.lua
@@ -178,6 +178,36 @@ end
+local cr = minetest.get_csm_restrictions()
+local limitationlist = { "load_client_mods", "chat_messages", "read_itemdefs",
+ "read_nodedefs", "lookup_nodes", "read_playerinfo" }
+
+local modfunction_limited = {}
+
+if not cr then
+ minetest.display_chat_message("cr == nil")
+ return
+else
+ for _,r in ipairs(limitationlist) do
+ modfunction_limited[r] = true
+ if cr[r] then
+ modfunction_limited[r] = false
+ end
+ end
+end
+
+local function show_restrictions()
+ for _,r in ipairs(limitationlist) do
+ minetest.display_chat_message(string.format("%-20s: %s",r, (modfunction_limited[r] and "allowed") or "forbidden"))
+ end
+end
+
+show_restrictions()
+
+if not modfunction_limited[ "chat_messages" ] then
+ minetest.display_chat_message( "chat_messages".." are forbidden --> not loading")
+ return
+end
local register_on_message = core.register_on_sending_chat_message
if core.register_on_sending_chat_messages then
@@ -527,3 +557,18 @@ core.register_chatcommand("say", {
return true
end,
})
+
+
+
+minetest.display_chat_message( "[CSM colour_chat] loaded")
+
+
+
+
+
+
+
+
+
+
+