2012-04-01 05:37:41 -04:00
|
|
|
-- Minetest: builtin/privileges.lua
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Privileges
|
|
|
|
--
|
|
|
|
|
2014-04-27 21:02:48 -04:00
|
|
|
core.registered_privileges = {}
|
2012-04-01 05:37:41 -04:00
|
|
|
|
2014-04-27 21:02:48 -04:00
|
|
|
function core.register_privilege(name, param)
|
2012-04-01 05:37:41 -04:00
|
|
|
local function fill_defaults(def)
|
|
|
|
if def.give_to_singleplayer == nil then
|
|
|
|
def.give_to_singleplayer = true
|
|
|
|
end
|
|
|
|
if def.description == nil then
|
|
|
|
def.description = "(no description)"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
local def = {}
|
|
|
|
if type(param) == "table" then
|
|
|
|
def = param
|
|
|
|
else
|
|
|
|
def = {description = param}
|
|
|
|
end
|
|
|
|
fill_defaults(def)
|
2014-04-27 21:02:48 -04:00
|
|
|
core.registered_privileges[name] = def
|
2012-04-01 05:37:41 -04:00
|
|
|
end
|
|
|
|
|
2014-04-27 21:02:48 -04:00
|
|
|
core.register_privilege("interact", "Can interact with things and modify the world")
|
|
|
|
core.register_privilege("teleport", "Can use /teleport command")
|
|
|
|
core.register_privilege("bring", "Can teleport other players")
|
|
|
|
core.register_privilege("settime", "Can use /time")
|
|
|
|
core.register_privilege("privs", "Can modify privileges")
|
|
|
|
core.register_privilege("basic_privs", "Can modify 'shout' and 'interact' privileges")
|
|
|
|
core.register_privilege("server", "Can do server maintenance stuff")
|
|
|
|
core.register_privilege("shout", "Can speak in chat")
|
|
|
|
core.register_privilege("ban", "Can ban and unban players")
|
|
|
|
core.register_privilege("kick", "Can kick players")
|
|
|
|
core.register_privilege("give", "Can use /give and /giveme")
|
|
|
|
core.register_privilege("password", "Can use /setpassword and /clearpassword")
|
|
|
|
core.register_privilege("fly", {
|
2012-04-01 05:37:41 -04:00
|
|
|
description = "Can fly using the free_move mode",
|
|
|
|
give_to_singleplayer = false,
|
|
|
|
})
|
2014-04-27 21:02:48 -04:00
|
|
|
core.register_privilege("fast", {
|
2012-04-01 05:37:41 -04:00
|
|
|
description = "Can walk fast using the fast_move mode",
|
|
|
|
give_to_singleplayer = false,
|
|
|
|
})
|
2014-04-27 21:02:48 -04:00
|
|
|
core.register_privilege("noclip", {
|
2012-12-09 07:34:16 -05:00
|
|
|
description = "Can fly through walls",
|
|
|
|
give_to_singleplayer = false,
|
|
|
|
})
|
2014-04-27 21:02:48 -04:00
|
|
|
core.register_privilege("rollback", "Can use the rollback functionality")
|
2012-04-01 05:37:41 -04:00
|
|
|
|