init.lua 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. -- Freegamers: I removed all the additional woods and choose to just use a set of wooden drawers. The redunancy was unnecessary.
  2. --[[
  3. Minetest Mod Storage Drawers - A Mod adding storage drawers
  4. Copyright (C) 2017-2019 Linus Jahn <lnj@kaidan.im>
  5. MIT License
  6. Permission is hereby granted, free of charge, to any person obtaining a copy
  7. of this software and associated documentation files (the "Software"), to deal
  8. in the Software without restriction, including without limitation the rights
  9. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10. copies of the Software, and to permit persons to whom the Software is
  11. furnished to do so, subject to the following conditions:
  12. The above copyright notice and this permission notice shall be included in all
  13. copies or substantial portions of the Software.
  14. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  20. SOFTWARE.
  21. ]]
  22. -- Load support for intllib.
  23. local MP = core.get_modpath(core.get_current_modname())
  24. local S, NS = dofile(MP.."/intllib.lua")
  25. drawers = {}
  26. drawers.drawer_visuals = {}
  27. drawers.WOOD_ITEMSTRING = "group:wood"
  28. if core.get_modpath("default") and default then
  29. drawers.WOOD_SOUNDS = default.node_sound_wood_defaults()
  30. drawers.CHEST_ITEMSTRING = "default:chest"
  31. end
  32. drawers.enable_1x1 = not core.settings:get_bool("drawers_disable_1x1")
  33. drawers.enable_1x2 = not core.settings:get_bool("drawers_disable_1x2")
  34. drawers.enable_2x2 = not core.settings:get_bool("drawers_disable_2x2")
  35. drawers.CONTROLLER_RANGE = 14
  36. --
  37. -- GUI
  38. --
  39. drawers.gui_bg = "bgcolor[#080808BB;true]"
  40. drawers.gui_slots = "listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]"
  41. if (core.get_modpath("mcl_core")) and mcl_core then -- MCL2
  42. drawers.gui_bg_img = "background[5,5;1,1;crafting_creative_bg.png;true]"
  43. else
  44. drawers.gui_bg_img = "background[5,5;1,1;gui_formbg.png;true]"
  45. end
  46. --
  47. -- Load API
  48. --
  49. dofile(MP .. "/lua/helpers.lua")
  50. dofile(MP .. "/lua/visual.lua")
  51. dofile(MP .. "/lua/api.lua")
  52. dofile(MP .. "/lua/controller.lua")
  53. --
  54. -- Register drawers
  55. --
  56. if core.get_modpath("default") and default then
  57. drawers.register_drawer("drawers:wood", {
  58. description = S("Wooden"),
  59. tiles1 = drawers.node_tiles_front_other("drawers_wood_front_1.png",
  60. "drawers_wood.png"),
  61. tiles2 = drawers.node_tiles_front_other("drawers_wood_front_2.png",
  62. "drawers_wood.png"),
  63. tiles4 = drawers.node_tiles_front_other("drawers_wood_front_4.png",
  64. "drawers_wood.png"),
  65. groups = {choppy = 3, oddly_breakable_by_hand = 2},
  66. sounds = drawers.WOOD_SOUNDS,
  67. drawer_stack_max_factor = 4 * 8, -- normal chest size
  68. material = drawers.WOOD_ITEMSTRING
  69. })
  70. end
  71. --
  72. -- Register drawer upgrades
  73. --
  74. if core.get_modpath("default") and default then
  75. drawers.register_drawer_upgrade("drawers:upgrade_steel", {
  76. description = S("Steel Drawer Upgrade (x2)"),
  77. inventory_image = "drawers_upgrade_steel.png",
  78. groups = {drawer_upgrade = 100},
  79. recipe_item = "default:steel_ingot"
  80. })
  81. drawers.register_drawer_upgrade("drawers:upgrade_gold", {
  82. description = S("Gold Drawer Upgrade (x3)"),
  83. inventory_image = "drawers_upgrade_gold.png",
  84. groups = {drawer_upgrade = 200},
  85. recipe_item = "default:gold_ingot"
  86. })
  87. drawers.register_drawer_upgrade("drawers:upgrade_obsidian", {
  88. description = S("Obsidian Drawer Upgrade (x5)"),
  89. inventory_image = "drawers_upgrade_obsidian.png",
  90. groups = {drawer_upgrade = 400},
  91. recipe_item = "default:obsidian"
  92. })
  93. drawers.register_drawer_upgrade("drawers:upgrade_diamond", {
  94. description = S("Diamond Drawer Upgrade (x8)"),
  95. inventory_image = "drawers_upgrade_diamond.png",
  96. groups = {drawer_upgrade = 700},
  97. recipe_item = "default:diamond"
  98. })
  99. end
  100. --
  101. -- Register drawer upgrade template
  102. --
  103. core.register_craftitem("drawers:upgrade_template", {
  104. description = S("Drawer Upgrade Template"),
  105. inventory_image = "drawers_upgrade_template.png"
  106. })
  107. core.register_craft({
  108. output = "drawers:upgrade_template 4",
  109. recipe = {
  110. {"group:stick", "group:stick", "group:stick"},
  111. {"group:stick", "group:drawer", "group:stick"},
  112. {"group:stick", "group:stick", "group:stick"}
  113. }
  114. })