config.lua 763 B

123456789101112131415161718192021222324252627282930
  1. --[[
  2. More Blocks: configuration handling
  3. Copyright © 2011-2019 Hugo Locurcio and contributors.
  4. Licensed under the zlib license. See LICENSE.md for more information.
  5. --]]
  6. moreblocks.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. moreblocks.config[name] =
  17. getbool_default("moreblocks." .. name, default)
  18. else
  19. moreblocks.config[name] =
  20. minetest.settings:get("moreblocks." .. name) or default
  21. end
  22. end
  23. -- Show stairs/slabs/panels/microblocks in creative inventory (true or false):
  24. setting("bool", "stairsplus_in_creative_inventory", false)