diff --git a/compatibility.lua b/compatibility.lua index 2f63c85..ef0d413 100644 --- a/compatibility.lua +++ b/compatibility.lua @@ -19,46 +19,75 @@ local S=minetest.get_translator("industrialtest") local mtgAvailable=minetest.get_modpath("default") local mclAvailable=minetest.get_modpath("mcl_core") +industrialtest={} +industrialtest.elementKeys={} + -- compatibilty that adds not existing elements if mclAvailable then - -- register required items that are not available in MCL - minetest.register_craftitem("industrialtest:raw_tin",{ - description=S("Raw Tin"), - inventory_image="industrialtest_mcl_raw_tin.png" - }) - minetest.register_craftitem("industrialtest:tin_ingot",{ - description=S("Tin Ingot"), - inventory_image="industrialtest_mcl_tin_ingot.png" - }) + local function registerMineral(name,displayName,oreBlastResistance,oreHardness,rawBlockBlastResistance,rawBlockHardness,blockBlastResistance,blockHardness) + minetest.register_craftitem("industrialtest:raw_"..name,{ + description=S("Raw "..displayName), + inventory_image="industrialtest_mcl_raw_"..name..".png" + }) + minetest.register_craftitem("industrialtest:"..name.."_ingot",{ + description=S(displayName.." Ingot"), + inventory_image="industrialtest_mcl_"..name.."_ingot.png" + }) + minetest.register_node("industrialtest:stone_with_"..name,{ + description=S(displayName.." Ore"), + tiles={"default_stone.png^industrialtest_mcl_stone_with_"..name..".png"}, + sounds=mcl_sounds.node_sound_stone_defaults(), + drop="industrialtest:raw_"..name, + groups={pickaxey=3,building_block=1,material_stone=1,blast_furnace_smeltable=1}, + _mcl_blast_resistance = oreBlastResistance, + _mcl_hardness = oreHardness, + _mcl_silk_touch_drop = true, + _mcl_fortune_drop = mcl_core.fortune_drop_ore, + }) + minetest.register_node("industrialtest:raw_"..name.."_block",{ + description=S("Raw "..displayName.." Block"), + tiles={"industrialtest_mcl_raw_"..name.."_block.png"}, + groups={pickaxey=2,building_block=1,blast_furnace_smeltable=1}, + sounds=mcl_sounds.node_sound_metal_defaults(), + _mcl_blast_resistance=rawBlockBlastResistance, + _mcl_hardness=rawBlockHardness, + }) + minetest.register_node("industrialtest:"..name.."_block",{ + description=S("Block of "..displayName), + tiles={"industrialtest_mcl_"..name.."_block.png"}, + groups={pickaxey=2,building_block=1}, + sounds=mcl_sounds.node_sound_metal_defaults(), + _mcl_blast_resistance=blockBlastResistance, + _mcl_hardness=blockHardness, + }) + minetest.register_craft({ + type="cooking", + output="industrialtest:"..name.."_ingot", + recipe="industrialtest:raw_"..name + }) + minetest.register_craft({ + type="shaped", + output="industrialtest:raw_"..name.."_block", + recipe={ + {"industrialtest:raw"..name,"industrialtest:raw"..name,"industrialtest:raw"..name}, + {"industrialtest:raw"..name,"industrialtest:raw"..name,"industrialtest:raw"..name}, + {"industrialtest:raw"..name,"industrialtest:raw"..name,"industrialtest:raw"..name} + } + }) + minetest.register_craft({ + type="shaped", + output="industrialtest:"..name.."_block", + recipe={ + {"industrialtest:"..name.."_ingot","industrialtest:"..name.."_ingot","industrialtest:"..name.."_ingot"}, + {"industrialtest:"..name.."_ingot","industrialtest:"..name.."_ingot","industrialtest:"..name.."_ingot"}, + {"industrialtest:"..name.."_ingot","industrialtest:"..name.."_ingot","industrialtest:"..name.."_ingot"} + } + }) + end + -- register required minerals that are not available in MCL + registerMineral("tin","Tin",3,3) - -- register required blocks that are not available in MCL - minetest.register_node("industrialtest:stone_with_tin",{ - description=S("Tin Ore"), - tiles={"default_stone.png^industrialtest_mcl_stone_with_tin.png"}, - sounds=mcl_sounds.node_sound_stone_defaults(), - drop="industrialtest:raw_tin", - groups={pickaxey=3,building_block=1,material_stone=1,blast_furnace_smeltable=1}, - _mcl_blast_resistance = 3, - _mcl_hardness = 3, - _mcl_silk_touch_drop = true, - _mcl_fortune_drop = mcl_core.fortune_drop_ore, - }) - minetest.register_node("industrialtest:raw_tin_block",{ - description=S("Raw Tin Block"), - tiles={"industrialtest_mcl_raw_tin_block.png"}, - groups={pickaxey=2,building_block=1,blast_furnace_smeltable=1}, - sounds=mcl_sounds.node_sound_metal_defaults(), - _mcl_blast_resistance=6, - _mcl_hardness=5, - }) - - -- register crafts that are not available in MCL - minetest.register_craft({ - type="cooking", - output="industrialtest:tin_ingot", - recipe="industrialtest:raw_tin" - }) - -- register required ores that are not available in MCL + -- register ore generation local stonelike={"mcl_core:stone","mcl_core:diorite","mcl_core:andesite","mcl_core:granite"} minetest.register_ore({ ore_type="scatter",