From a8429bde8e5e2a6d24347f80b096fe96a5a706e3 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 9 Feb 2017 12:10:30 +0100 Subject: [PATCH] Add real list command, add seed command --- mods/mcl_commands/init.lua | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/mods/mcl_commands/init.lua b/mods/mcl_commands/init.lua index 5e1bb4776e..6c0b0b798e 100644 --- a/mods/mcl_commands/init.lua +++ b/mods/mcl_commands/init.lua @@ -99,7 +99,7 @@ minetest.register_chatcommand("say", { end, }) -minetest.register_chatcommand("setnode", { +minetest.register_chatcommand("setblock", { params = S(",, "), description = S("Set node at given position"), privs = {give=true, interact=true}, @@ -116,10 +116,32 @@ minetest.register_chatcommand("setnode", { minetest.set_node(p, {name=nodestring}) return true, S("@1 spawned.", nodestring) end - return false, S("Invalid parameters (see /help setnode)") + return false, S("Invalid parameters (see /help setblock)") end, }) +minetest.register_chatcommand("list", { + description = "Show who is logged on", + params = "", + privs = {}, + func = function(name) + local players = "" + for _, player in ipairs(minetest.get_connected_players()) do + players = players..player:get_player_name().."\n" + end + minetest.chat_send_player(name, players) + end +}) + +minetest.register_chatcommand("seed", { + description = "Displays the world seed", + params = "", + privs = {}, + func = function(name) + minetest.chat_send_player(name, string.format("%d", minetest.get_mapgen_params().seed)) + end +}) + local function register_chatcommand_alias(alias, cmd) local def = minetest.chatcommands[cmd] minetest.register_chatcommand(alias, def) @@ -127,9 +149,8 @@ end if minecraftaliases then register_chatcommand_alias("?", "help") - register_chatcommand_alias("list", "status") + register_chatcommand_alias("who", "list") register_chatcommand_alias("pardon", "unban") - register_chatcommand_alias("setblock", "setnode") register_chatcommand_alias("stop", "shutdown") register_chatcommand_alias("summon", "spawnentity") register_chatcommand_alias("tell", "msg")