materials.lua 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. dlxtrains.materials = {}
  2. dlxtrains.sounds = {}
  3. dlxtrains.crafting_enabled = function()
  4. return dlxtrains.materials.base_game ~= nil
  5. end
  6. local function set_materials_minetest_game()
  7. dlxtrains.materials = {
  8. base_game = "Minetest Game",
  9. acacia_wood = "default:acacia_wood",
  10. advtrains_driver_cab = "advtrains:driver_cab",
  11. advtrains_wheel = "advtrains:wheel",
  12. bronze_ingot = "default:bronze_ingot",
  13. bucket_empty = minetest.get_modpath("bucket") and "bucket:bucket_empty" or "default:steel_ingot",
  14. bucket_water = minetest.get_modpath("bucket") and "bucket:bucket_water" or "default:ice",
  15. chest = "default:chest",
  16. coal_lump = "default:coal_lump",
  17. coalblock = "default:coalblock",
  18. cobble = "default:cobble",
  19. copper_ingot = "default:copper_ingot",
  20. copperblock = "default:copperblock",
  21. desert_sand = "default:desert_sand",
  22. diamond = "default:diamond",
  23. dye_black = "dye:black",
  24. dye_blue = "dye:blue",
  25. dye_cyan = "dye:cyan",
  26. dye_grey = "dye:grey",
  27. dye_red = "dye:red",
  28. dye_yellow = "dye:yellow",
  29. furnace = "default:furnace",
  30. glass = "default:glass",
  31. gold_ingot = "default:gold_ingot",
  32. gravel = "default:gravel",
  33. group_wool = "group:wool",
  34. junglewood = "default:junglewood",
  35. ladder_steel = "default:ladder_steel",
  36. mese = "default:mese",
  37. mese_crystal = "default:mese_crystal",
  38. mese_crystal_fragment = "default:mese_crystal_fragment",
  39. obsidian = "default:obsidian",
  40. obsidian_glass = "default:obsidian_glass",
  41. paper = "default:paper",
  42. permafrost = "default:permafrost",
  43. permafrost_with_stones = "default:permafrost_with_stones",
  44. pine_wood = "default:pine_wood",
  45. sand = "default:sand",
  46. steel_ingot = "default:steel_ingot",
  47. steelblock = "default:steelblock",
  48. stick = "default:stick",
  49. tin_ingot = "default:tin_ingot",
  50. wood = "default:wood",
  51. }
  52. dlxtrains.sounds.node_sound_wood_defaults = default.node_sound_wood_defaults
  53. end
  54. local function set_materials_mineclonia()
  55. -- Mineclonia is currently the same as VoxeLibre/MineClone2 except that it uses "mcl_dyes" instead of "mcl_dye".
  56. dlxtrains.materials = {
  57. base_game = "Mineclonia",
  58. acacia_wood = "mcl_core:acaciawood",
  59. advtrains_driver_cab = "advtrains:driver_cab",
  60. advtrains_wheel = "advtrains:wheel",
  61. bronze_ingot = "mcl_core:gold_ingot", -- bronze is not available
  62. bucket_empty = minetest.get_modpath("mcl_buckets") and "mcl_buckets:bucket_empty" or "mcl_core:bowl",
  63. bucket_water = minetest.get_modpath("mcl_buckets") and "mcl_buckets:bucket_water" or "mcl_core:packed_ice",
  64. chest = minetest.get_modpath("mcl_chests") and "mcl_chests:chest" or "group:wood",
  65. coal_lump = "mcl_core:coal_lump",
  66. coalblock = "mcl_core:coalblock",
  67. cobble = "mcl_core:cobble",
  68. copper_ingot = minetest.get_modpath("mcl_copper") and "mcl_copper:copper_ingot" or "mcl_core:gold_ingot",
  69. copperblock = minetest.get_modpath("mcl_copper") and "mcl_copper:block" or "mcl_core:goldblock",
  70. desert_sand = "mcl_core:sand", -- desert sand is not available
  71. diamond = "mcl_core:diamond",
  72. dye_black = "mcl_dyes:black",
  73. dye_blue = "mcl_dyes:blue",
  74. dye_cyan = "mcl_dyes:cyan",
  75. dye_grey = "mcl_dyes:grey",
  76. dye_red = "mcl_dyes:red",
  77. dye_yellow = "mcl_dyes:yellow",
  78. furnace = minetest.get_modpath("mcl_furnaces") and "mcl_furnaces:furnace" or "mcl_core:ironblock",
  79. glass = "mcl_core:glass",
  80. gold_ingot = "mcl_core:gold_ingot",
  81. gravel = "mcl_core:gravel",
  82. group_wool = "group:wool",
  83. junglewood = "mcl_core:junglewood",
  84. ladder_steel = "mcl_core:iron_ingot", -- A compromise alternative
  85. mese = minetest.get_modpath("mesecons_torch") and "mesecons_torch:redstoneblock" or "mcl_core:lapisblock",
  86. mese_crystal = minetest.get_modpath("mesecons") and "mesecons:redstone" or "mcl_core:lapis",
  87. mese_crystal_fragment = "mcl_core:emerald", -- mese is not available
  88. obsidian = "mcl_core:obsidian",
  89. obsidian_glass = "mcl_core:glass_black", -- obsidian glass is not available
  90. paper = "mcl_core:paper",
  91. permafrost = "", -- Node not available
  92. permafrost_with_stones = "", -- Node not available
  93. pine_wood = "", -- Node not available
  94. sand = "mcl_core:sand",
  95. steel_ingot = "mcl_core:iron_ingot",
  96. steelblock = "mcl_core:ironblock",
  97. stick = "mcl_core:stick",
  98. tin_ingot = "mcl_core:iron_ingot", -- tin is not available
  99. wood = "mcl_core:wood",
  100. }
  101. dlxtrains.sounds.node_sound_wood_defaults = mcl_sounds.node_sound_wood_defaults
  102. end
  103. local function set_materials_voxelibre()
  104. -- VoxeLibre/MineClone2 is currently the same as Mineclonia except that it uses "mcl_dye" instead of "mcl_dyes".
  105. dlxtrains.materials = {
  106. base_game = "VoxeLibre/MineClone2",
  107. acacia_wood = "mcl_core:acaciawood",
  108. advtrains_driver_cab = "advtrains:driver_cab",
  109. advtrains_wheel = "advtrains:wheel",
  110. bronze_ingot = "mcl_core:gold_ingot", -- bronze is not available
  111. bucket_empty = minetest.get_modpath("mcl_buckets") and "mcl_buckets:bucket_empty" or "mcl_core:bowl",
  112. bucket_water = minetest.get_modpath("mcl_buckets") and "mcl_buckets:bucket_water" or "mcl_core:packed_ice",
  113. chest = minetest.get_modpath("mcl_chests") and "mcl_chests:chest" or "group:wood",
  114. coal_lump = "mcl_core:coal_lump",
  115. coalblock = "mcl_core:coalblock",
  116. cobble = "mcl_core:cobble",
  117. copper_ingot = minetest.get_modpath("mcl_copper") and "mcl_copper:copper_ingot" or "mcl_core:gold_ingot",
  118. copperblock = minetest.get_modpath("mcl_copper") and "mcl_copper:block" or "mcl_core:goldblock",
  119. desert_sand = "mcl_core:sand", -- desert sand is not available
  120. diamond = "mcl_core:diamond",
  121. dye_black = "mcl_dye:black",
  122. dye_blue = "mcl_dye:blue",
  123. dye_cyan = "mcl_dye:cyan",
  124. dye_grey = "mcl_dye:grey",
  125. dye_red = "mcl_dye:red",
  126. dye_yellow = "mcl_dye:yellow",
  127. furnace = minetest.get_modpath("mcl_furnaces") and "mcl_furnaces:furnace" or "mcl_core:ironblock",
  128. glass = "mcl_core:glass",
  129. gold_ingot = "mcl_core:gold_ingot",
  130. gravel = "mcl_core:gravel",
  131. group_wool = "group:wool",
  132. junglewood = "mcl_core:junglewood",
  133. ladder_steel = "mcl_core:iron_ingot", -- A compromise alternative
  134. mese = minetest.get_modpath("mesecons_torch") and "mesecons_torch:redstoneblock" or "mcl_core:lapisblock",
  135. mese_crystal = minetest.get_modpath("mesecons") and "mesecons:redstone" or "mcl_core:lapis",
  136. mese_crystal_fragment = "mcl_core:emerald", -- mese is not available
  137. obsidian = "mcl_core:obsidian",
  138. obsidian_glass = "mcl_core:glass_black", -- obsidian glass is not available
  139. paper = "mcl_core:paper",
  140. permafrost = "", -- Node not available
  141. permafrost_with_stones = "", -- Node not available
  142. pine_wood = "", -- Node not available
  143. sand = "mcl_core:sand",
  144. steel_ingot = "mcl_core:iron_ingot",
  145. steelblock = "mcl_core:ironblock",
  146. stick = "mcl_core:stick",
  147. tin_ingot = "mcl_core:iron_ingot", -- tin is not available
  148. wood = "mcl_core:wood",
  149. }
  150. dlxtrains.sounds.node_sound_wood_defaults = mcl_sounds.node_sound_wood_defaults
  151. end
  152. local function set_materials_farlands_reloaded()
  153. -- Farlands Reloaded appears to be only partially complete so several items are using alternates for now.
  154. dlxtrains.materials = {
  155. base_game = "Farlands Reloaded",
  156. acacia_wood = "fl_trees:acacia_plank",
  157. advtrains_driver_cab = "advtrains:driver_cab",
  158. advtrains_wheel = "advtrains:wheel",
  159. bronze_ingot = "fl_ores:bronze_ingot",
  160. bucket_empty = minetest.get_modpath("fl_bottles") and "fl_bottles:bottle" or "fl_ores:iron_ingot", -- Bucket crafting is not yet implemented, use an alternative for now.
  161. bucket_water = "fl_topsoil:condensed_ice", -- Bucket crafting is not yet implemented, use an alternative for now.
  162. chest = "group:plank", -- Chest crafting is not yet implemented, use an alternative for now.
  163. coal_lump = "fl_ores:coal_ore",
  164. coalblock = "fl_ores:coal_block",
  165. cobble = "fl_stone:stone_rubble",
  166. copper_ingot = "fl_ores:copper_ingot",
  167. copperblock = "fl_ores:copper_ingot", -- Copper block crafting is not yet implemented, use an alternative for now.
  168. desert_sand = "fl_stone:desert_sand",
  169. diamond = "fl_ores:diamond_ore",
  170. dye_black = "fl_dyes:black_dye",
  171. dye_blue = "fl_dyes:blue_dye",
  172. dye_cyan = "fl_dyes:cyan_dye",
  173. dye_grey = "fl_dyes:grey_dye",
  174. dye_red = "fl_dyes:red_dye",
  175. dye_yellow = "fl_dyes:yellow_dye",
  176. furnace = minetest.get_modpath("fl_workshop") and "fl_workshop:furnace" or "fl_stone:stone_rubble",
  177. glass = "fl_glass:framed_glass",
  178. gold_ingot = "fl_ores:gold_ingot",
  179. gravel = "fl_topsoil:gravel",
  180. group_wool = "fl_wool:wool",
  181. junglewood = "fl_trees:jungletree_plank",
  182. ladder_steel = "fl_ores:iron_ingot", -- A compromise alternative
  183. mese = "fl_ores:bronze_ingot", -- Mithite block crafting is not yet implemented, use an alternative for now.
  184. mese_crystal = "fl_ores:mithite_ore", -- mithite appears to be the equivalent of mese in this game
  185. mese_crystal_fragment = "fl_ores:gold_ingot", -- A compromise alternative
  186. obsidian = "fl_ores:bronze_ingot", -- obsidian is not yet available, use an alternate for now.
  187. obsidian_glass = "fl_ores:bronze_ingot", -- obsidian is not yet available, use an alternate for now.
  188. paper = "fl_trees:aspen_leaves", -- A compromise alternative
  189. permafrost = "", -- Node not available
  190. permafrost_with_stones = "", -- Node not available
  191. pine_wood = "fl_trees:pine_plank",
  192. sand = "fl_stone:sand",
  193. steel_ingot = "fl_ores:iron_ingot",
  194. steelblock = "fl_ores:iron_ingot", -- Iron block crafting is not yet implemented, use an alternative for now.
  195. stick = "fl_trees:stick",
  196. tin_ingot = "fl_ores:tin_ingot",
  197. wood = "fl_trees:apple_plank",
  198. }
  199. dlxtrains.sounds.node_sound_wood_defaults = function()
  200. local sounds = {}
  201. if minetest.get_modpath("fl_trees") then
  202. sounds = fl_trees.sounds.wood()
  203. sounds.dug = sounds.dug or {sounds.footstep.name, gain = 0.9} -- Add dug sound if missing (currently it is missing)
  204. end
  205. return sounds
  206. end
  207. end
  208. local function set_materials_hades_revisited()
  209. -- Hades Revisited appears to be only partially complete so several items are using alternates for now.
  210. dlxtrains.materials = {
  211. base_game = "Hades Revisited",
  212. acacia_wood = "", -- Node note available
  213. advtrains_driver_cab = "advtrains:driver_cab",
  214. advtrains_wheel = "advtrains:wheel",
  215. bronze_ingot = "hades_core:bronze_ingot",
  216. bucket_empty = minetest.get_modpath("hades_vessels") and "hades_vessels:glass_bottle" or "hades_core:steel_ingot", -- A compromise alternative
  217. bucket_water = "hades_core:cactus", -- Buckets are not available, use this alternative as a crude source of water for now.
  218. chest = minetest.get_modpath("hades_chests") and "hades_chests:chest" or "group:wood",
  219. coal_lump = "hades_core:coal_lump",
  220. coalblock = "hades_core:coalblock",
  221. cobble = "hades_core:cobble",
  222. copper_ingot = "hades_core:copper_ingot",
  223. copperblock = "hades_core:copperblock",
  224. desert_sand = "hades_core:volcanic_sand", -- A compromise alternative
  225. diamond = "hades_core:diamond",
  226. dye_black = "hades_dye:black",
  227. dye_blue = "hades_dye:blue",
  228. dye_cyan = "hades_dye:cyan",
  229. dye_grey = "hades_dye:grey",
  230. dye_red = "hades_dye:red",
  231. dye_yellow = "hades_dye:yellow",
  232. furnace = minetest.get_modpath("hades_furnaces") and "hades_furnaces:furnace" or "hades_core:cobble",
  233. glass = "hades_core:glass",
  234. gold_ingot = "hades_core:gold_ingot",
  235. gravel = "hades_core:gravel",
  236. group_wool = "group:cloth", -- cloth is the equivalent of wool in this game
  237. junglewood = "hades_trees:jungle_wood",
  238. ladder_steel = "hades_core:steel_ingot", -- A compromise alternative
  239. mese = "hades_core:mese",
  240. mese_crystal = "hades_core:mese_crystal",
  241. mese_crystal_fragment = "hades_core:mese_crystal_fragment",
  242. obsidian = "hades_core:obsidian",
  243. obsidian_glass = "hades_core:obsidian_glass",
  244. paper = "hades_core:paper",
  245. permafrost = "", -- Node not available
  246. permafrost_with_stones = "", -- Node not available
  247. pine_wood = "hades_trees:cream_wood", -- A compromise alternative
  248. sand = "hades_core:fertile_sand", -- fertile sand appears to be the equivalent of sand in this game
  249. steel_ingot = "hades_core:steel_ingot",
  250. steelblock = "hades_core:steelblock",
  251. stick = "hades_core:stick",
  252. tin_ingot = "hades_core:tin_ingot",
  253. wood = "hades_trees:wood",
  254. }
  255. dlxtrains.sounds.node_sound_wood_defaults = hades_sounds.node_sound_wood_defaults
  256. end
  257. if minetest.get_modpath("default") and minetest.get_modpath("dye") then
  258. -- Detected "Minetest Game" or another game that is based on it.
  259. set_materials_minetest_game()
  260. elseif minetest.get_modpath("mcl_core") and minetest.get_modpath("mcl_dyes") then
  261. -- Detected "Mineclonia" or another game that is based on it.
  262. set_materials_mineclonia()
  263. elseif minetest.get_modpath("mcl_core") and minetest.get_modpath("mcl_dye") then
  264. -- Detected "VoxeLibre"/"MineClone2" or another game that is based on it.
  265. set_materials_voxelibre()
  266. elseif minetest.get_modpath("fl_dyes")
  267. and minetest.get_modpath("fl_glass")
  268. and minetest.get_modpath("fl_ores")
  269. and minetest.get_modpath("fl_stone")
  270. and minetest.get_modpath("fl_topsoil")
  271. and minetest.get_modpath("fl_trees")
  272. and minetest.get_modpath("fl_wool") then
  273. -- Detected "Farlands Reloaded" or another game that is based on it.
  274. set_materials_farlands_reloaded()
  275. elseif minetest.get_modpath("hades_core")
  276. and minetest.get_modpath("hades_dye")
  277. and minetest.get_modpath("hades_trees") then
  278. -- Detected "Hades Revisited" or another game that is based on it.
  279. set_materials_hades_revisited()
  280. end
  281. if not dlxtrains.materials.base_game then
  282. minetest.log("info", "[dlxtrains] A known base game was not detected. Crafting items and recipes for DlxTrains will not be included. Wagons, tools and nodes, however, can still be acquired using the give command.")
  283. end