privileges.lua 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. -- Minetest: builtin/privileges.lua
  2. --
  3. -- Privileges
  4. --
  5. core.registered_privileges = {}
  6. function core.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. core.registered_privileges[name] = def
  23. end
  24. core.register_privilege("interact", "Can interact with things and modify the world")
  25. core.register_privilege("teleport", "Can use /teleport command")
  26. core.register_privilege("bring", "Can teleport other players")
  27. core.register_privilege("settime", "Can use /time")
  28. core.register_privilege("privs", "Can modify privileges")
  29. core.register_privilege("basic_privs", "Can modify 'shout' and 'interact' privileges")
  30. core.register_privilege("server", "Can do server maintenance stuff")
  31. core.register_privilege("shout", "Can speak in chat")
  32. core.register_privilege("ban", "Can ban and unban players")
  33. core.register_privilege("kick", "Can kick players")
  34. core.register_privilege("give", "Can use /give and /giveme")
  35. core.register_privilege("password", "Can use /setpassword and /clearpassword")
  36. core.register_privilege("fly", {
  37. description = "Can fly using the free_move mode",
  38. give_to_singleplayer = false,
  39. })
  40. core.register_privilege("fast", {
  41. description = "Can walk fast using the fast_move mode",
  42. give_to_singleplayer = false,
  43. })
  44. core.register_privilege("noclip", {
  45. description = "Can fly through walls",
  46. give_to_singleplayer = false,
  47. })
  48. core.register_privilege("rollback", "Can use the rollback functionality")