2023-02-23 12:14:10 +01:00
|
|
|
-- 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/>.
|
|
|
|
|
2023-02-23 12:09:46 +01:00
|
|
|
local S=minetest.get_translator("industrialtest")
|
|
|
|
|
2023-02-23 18:57:04 +01:00
|
|
|
industrialtest.mtgAvailable=minetest.get_modpath("default")
|
2023-02-23 21:47:40 +01:00
|
|
|
industrialtest.mclAvailable=minetest.get_modpath("mcl_core") and minetest.get_modpath("mcl_copper")
|
2023-02-23 12:09:46 +01:00
|
|
|
|
2023-02-23 14:54:39 +01:00
|
|
|
industrialtest.elementKeys={}
|
|
|
|
|
2023-02-23 12:09:46 +01:00
|
|
|
-- compatibilty that adds not existing elements
|
2023-02-23 18:57:04 +01:00
|
|
|
if industrialtest.mclAvailable then
|
|
|
|
industrialtest.registerMetal=function(name,displayName,oreBlastResistance,oreHardness,rawBlockBlastResistance,rawBlockHardness,blockBlastResistance,blockHardness)
|
2023-02-23 14:54:39 +01:00
|
|
|
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),
|
2023-02-23 18:57:04 +01:00
|
|
|
tiles={"industrialtest_"..name.."_block.png"},
|
2023-02-23 14:54:39 +01:00
|
|
|
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"}
|
|
|
|
}
|
|
|
|
})
|
2023-02-23 18:15:12 +01:00
|
|
|
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"
|
|
|
|
}
|
|
|
|
})
|
2023-02-23 14:54:39 +01:00
|
|
|
end
|
|
|
|
-- register required minerals that are not available in MCL
|
2023-02-23 18:57:04 +01:00
|
|
|
industrialtest.registerMetal("tin","Tin",3,3)
|
2023-02-23 18:15:12 +01:00
|
|
|
industrialtest.elementKeys.tinIngot="industrialtest:tin_ingot"
|
2023-02-23 21:47:40 +01:00
|
|
|
|
|
|
|
--register other items that are not available in MCL
|
|
|
|
minetest.register_craftitem("industrialtest:bronze_ingot",{
|
|
|
|
description=S("Bronze Ingot"),
|
|
|
|
inventory_image="industrialtest_mcl_bronze_ingot.png"
|
|
|
|
})
|
|
|
|
minetest.register_craft({
|
|
|
|
type="shaped",
|
|
|
|
output="industrialcraft:bronze_ingot 9",
|
|
|
|
recipe={
|
|
|
|
{"mcl_copper:copper_ingot","mcl_copper:copper_ingot","mcl_copper:copper_ingot"},
|
|
|
|
{"mcl_copper:copper_ingot","industrialtest:tin_ingot","mcl_copper:copper_ingot"},
|
|
|
|
{"mcl_copper:copper_ingot","mcl_copper:copper_ingot","mcl_copper:copper_ingot"}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
industrialtest.elementKeys.bronzeIngot="industrialtest:bronze_ingot"
|
|
|
|
|
|
|
|
--register other blocks that are not availabe in MCL
|
|
|
|
minetest.register_node("industrialtest:bronze_block",{
|
|
|
|
description=S("Block of Bronze"),
|
|
|
|
tiles={"industrialtest_mcl_bronze_block.png"},
|
|
|
|
groups={pickaxey=2,building_block=1},
|
|
|
|
sounds=mcl_sounds.node_sound_metal_defaults(),
|
|
|
|
_mcl_blast_resistance=3,
|
|
|
|
_mcl_hardness=3,
|
|
|
|
})
|
|
|
|
minetest.register_craft({
|
|
|
|
type="shaped",
|
|
|
|
output="industrialtest:bronze_block",
|
|
|
|
recipe={
|
|
|
|
{"industrialtest:bronze_ingot","industrialtest:bronze_ingot","industrialtest:bronze_ingot"},
|
|
|
|
{"industrialtest:bronze_ingot","industrialtest:bronze_ingot","industrialtest:bronze_ingot"},
|
|
|
|
{"industrialtest:bronze_ingot","industrialtest:bronze_ingot","industrialtest:bronze_ingot"}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
minetest.register_craft({
|
|
|
|
type="shapeless",
|
|
|
|
output="industrialtest:bronze_ingot 9",
|
|
|
|
recipe={
|
|
|
|
"industrialtest:bronze_block"
|
|
|
|
}
|
|
|
|
})
|
2023-02-23 12:09:46 +01:00
|
|
|
|
2023-02-23 18:57:04 +01:00
|
|
|
-- ore generation is game-dependent so register it there
|
2023-02-23 12:09:46 +01:00
|
|
|
local stonelike={"mcl_core:stone","mcl_core:diorite","mcl_core:andesite","mcl_core:granite"}
|
|
|
|
minetest.register_ore({
|
|
|
|
ore_type="scatter",
|
2023-02-23 13:49:13 +01:00
|
|
|
ore="industrialtest:stone_with_tin",
|
|
|
|
wherein=stonelike,
|
|
|
|
clust_scarcity=10*10*10,
|
2023-02-23 12:09:46 +01:00
|
|
|
clust_num_ores=5,
|
|
|
|
clust_size=3,
|
|
|
|
y_max=mcl_worlds.layer_to_y(39),
|
|
|
|
y_min=mcl_vars.mg_overworld_min
|
|
|
|
})
|
2023-02-23 19:11:13 +01:00
|
|
|
minetest.register_ore({
|
|
|
|
ore_type="scatter",
|
|
|
|
ore="industrialtest:stone_with_uranium",
|
|
|
|
wherein=stonelike,
|
|
|
|
clust_scarcity=7*7*7,
|
|
|
|
clust_num_ores=3,
|
|
|
|
clust_size=3,
|
|
|
|
y_max=mcl_worlds.layer_to_y(20),
|
|
|
|
y_min=mcl_vars.mg_overworld_min
|
|
|
|
})
|
2023-02-23 18:57:04 +01:00
|
|
|
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"
|
2023-02-23 21:47:40 +01:00
|
|
|
industrialtest.elementKeys.bronzeIngot="default:bronze_ingot"
|
2023-02-23 19:11:13 +01:00
|
|
|
|
|
|
|
-- ore generation is game-dependent so register it there
|
|
|
|
minetest.register_ore({
|
|
|
|
ore_type="scatter",
|
|
|
|
ore="industrialtest:stone_with_uranium",
|
|
|
|
wherein="default:stone",
|
|
|
|
clust_scarcity=7*7*7,
|
|
|
|
clust_num_ores=3,
|
|
|
|
clust_size=3,
|
|
|
|
y_max=-128,
|
|
|
|
y_min=-31000
|
|
|
|
})
|
2023-02-23 18:57:04 +01:00
|
|
|
else
|
|
|
|
error("No compatible games found!")
|
2023-02-23 13:49:13 +01:00
|
|
|
end
|