More code clean up and missing craftings

This commit is contained in:
mrkubax10 2023-02-23 18:15:12 +01:00
parent fe0b6b97cd
commit 5fc2fb9440
2 changed files with 31 additions and 4 deletions

View File

@ -19,12 +19,11 @@ 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
local function registerMineral(name,displayName,oreBlastResistance,oreHardness,rawBlockBlastResistance,rawBlockHardness,blockBlastResistance,blockHardness)
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"
@ -83,9 +82,33 @@ if mclAvailable then
{"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
registerMineral("tin","Tin",3,3)
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"}

View File

@ -17,5 +17,9 @@
MODNAME="industrialtest"
local modpath=minetest.get_modpath(MODNAME)
-- table with global functions, variables etc
industrialtest={}
-- load other lua files
dofile(modpath.."/compatibility.lua")
dofile(modpath.."/compatibility.lua")
dofile(modpath.."/minerals.lua")