Add "/mods" command to list mods to client
authorMatthew I <matttpt@gmail.com>
Sun, 22 Jul 2012 01:41:27 +0000 (21:41 -0400)
committerPerttu Ahola <celeron55@gmail.com>
Sun, 22 Jul 2012 10:36:10 +0000 (13:36 +0300)
builtin/chatcommands.lua

index a60d3028f5ec3ac61d7770e6af4213f7d175c20c..f9715d92c62751bb11e0cd232be77fe8c8fa00f1 100644 (file)
@@ -371,3 +371,20 @@ minetest.register_chatcommand("set", {
        end,
 })
 
+minetest.register_chatcommand("mods", {
+       params = "",
+       description = "lists mods installed on the server",
+       privs = {},
+       func = function(name, param)
+               local response = ""
+               local modnames = minetest.get_modnames()
+               for i, mod in ipairs(modnames) do
+                       response = response .. mod
+                       -- Add space if not at the end
+                       if i ~= #modnames then
+                               response = response .. " "
+                       end
+               end
+               minetest.chat_send_player(name, response)
+       end,
+})
\ No newline at end of file