Add MTG registerMetal

This commit is contained in:
mrkubax10 2023-02-23 18:57:04 +01:00
parent 5fc2fb9440
commit 4f3f772eca
1 changed files with 62 additions and 7 deletions

View File

@ -16,14 +16,14 @@
local S=minetest.get_translator("industrialtest")
local mtgAvailable=minetest.get_modpath("default")
local mclAvailable=minetest.get_modpath("mcl_core")
industrialtest.mtgAvailable=minetest.get_modpath("default")
industrialtest.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)
if industrialtest.mclAvailable then
industrialtest.registerMetal=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"
@ -53,7 +53,7 @@ if mclAvailable then
})
minetest.register_node("industrialtest:"..name.."_block",{
description=S("Block of "..displayName),
tiles={"industrialtest_mcl_"..name.."_block.png"},
tiles={"industrialtest_"..name.."_block.png"},
groups={pickaxey=2,building_block=1},
sounds=mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance=blockBlastResistance,
@ -107,10 +107,10 @@ if mclAvailable then
})
end
-- register required minerals that are not available in MCL
industrialtest.registerMineral("tin","Tin",3,3)
industrialtest.registerMetal("tin","Tin",3,3)
industrialtest.elementKeys.tinIngot="industrialtest:tin_ingot"
-- register ore generation
-- ore generation is game-dependent so register it there
local stonelike={"mcl_core:stone","mcl_core:diorite","mcl_core:andesite","mcl_core:granite"}
minetest.register_ore({
ore_type="scatter",
@ -122,4 +122,59 @@ if mclAvailable then
y_max=mcl_worlds.layer_to_y(39),
y_min=mcl_vars.mg_overworld_min
})
elseif industrialtest.mtgAvailable then
industrialtest.registerMetal=function(name,displayName,oreBlastResistance,oreHardness,rawBlockBlastResistance,rawBlockHardness,blockBlastResistance,blockHardness)
minetest.register_craftitem("industrialtest:"..name.."_lump",{
description=S(displayName.." Lump"),
inventory_image="industrialtest_mtg_"..name.."_lump.png"
})
minetest.register_craftitem("industrialtest:"..name.."_ingot",{
description=S(displayName.." Ingot"),
inventory_image="industrialtest_mtg_"..name.."_ingot.png"
})
minetest.register_node("industrialtest:stone_with_"..name,{
description=S(displayName.." Ore"),
tiles={"default_stone.png^industrialtest_mtg_stone_with_"..name..".png"},
sounds=default.node_sound_stone_defaults(),
drop="industrialtest:"..name.."_lump",
groups={cracky=oreHardness},
})
minetest.register_node("industrialtest:"..name.."_block",{
description=S("Block of "..displayName),
tiles={"industrialtest_"..name.."_block.png"},
groups={cracky=blockHardness,level=2},
sounds=default.node_sound_metal_defaults(),
})
minetest.register_craft({
type="cooking",
output="industrialtest:"..name.."_ingot",
recipe="industrialtest:"..name.."_lump"
})
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="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
industrialtest.elementKeys.tinIngot="default:tin_ingot"
else
error("No compatible games found!")
end