init.lua 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  1. -- More Ores
  2. -- Original mod by Calinou with help from Nore
  3. -- Re-coded by TenPlus1
  4. local S
  5. if minetest.get_modpath("intllib") then
  6. S = intllib.Getter()
  7. else
  8. S = function(s) return s end
  9. end
  10. -- Minerals
  11. minetest.register_node("moreores:mineral_silver", {
  12. description = S("%s Ore"):format(S("Silver")),
  13. tiles = {"default_stone.png^moreores_mineral_silver.png"},
  14. groups = {cracky = 3},
  15. sounds = default.node_sound_stone_defaults(),
  16. drop = "moreores:silver_lump",
  17. })
  18. minetest.register_node("moreores:mineral_mithril", {
  19. description = S("%s Ore"):format(S("Mithril")),
  20. tiles = {"default_stone.png^moreores_mineral_mithril.png"},
  21. groups = {cracky = 3},
  22. sounds = default.node_sound_stone_defaults(),
  23. drop = "moreores:mithril_lump",
  24. })
  25. -- Ores
  26. minetest.register_craftitem("moreores:silver_lump", {
  27. description = S("%s Lump"):format(S("Silver")),
  28. inventory_image = "moreores_silver_lump.png",
  29. })
  30. minetest.register_craftitem("moreores:mithril_lump", {
  31. description = S("%s Lump"):format(S("Mithril")),
  32. inventory_image = "moreores_mithril_lump.png",
  33. })
  34. -- Ingots
  35. minetest.register_craftitem("moreores:silver_ingot", {
  36. description = S("%s Ingot"):format(S("Silver")),
  37. inventory_image = "moreores_silver_ingot.png",
  38. })
  39. minetest.register_craftitem("moreores:mithril_ingot", {
  40. description = S("%s Ingot"):format(S("Mithril")),
  41. inventory_image = "moreores_mithril_ingot.png",
  42. })
  43. -- Helpers
  44. local c = "moreores:silver_ingot"
  45. local m = "moreores:mithril_ingot"
  46. -- Cooking Ores into Ingots
  47. minetest.register_craft({
  48. type = "cooking",
  49. output = c,
  50. recipe = "moreores:silver_lump",
  51. })
  52. minetest.register_craft({
  53. type = "cooking",
  54. output = m,
  55. recipe = "moreores:mithril_lump",
  56. })
  57. -- Blocks
  58. minetest.register_node("moreores:silver_block", {
  59. description = S("%s Block"):format(S("Silver")),
  60. tiles = {"moreores_silver_block.png"},
  61. groups = {snappy = 1, bendy = 2, cracky = 1, melty = 2, level= 2},
  62. sounds = default.node_sound_metal_defaults(),
  63. })
  64. minetest.register_node("moreores:mithril_block", {
  65. description = S("%s Block"):format(S("Mithril")),
  66. tiles = {"moreores_mithril_block.png"},
  67. groups = {snappy = 1, bendy = 2, cracky = 1, melty = 2, level= 2},
  68. sounds = default.node_sound_metal_defaults(),
  69. })
  70. -- Ingot to Block Crafts and vice-versa
  71. minetest.register_craft( {
  72. output = "moreores:silver_block",
  73. recipe = {{c, c, c}, {c, c, c}, {c, c, c}},
  74. })
  75. minetest.register_craft( {
  76. output = c .. " 9",
  77. recipe = {{"moreores:silver_block"}}
  78. })
  79. minetest.register_craft( {
  80. output = "moreores:mithril_block",
  81. recipe = {{m, m, m}, {m, m, m}, {m, m, m}},
  82. })
  83. minetest.register_craft( {
  84. output = m .. " 9",
  85. recipe = {{"moreores:mithril_block"}}
  86. })
  87. -- Mapgen Ores
  88. minetest.register_ore({
  89. ore_type = "scatter",
  90. ore = "moreores:mineral_silver",
  91. wherein = "default:stone",
  92. clust_scarcity = 11*11*11,
  93. clust_num_ores = 4,
  94. clust_size = 11,
  95. y_min = -31000,
  96. y_max = -2,
  97. })
  98. minetest.register_ore({
  99. ore_type = "scatter",
  100. ore = "moreores:mineral_mithril",
  101. wherein = "default:stone",
  102. clust_scarcity = 11*11*11,
  103. clust_num_ores = 1,
  104. clust_size = 11,
  105. y_min = -31000,
  106. y_max = -512,
  107. })
  108. -- Silver Tools
  109. minetest.register_tool("moreores:pick_silver", {
  110. description = S("%s Pickaxe"):format(S("Silver")),
  111. inventory_image = "moreores_tool_silverpick.png",
  112. tool_capabilities = {
  113. full_punch_interval = 1.0,
  114. max_drop_level = 3,
  115. groupcaps = {
  116. cracky = {times = {[1] = 2.60, [2] = 1.00, [3] = 0.60}, uses = 100, maxlevel = 1},
  117. },
  118. damage_groups = {fleshy = 6},
  119. },
  120. sound = {breaks = "default_tool_breaks"},
  121. })
  122. minetest.register_tool("moreores:shovel_silver", {
  123. description = S("%s Shovel"):format(S("Silver")),
  124. inventory_image = "moreores_tool_silvershovel.png",
  125. wield_image = "moreores_tool_silvershovel.png^[transformR90",
  126. tool_capabilities = {
  127. full_punch_interval = 1.0,
  128. max_drop_level = 3,
  129. groupcaps = {
  130. crumbly = {times = {[1] = 1.10, [2] = 0.40, [3] = 0.25}, uses = 100, maxlevel = 1},
  131. },
  132. damage_groups = {fleshy = 6},
  133. },
  134. sound = {breaks = "default_tool_breaks"},
  135. })
  136. minetest.register_tool("moreores:axe_silver", {
  137. description = S("%s Axe"):format(S("Silver")),
  138. inventory_image = "moreores_tool_silveraxe.png",
  139. tool_capabilities = {
  140. full_punch_interval = 1.0,
  141. max_drop_level = 3,
  142. groupcaps = {
  143. choppy = {times = {[1] = 2.50, [2] = 0.80, [3] = 0.50}, uses = 100, maxlevel = 1},
  144. fleshy = {times = {[2] = 1.10, [3] = 0.60}, uses = 100, maxlevel = 1}
  145. },
  146. damage_groups = {fleshy = 6},
  147. },
  148. sound = {breaks = "default_tool_breaks"},
  149. })
  150. minetest.register_tool("moreores:sword_silver", {
  151. description = S("%s Sword"):format(S("Silver")),
  152. inventory_image = "moreores_tool_silversword.png",
  153. tool_capabilities = {
  154. full_punch_interval = 1.0,
  155. max_drop_level = 3,
  156. groupcaps = {
  157. fleshy = {times = {[2] = 0.70, [3] = 0.30}, uses = 100, maxlevel = 1},
  158. snappy = {times = {[2] = 0.70, [3] = 0.30}, uses = 100, maxlevel = 1},
  159. choppy = {times = {[3] = 0.80}, uses = 100, maxlevel = 0}
  160. },
  161. damage_groups = {fleshy = 6},
  162. },
  163. sound = {breaks = "default_tool_breaks"},
  164. })
  165. -- Silver Tool Crafts
  166. minetest.register_craft({
  167. output = "moreores:pick_silver",
  168. recipe = {{c, c, c}, {"", "group:stick", ""}, {"", "group:stick", ""}}
  169. })
  170. minetest.register_craft({
  171. output = "moreores:shovel_silver",
  172. recipe = {{c}, {"group:stick"}, {"group:stick"}}
  173. })
  174. minetest.register_craft({
  175. output = "moreores:axe_silver",
  176. recipe = {{c, c}, {c, "group:stick"}, {"", "group:stick"}}
  177. })
  178. minetest.register_craft({
  179. output = "moreores:sword_silver",
  180. recipe = {{c}, {c}, {"group:stick"}}
  181. })
  182. -- Mithril Tools
  183. minetest.register_tool("moreores:pick_mithril", {
  184. description = S("%s Pickaxe"):format(S("Mithril")),
  185. inventory_image = "moreores_tool_mithrilpick.png",
  186. tool_capabilities = {
  187. full_punch_interval = 0.45,
  188. max_drop_level = 3,
  189. groupcaps = {
  190. cracky = {times = {[1] = 2.25, [2] = 0.55, [3] = 0.35}, uses = 200, maxlevel = 2},
  191. },
  192. damage_groups = {fleshy = 9},
  193. },
  194. sound = {breaks = "default_tool_breaks"},
  195. })
  196. minetest.register_tool("moreores:shovel_mithril", {
  197. description = S("%s Shovel"):format(S("Mithril")),
  198. inventory_image = "moreores_tool_mithrilshovel.png",
  199. wield_image = "moreores_tool_mithrilshovel.png^[transformR90",
  200. tool_capabilities = {
  201. full_punch_interval = 0.45,
  202. max_drop_level = 3,
  203. groupcaps = {
  204. crumbly = {times = {[1] = 0.70, [2] = 0.35, [3] = 0.20}, uses = 200, maxlevel = 2},
  205. },
  206. damage_groups = {fleshy = 9},
  207. },
  208. sound = {breaks = "default_tool_breaks"},
  209. })
  210. minetest.register_tool("moreores:axe_mithril", {
  211. description = S("%s Axe"):format(S("Mithril")),
  212. inventory_image = "moreores_tool_mithrilaxe.png",
  213. tool_capabilities = {
  214. full_punch_interval = 0.45,
  215. max_drop_level = 3,
  216. groupcaps = {
  217. choppy = {times = {[1] = 1.75, [2] = 0.45, [3] = 0.45}, uses = 200, maxlevel = 2},
  218. fleshy = {times = {[2] = 0.95, [3] = 0.30}, uses = 200, maxlevel = 1}
  219. },
  220. damage_groups = {fleshy = 9},
  221. },
  222. sound = {breaks = "default_tool_breaks"},
  223. })
  224. minetest.register_tool("moreores:sword_mithril", {
  225. description = S("%s Sword"):format(S("Mithril")),
  226. inventory_image = "moreores_tool_mithrilsword.png",
  227. tool_capabilities = {
  228. full_punch_interval = 0.45,
  229. max_drop_level = 3,
  230. groupcaps = {
  231. fleshy = {times = {[2] = 0.65, [3] = 0.25}, uses = 200, maxlevel = 2},
  232. snappy = {times = {[2] = 0.70, [3] = 0.25}, uses = 200, maxlevel = 2},
  233. choppy = {times = {[3] = 0.65}, uses = 200, maxlevel = 0}
  234. },
  235. damage_groups = {fleshy = 9},
  236. },
  237. sound = {breaks = "default_tool_breaks"},
  238. })
  239. -- Mithril Tool Crafts
  240. minetest.register_craft({
  241. output = "moreores:pick_mithril",
  242. recipe = {{m, m, m}, {"", "group:stick", ""}, {"", "group:stick", ""}}
  243. })
  244. minetest.register_craft({
  245. output = "moreores:shovel_mithril",
  246. recipe = {{m}, {"group:stick"}, {"group:stick"}}
  247. })
  248. minetest.register_craft({
  249. output = "moreores:axe_mithril",
  250. recipe = {{m, m}, {m, "group:stick"}, {"", "group:stick"}}
  251. })
  252. minetest.register_craft({
  253. output = "moreores:sword_mithril",
  254. recipe = {{m}, {m}, {"group:stick"}}
  255. })
  256. -- Compatibility
  257. minetest.register_alias("moreores:mineral_tin", "default:stone_with_tin")
  258. minetest.register_alias("moreores:tin_ingot", "default:tin_ingot")
  259. minetest.register_alias("moreores:tin_block", "default:tinblock")
  260. minetest.register_alias("moreores:tin_lump", "default:tin_lump")
  261. -- Toolranks Mod Support
  262. local function add_tool(name, desc, afteruse)
  263. minetest.override_item(name, {
  264. original_description = desc,
  265. description = toolranks.create_description(desc, 0, 1),
  266. after_use = afteruse and toolranks.new_afteruse
  267. })
  268. end
  269. if minetest.get_modpath("toolranks") then
  270. add_tool("moreores:pick_silver", S("%s Pickaxe"):format(S("Silver")), true)
  271. add_tool("moreores:axe_silver", S("%s Axe"):format(S("Silver")), true)
  272. add_tool("moreores:shovel_silver", S("%s Shovel"):format(S("Silver")), true)
  273. add_tool("moreores:sword_silver", S("%s Sword"):format(S("Silver")), true)
  274. add_tool("moreores:pick_mithril", S("%s Pickaxe"):format(S("Mithril")), true)
  275. add_tool("moreores:axe_mithril", S("%s Axe"):format(S("Mithril")), true)
  276. add_tool("moreores:shovel_mithril", S("%s Shovel"):format(S("Mithril")), true)
  277. add_tool("moreores:sword_mithril", S("%s Sword"):format(S("Mithril")), true)
  278. end
  279. print ("[MOD] moreores " .. S("loaded"))