From 5fc2fb9440bd63f0c99e191b55ffa3c135a8ffae Mon Sep 17 00:00:00 2001 From: mrkubax10 Date: Thu, 23 Feb 2023 18:15:12 +0100 Subject: [PATCH] More code clean up and missing craftings --- compatibility.lua | 29 ++++++++++++++++++++++++++--- init.lua | 6 +++++- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/compatibility.lua b/compatibility.lua index ef0d413..d12ec79 100644 --- a/compatibility.lua +++ b/compatibility.lua @@ -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"} diff --git a/init.lua b/init.lua index a393185..d891db6 100644 --- a/init.lua +++ b/init.lua @@ -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") \ No newline at end of file +dofile(modpath.."/compatibility.lua") +dofile(modpath.."/minerals.lua")