From 490e50c18139e44f752457a45c7f6e237ab7c1b9 Mon Sep 17 00:00:00 2001 From: Lars Mueller Date: Wed, 15 Sep 2021 18:51:10 +0200 Subject: [PATCH] Add modlib.minetest.set_privs --- minetest.lua | 1 + minetest/misc.lua | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/minetest.lua b/minetest.lua index 4966715..7966627 100644 --- a/minetest.lua +++ b/minetest.lua @@ -27,6 +27,7 @@ for filename, comps in pairs{ "nodename_matcher", "playerdata", "connected_players", + "set_privs", "register_on_leaveplayer", "get_mod_info", "get_mod_load_order" diff --git a/minetest/misc.lua b/minetest/misc.lua index 37fd58b..fedec68 100644 --- a/minetest/misc.lua +++ b/minetest/misc.lua @@ -222,6 +222,10 @@ function connected_players() end end +function set_privs(name, privs) + return minetest.set_player_privs(name, modlib.table.add_all(minetest.get_player_privs(name), privs)) +end + function register_on_leaveplayer(func) return minetest["register_on_" .. (minetest.is_singleplayer() and "shutdown" or "leaveplayer")](func) end