node_ingot.lua 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. -- get Boilerplate for Translations
  2. local S = cannabis.S
  3. minetest.register_craftitem("cannabis:mixed_hr_ingot", {
  4. description = S("Mixed HR Ingot"),
  5. inventory_image = "cannabis_mixed_hr_ingot.png",
  6. })
  7. minetest.register_craftitem(":cannabis:fibra_ingot", {
  8. description = S("Fiber Ingot"),
  9. inventory_image = "cannabis_fibra_ingot.png",
  10. })
  11. minetest.register_craftitem(":cannabis:foglie_ingot", {
  12. description = S("Leaves Ingot"),
  13. inventory_image = "cannabis_foglie_ingot.png",
  14. })
  15. minetest.register_craftitem("cannabis:high_performance_ingot", {
  16. description = S("High Performance Ingot"),
  17. inventory_image = "cannabis_high_performance_ingot.png",
  18. })
  19. minetest.register_craftitem(":cannabis:tessuto_ingot", {
  20. description = S("Fabric Ingot"),
  21. inventory_image = "cannabis_tessuto_ingot.png",
  22. })
  23. minetest.register_craftitem(":cannabis:adminh_ingot", {
  24. description = S("Adminh Ingot"),
  25. inventory_image = "cannabis_adminh_ingot.png",
  26. })
  27. local function for_each_registered_item(action)
  28. local already_reg = {}
  29. for k, _ in pairs(minetest.registered_items) do
  30. table.insert(already_reg, k)
  31. end
  32. local really_register_craftitem = minetest.register_craftitem
  33. minetest.register_craftitem = function(name, def)
  34. really_register_craftitem(name, def)
  35. action(string.gsub(name, "^:", ""))
  36. end
  37. local really_register_tool = minetest.register_tool
  38. minetest.register_tool = function(name, def)
  39. really_register_tool(name, def)
  40. action(string.gsub(name, "^:", ""))
  41. end
  42. local really_register_node = minetest.register_node
  43. minetest.register_node = function(name, def)
  44. really_register_node(name, def)
  45. action(string.gsub(name, "^:", ""))
  46. end
  47. for _, name in ipairs(already_reg) do
  48. action(name)
  49. end
  50. end
  51. local function register_block(block, ingot)
  52. minetest.register_craft({
  53. output = block,
  54. recipe = {
  55. {ingot, ingot, ingot},
  56. {ingot, ingot, ingot},
  57. {ingot, ingot, ingot},
  58. }
  59. })
  60. minetest.register_craft({
  61. output = ingot.." 9",
  62. recipe = {
  63. {block}
  64. }
  65. })
  66. end
  67. register_block("cannabis:cannabis_fibra_block", "cannabis:fibra_ingot")
  68. register_block("cannabis:cannabis_high_performance_block", "cannabis:high_performance_ingot")
  69. register_block("cannabis:cannabis_tessuto_block", "cannabis:tessuto_ingot")
  70. --register_block("cannabis:cannabis_foglie_block", "cannabis:foglie_ingot")
  71. register_block("cannabis:cannabis_adminh_block", "cannabis:adminh_ingot")
  72. minetest.register_node("cannabis:hp_block_canapa",
  73. {
  74. description = S("High Performance Block Hemp"),
  75. tiles = {"hp_block_canapa.png"},
  76. is_ground_content = false,
  77. groups = {choppy = 30, oddly_breakable_by_hand = 1, flammable = 3, wood = 1},
  78. sounds = {"cannabis_canapa_s2"},
  79. })
  80. minetest.register_node("cannabis:cannabis_foglie_block", {
  81. description = S("Leaves Block"),
  82. tiles = { "cannabis_foglie_block.png" },
  83. is_ground_content = false,
  84. groups = {cracky=1, level=2},
  85. sounds = {"cannabis_canapa_s3"}
  86. })
  87. minetest.register_node("cannabis:cannabis_foglie_red_block", {
  88. description = S("Red Leaves Block"),
  89. tiles = { "cannabis_foglie_red_block.png" },
  90. is_ground_content = false,
  91. groups = {cracky=1, level=2},
  92. sounds = {"cannabis_canapa_s3"}
  93. })
  94. minetest.register_node("cannabis:cannabis_foglie_ice_block", {
  95. description = S("Ice Leaves Block"),
  96. tiles = { "cannabis_foglie_ice_block.png" },
  97. is_ground_content = false,
  98. groups = {cracky=1, level=2},
  99. sounds = {"cannabis_canapa_s3"}
  100. })
  101. minetest.register_node("cannabis:cannabis_tessuto_block", {
  102. description = S("Fabric Block"),
  103. tiles = { "cannabis_tessuto_block.png" },
  104. is_ground_content = false,
  105. groups = {cracky=1, level=2},
  106. sounds = {"cannabis_canapa_s3"}
  107. })
  108. minetest.register_node("cannabis:cannabis_high_performance_block", {
  109. description = S("High Performance Block"),
  110. tiles = { "cannabis_high_performance_block.png" },
  111. is_ground_content = false,
  112. groups = {cracky=1, level=2},
  113. sounds = {"cannabis_canapa_s3"}
  114. })
  115. minetest.register_node("cannabis:cannabis_fibra_block", {
  116. description = S("Fiber Block"),
  117. tiles = { "cannabis_fibra_block.png" },
  118. is_ground_content = false,
  119. groups = {cracky=1, level=2},
  120. sounds = {"cannabis_canapa_s3"}
  121. })
  122. minetest.register_node("cannabis:cannabis_adminh_block", {
  123. description = S("Adminh Block"),
  124. tiles = { "cannabis_adminh_block.png" },
  125. is_ground_content = false,
  126. groups = {unbreackable =1},
  127. sounds = {"cannabis_canapa_s3"}
  128. })
  129. minetest.register_craft({
  130. type = 'cooking',
  131. recipe = "cannabis:canapa_fiber",
  132. output = "cannabis:fibra_ingot",
  133. })
  134. minetest.register_craft({
  135. type = 'cooking',
  136. recipe = "cannabis:canapa_leaves",
  137. output = "cannabis:foglie_ingot",
  138. })
  139. minetest.register_craft({
  140. output = "cannabis:tessuto_ingot",
  141. recipe = {
  142. {"","",""},
  143. {"cannabis:canapa_glue","cannabis:canapa_glue",""},
  144. {"cannabis:canapa_cloth","cannabis:canapa_cloth",""},
  145. }
  146. })
  147. minetest.register_craft({
  148. type = 'cooking',
  149. recipe = "cannabis:canapa_plastic",
  150. cooktime = 2,
  151. output = "cannabis:high_performance_ingot",
  152. })
  153. minetest.register_craft({
  154. type = 'cooking',
  155. recipe = "cannabis:canapa_oil",
  156. cooktime = 1000,
  157. output = "cannabis:adminh_ingot",
  158. })
  159. minetest.register_craft({
  160. type = 'cooking',
  161. recipe = "cannabis:canapa_red_oil",
  162. cooktime = 1000,
  163. output = "cannabis:adminh_ingot",
  164. })
  165. local function for_each_registered_item(action)
  166. local already_reg = {}
  167. for k, _ in pairs(minetest.registered_items) do
  168. table.insert(already_reg, k)
  169. end
  170. local really_register_craftitem = minetest.register_craftitem
  171. minetest.register_craftitem = function(name, def)
  172. really_register_craftitem(name, def)
  173. action(string.gsub(name, "^:", ""))
  174. end
  175. local really_register_tool = minetest.register_tool
  176. minetest.register_tool = function(name, def)
  177. really_register_tool(name, def)
  178. action(string.gsub(name, "^:", ""))
  179. end
  180. local really_register_node = minetest.register_node
  181. minetest.register_node = function(name, def)
  182. really_register_node(name, def)
  183. action(string.gsub(name, "^:", ""))
  184. end
  185. for _, name in ipairs(already_reg) do
  186. action(name)
  187. end
  188. end