From ca987e12553900df5d191483d98c2fcaae4655e9 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Tue, 30 Jan 2018 03:33:30 +0100 Subject: [PATCH] Reorganize some commands --- mods/MISC/mcl_commands/init.lua | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/mods/MISC/mcl_commands/init.lua b/mods/MISC/mcl_commands/init.lua index b76aaff149..23fd884657 100644 --- a/mods/MISC/mcl_commands/init.lua +++ b/mods/MISC/mcl_commands/init.lua @@ -8,7 +8,7 @@ else end local function handle_kill_command(suspect, victim) - if minetest.settings:get_bool("damage_enabled") == false then + if minetest.settings:get_bool("enable_damage") == false then return false, S("Players can't be killed right now, damage has been disabled.") end local victimref = minetest.get_player_by_name(victim) @@ -35,19 +35,19 @@ local function handle_kill_command(suspect, victim) return true end -minetest.register_privilege("kill", { - description = S("Can use /kill"), - give_to_singleplayer = false, -}) -minetest.register_privilege("announce", { - description = S("Can use /say"), - give_to_singleplayer = false, -}) - +if not minetest.registered_privileges["player"] then + minetest.register_privilege("player", { + description = S("Can change player attributes"), + give_to_singleplayer = false, + }) +end +if minetest.registered_chatcommands["kill"] then + minetest.unregister_chatcommand("kill") +end minetest.register_chatcommand("kill", { params = S("[]"), - description = S("Kill player"), - privs = {kill=true}, + description = S("Kill player or yourself"), + privs = {player=true}, func = function(name, param) if(param == "") then -- Selfkill @@ -58,6 +58,10 @@ minetest.register_chatcommand("kill", { end, }) +minetest.register_privilege("announce", { + description = S("Can use /say"), + give_to_singleplayer = false, +}) minetest.register_chatcommand("say", { params = S(""), description = S("Send a message to every player"),