config.lua 718 B

123456789101112131415161718192021222324252627282930
  1. --[[
  2. Map Tools: configuration handling
  3. Copyright (c) 2012-2015 Calinou and contributors.
  4. Licensed under the zlib license. See LICENSE.md for more information.
  5. --]]
  6. maptools.config = {}
  7. local function getbool_default(setting, default)
  8. local value = minetest.settings:get_bool(setting)
  9. if value == nil then
  10. value = default
  11. end
  12. return value
  13. end
  14. local function setting(settingtype, name, default)
  15. if settingtype == "bool" then
  16. maptools.config[name] =
  17. getbool_default("maptools." .. name, default)
  18. else
  19. maptools.config[name] =
  20. minetest.settings:get("maptools." .. name) or default
  21. end
  22. end
  23. -- Show Map Tools stuff in creative inventory (1 or 0):
  24. setting("integer", "hide_from_creative_inventory", 1)