summaryrefslogtreecommitdiff
path: root/worldedit_gui/init.lua
diff options
context:
space:
mode:
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>2017-06-16 18:12:21 -0400
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>2017-06-16 18:12:21 -0400
commit75e0a665ce2a45e1158a427d3f70f854f5f4d5a8 (patch)
tree881209e2c8f7efcbce69482bc3caa19b4828e290 /worldedit_gui/init.lua
parentb8cd2f723c7c9079e631d7a4078862ff47b24915 (diff)
downloaddreambuilder_modpack-75e0a665ce2a45e1158a427d3f70f854f5f4d5a8.tar
dreambuilder_modpack-75e0a665ce2a45e1158a427d3f70f854f5f4d5a8.tar.gz
dreambuilder_modpack-75e0a665ce2a45e1158a427d3f70f854f5f4d5a8.tar.bz2
dreambuilder_modpack-75e0a665ce2a45e1158a427d3f70f854f5f4d5a8.tar.xz
dreambuilder_modpack-75e0a665ce2a45e1158a427d3f70f854f5f4d5a8.zip
Updated several mods for Minetest 0.4.16
castles modpack, areas, biome_lib, blox, boost_cart, plantlife modpack caverealms, coloredwood, concrete, currency, farming redo, home decor, ilights, mesecons, moreores, pipeworks, signs_lib, technic, unified inventory unified bricks, unified dyes, worldedit, and xban2
Diffstat (limited to 'worldedit_gui/init.lua')
-rw-r--r--worldedit_gui/init.lua10
1 files changed, 7 insertions, 3 deletions
diff --git a/worldedit_gui/init.lua b/worldedit_gui/init.lua
index 0a770c6..dafd7c2 100644
--- a/worldedit_gui/init.lua
+++ b/worldedit_gui/init.lua
@@ -14,7 +14,7 @@ Use `nil` for the `options` parameter to unregister the function associated with
Use `nil` for the `get_formspec` field to denote that the function does not have its own screen.
-Use `nil` for the `privs` field to denote that no special privileges are required to use the function.
+The `privs` field may not be `nil`.
If the identifier is already registered to another function, it will be replaced by the new one.
@@ -24,6 +24,9 @@ The `on_select` function must not call `worldedit.show_page`
worldedit.pages = {} --mapping of identifiers to options
local identifiers = {} --ordered list of identifiers
worldedit.register_gui_function = function(identifier, options)
+ if options.privs == nil or next(options.privs) == nil then
+ error("privs unset")
+ end
worldedit.pages[identifier] = options
table.insert(identifiers, identifier)
end
@@ -46,7 +49,7 @@ worldedit.register_gui_handler = function(identifier, handler)
--ensure the player has permission to perform the action
local entry = worldedit.pages[identifier]
- if entry and minetest.check_player_privs(name, entry.privs or {}) then
+ if entry and minetest.check_player_privs(name, entry.privs) then
return handler(name, fields)
end
return false
@@ -240,6 +243,7 @@ end
worldedit.register_gui_function("worldedit_gui", {
name = "WorldEdit GUI",
+ privs = {interact=true},
get_formspec = function(name)
--create a form with all the buttons arranged in a grid
local buttons, x, y, index = {}, 0, 1, 0
@@ -272,7 +276,7 @@ worldedit.register_gui_handler("worldedit_gui", function(name, fields)
for identifier, entry in pairs(worldedit.pages) do --check for WorldEdit GUI main formspec button selection
if fields[identifier] and identifier ~= "worldedit_gui" then
--ensure player has permission to perform action
- local has_privs, missing_privs = minetest.check_player_privs(name, entry.privs or {})
+ local has_privs, missing_privs = minetest.check_player_privs(name, entry.privs)
if not has_privs then
worldedit.player_notify(name, "you are not allowed to use this function (missing privileges: " .. table.concat(missing_privs, ", ") .. ")")
return false