mirror of
https://github.com/appgurueu/modlib.git
synced 2024-08-19 12:54:10 +02:00
Fix modlib.minetest.set_privs
This commit is contained in:
parent
e6fafde8df
commit
2a6846c9a2
@ -222,8 +222,17 @@ function connected_players()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function set_privs(name, privs)
|
function set_privs(name, priv_updates)
|
||||||
return minetest.set_player_privs(name, modlib.table.add_all(minetest.get_player_privs(name), privs))
|
local privs = minetest.get_player_privs(name)
|
||||||
|
for priv, grant in pairs(priv_updates) do
|
||||||
|
if grant then
|
||||||
|
privs[priv] = true
|
||||||
|
else
|
||||||
|
-- May not be set to false; Minetest treats false as truthy in this instance
|
||||||
|
privs[priv] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return minetest.set_player_privs(name, privs)
|
||||||
end
|
end
|
||||||
|
|
||||||
function register_on_leaveplayer(func)
|
function register_on_leaveplayer(func)
|
||||||
|
Loading…
Reference in New Issue
Block a user