privileges.lua 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. -- Minetest: builtin/privileges.lua
  2. --
  3. -- Privileges
  4. --
  5. minetest.registered_privileges = {}
  6. function minetest.register_privilege(name, param)
  7. local function fill_defaults(def)
  8. if def.give_to_singleplayer == nil then
  9. def.give_to_singleplayer = true
  10. end
  11. if def.description == nil then
  12. def.description = "(no description)"
  13. end
  14. end
  15. local def = {}
  16. if type(param) == "table" then
  17. def = param
  18. else
  19. def = {description = param}
  20. end
  21. fill_defaults(def)
  22. minetest.registered_privileges[name] = def
  23. end
  24. minetest.register_privilege("interact", "Can interact with things and modify the world")
  25. minetest.register_privilege("teleport", "Can use /teleport command")
  26. minetest.register_privilege("bring", "Can teleport other players")
  27. minetest.register_privilege("settime", "Can use /time")
  28. minetest.register_privilege("privs", "Can modify privileges")
  29. minetest.register_privilege("basic_privs", "Can modify 'shout' and 'interact' privileges")
  30. minetest.register_privilege("server", "Can do server maintenance stuff")
  31. minetest.register_privilege("shout", "Can speak in chat")
  32. minetest.register_privilege("ban", "Can ban and unban players")
  33. minetest.register_privilege("give", "Can use /give and /giveme")
  34. minetest.register_privilege("password", "Can use /setpassword and /clearpassword")
  35. minetest.register_privilege("fly", {
  36. description = "Can fly using the free_move mode",
  37. give_to_singleplayer = false,
  38. })
  39. minetest.register_privilege("fast", {
  40. description = "Can walk fast using the fast_move mode",
  41. give_to_singleplayer = false,
  42. })
  43. minetest.register_privilege("noclip", {
  44. description = "Can fly through walls",
  45. give_to_singleplayer = false,
  46. })
  47. minetest.register_privilege("rollback", "Can use the rollback functionality")