Add modlib.minetest.set_privs

This commit is contained in:
Lars Mueller 2021-09-15 18:51:10 +02:00
parent 20a6bb37d0
commit 490e50c181
2 changed files with 5 additions and 0 deletions

@ -27,6 +27,7 @@ for filename, comps in pairs{
"nodename_matcher", "nodename_matcher",
"playerdata", "playerdata",
"connected_players", "connected_players",
"set_privs",
"register_on_leaveplayer", "register_on_leaveplayer",
"get_mod_info", "get_mod_info",
"get_mod_load_order" "get_mod_load_order"

@ -222,6 +222,10 @@ function connected_players()
end end
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) function register_on_leaveplayer(func)
return minetest["register_on_" .. (minetest.is_singleplayer() and "shutdown" or "leaveplayer")](func) return minetest["register_on_" .. (minetest.is_singleplayer() and "shutdown" or "leaveplayer")](func)
end end