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