privileges.lua 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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("shout", "Can speak in chat")
  26. core.register_privilege("basic_privs", "Can modify 'shout' and 'interact' privileges")
  27. core.register_privilege("privs", "Can modify privileges")
  28. core.register_privilege("teleport", {
  29. description = "Can use /teleport command",
  30. give_to_singleplayer = false,
  31. })
  32. core.register_privilege("bring", {
  33. description = "Can teleport other players",
  34. give_to_singleplayer = false,
  35. })
  36. core.register_privilege("settime", {
  37. description = "Can use /time",
  38. give_to_singleplayer = false,
  39. })
  40. core.register_privilege("server", {
  41. description = "Can do server maintenance stuff",
  42. give_to_singleplayer = false,
  43. })
  44. core.register_privilege("protection_bypass", {
  45. description = "Can bypass node protection in the world",
  46. give_to_singleplayer = false,
  47. })
  48. core.register_privilege("ban", {
  49. description = "Can ban and unban players",
  50. give_to_singleplayer = false,
  51. })
  52. core.register_privilege("kick", {
  53. description = "Can kick players",
  54. give_to_singleplayer = false,
  55. })
  56. core.register_privilege("give", {
  57. description = "Can use /give and /giveme",
  58. give_to_singleplayer = false,
  59. })
  60. core.register_privilege("password", {
  61. description = "Can use /setpassword and /clearpassword",
  62. give_to_singleplayer = false,
  63. })
  64. core.register_privilege("fly", {
  65. description = "Can fly using the free_move mode",
  66. give_to_singleplayer = false,
  67. })
  68. core.register_privilege("fast", {
  69. description = "Can walk fast using the fast_move mode",
  70. give_to_singleplayer = false,
  71. })
  72. core.register_privilege("noclip", {
  73. description = "Can fly through walls",
  74. give_to_singleplayer = false,
  75. })
  76. core.register_privilege("rollback", {
  77. description = "Can use the rollback functionality",
  78. give_to_singleplayer = false,
  79. })
  80. core.register_privilege("zoom", {
  81. description = "Can zoom the camera",
  82. give_to_singleplayer = false,
  83. })
  84. core.register_privilege("debug", {
  85. description = "Allows enabling various debug options that may affect gameplay",
  86. give_to_singleplayer = false,
  87. })