init.lua 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. --[[
  2. More Blocks: Stairs+
  3. Copyright © 2011-2020 Hugo Locurcio and contributors.
  4. Licensed under the zlib license. See LICENSE.md for more information.
  5. --]]
  6. -- Nodes will be called <modname>:{stair,slab,panel,micro,slope}_<subname>
  7. local modpath = minetest.get_modpath("moreblocks").. "/stairsplus"
  8. stairsplus = {}
  9. stairsplus.expect_infinite_stacks = false
  10. stairsplus.shapes_list = {}
  11. if
  12. not minetest.get_modpath("unified_inventory")
  13. and minetest.settings:get_bool("creative_mode")
  14. then
  15. stairsplus.expect_infinite_stacks = true
  16. end
  17. function stairsplus:prepare_groups(groups)
  18. local result = {}
  19. if groups then
  20. for k, v in pairs(groups) do
  21. if k ~= "wood" and k ~= "stone" then
  22. result[k] = v
  23. end
  24. end
  25. end
  26. if not moreblocks.config.stairsplus_in_creative_inventory then
  27. result.not_in_creative_inventory = 1
  28. end
  29. return result
  30. end
  31. function stairsplus:register_all(modname, subname, recipeitem, fields)
  32. self:register_stair(modname, subname, recipeitem, fields)
  33. self:register_slab(modname, subname, recipeitem, fields)
  34. self:register_slope(modname, subname, recipeitem, fields)
  35. self:register_panel(modname, subname, recipeitem, fields)
  36. self:register_micro(modname, subname, recipeitem, fields)
  37. end
  38. function stairsplus:register_alias_all(modname_old, subname_old, modname_new, subname_new)
  39. self:register_stair_alias(modname_old, subname_old, modname_new, subname_new)
  40. self:register_slab_alias(modname_old, subname_old, modname_new, subname_new)
  41. self:register_slope_alias(modname_old, subname_old, modname_new, subname_new)
  42. self:register_panel_alias(modname_old, subname_old, modname_new, subname_new)
  43. self:register_micro_alias(modname_old, subname_old, modname_new, subname_new)
  44. end
  45. function stairsplus:register_alias_force_all(modname_old, subname_old, modname_new, subname_new)
  46. self:register_stair_alias_force(modname_old, subname_old, modname_new, subname_new)
  47. self:register_slab_alias_force(modname_old, subname_old, modname_new, subname_new)
  48. self:register_slope_alias_force(modname_old, subname_old, modname_new, subname_new)
  49. self:register_panel_alias_force(modname_old, subname_old, modname_new, subname_new)
  50. self:register_micro_alias_force(modname_old, subname_old, modname_new, subname_new)
  51. end
  52. -- luacheck: no unused
  53. local function register_stair_slab_panel_micro(modname, subname, recipeitem, groups, images, description, drop, light)
  54. stairsplus:register_all(modname, subname, recipeitem, {
  55. groups = groups,
  56. tiles = images,
  57. description = description,
  58. drop = drop,
  59. light_source = light
  60. })
  61. end
  62. dofile(modpath .. "/defs.lua")
  63. dofile(modpath .. "/recipes.lua")
  64. dofile(modpath .. "/common.lua")
  65. dofile(modpath .. "/stairs.lua")
  66. dofile(modpath .. "/slabs.lua")
  67. dofile(modpath .. "/slopes.lua")
  68. dofile(modpath .. "/panels.lua")
  69. dofile(modpath .. "/microblocks.lua")
  70. dofile(modpath .. "/custom.lua")
  71. dofile(modpath .. "/registrations.lua")