industrialtest/compatibility.lua

126 lines
4.8 KiB
Lua

-- IndustrialTest
-- Copyright (C) 2023 mrkubax10
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local S=minetest.get_translator("industrialtest")
local mtgAvailable=minetest.get_modpath("default")
local mclAvailable=minetest.get_modpath("mcl_core")
industrialtest.elementKeys={}
-- compatibilty that adds not existing elements
if mclAvailable then
industrialtest.registerMineral=function(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"}
}
})
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="shapeless",
output="industrialtest:"..name.."_ingot 9",
recipe={
"industrialtest:"..name.."_block"
}
})
minetest.register_craft({
type="shapeless",
output="industrialtest:raw_"..name.." 9",
recipe={
"industrialtest:raw_"..name.."_block"
}
})
end
-- register required minerals that are not available in MCL
industrialtest.registerMineral("tin","Tin",3,3)
industrialtest.elementKeys.tinIngot="industrialtest:tin_ingot"
-- register ore generation
local stonelike={"mcl_core:stone","mcl_core:diorite","mcl_core:andesite","mcl_core:granite"}
minetest.register_ore({
ore_type="scatter",
ore="industrialtest:stone_with_tin",
wherein=stonelike,
clust_scarcity=10*10*10,
clust_num_ores=5,
clust_size=3,
y_max=mcl_worlds.layer_to_y(39),
y_min=mcl_vars.mg_overworld_min
})
end