diff --git a/api.lua b/api.lua index 342aa2f..1a7b284 100644 --- a/api.lua +++ b/api.lua @@ -32,6 +32,15 @@ industrialtest.api.hvPowerFlow=10200 industrialtest.api.evPowerFlow=40800 industrialtest.api.ivPowerFlow=163800 +industrialtest.api.craftingMethods={ + macerating="industrialtest.macerating", + compressing="industrialtest.compressing", + extracting="industrialtest.extracting", + recycling="industrialtest.recycling", + cableForming="industrialtest.cable_forming", + massFabricating="industrialtest.mass_fabricating", +} + industrialtest.internal.clamp=function(num,min,max) return math.max(math.min(num,max),min) end @@ -750,14 +759,16 @@ industrialtest.api.registerMaceratorRecipe=function(config) recipe=config.recipe or "", time=config.time or 2 } + if mcl_craftguide ~= nil then mcl_craftguide.register_craft({ - type = "industrialtest.macerating", + type = industrialtest.api.craftingMethods.macerating, width = 1, output = definition.output, items = {definition.recipe} }) end + industrialtest.api.maceratorRecipes[definition.recipe]=definition end -- \brief Returns macerator recipe result @@ -776,6 +787,16 @@ industrialtest.api.registerCompressorRecipe=function(config) time=config.time or 2, count=config.count or 1 } + + if mcl_craftguide ~= nil then + mcl_craftguide.register_craft({ + type = industrialtest.api.craftingMethods.compressing, + width = 1, + output = definition.output, + items = {definition.recipe} + }) + end + industrialtest.api.compressorRecipes[definition.recipe]=definition end -- \brief Returns macerator recipe result @@ -790,6 +811,16 @@ industrialtest.api.registerExtractorRecipe=function(config) recipe=config.recipe or "", time=config.time or 2 } + + if mcl_craftguide ~= nil then + mcl_craftguide.register_craft({ + type = industrialtest.api.craftingMethods.extracting, + width = 1, + output = definition.output, + items = {definition.recipe} + }) + end + industrialtest.api.extractorRecipes[definition.recipe]=definition end industrialtest.api.getExtractorRecipeResult=function(recipe) @@ -802,6 +833,16 @@ industrialtest.api.registerCableFormerRecipe=function(config) recipe=config.recipe or "", time=config.time or 2 } + + if mcl_craftguide ~= nil then + mcl_craftguide.register_craft({ + type = industrialtest.api.craftingMethods.cableForming, + width = 1, + output = definition.output, + items = {definition.recipe} + }) + end + industrialtest.api.cableFormerRecipes[definition.recipe]=definition end diff --git a/compatibility.lua b/compatibility.lua index 8142bbd..03efeeb 100644 --- a/compatibility.lua +++ b/compatibility.lua @@ -611,10 +611,30 @@ if industrialtest.mclAvailable then y_min=mcl_vars.mg_overworld_min }) - mcl_craftguide.register_craft_type("industrialtest.macerating", { + mcl_craftguide.register_craft_type(industrialtest.api.craftingMethods.macerating, { description = S("Macerating"), icon = "industrialtest_machine_block.png^industrialtest_macerator_front_active.png" }) + mcl_craftguide.register_craft_type(industrialtest.api.craftingMethods.compressing, { + description = S("Compressing"), + icon = "industrialtest_machine_block.png^industrialtest_compressor_front_active.png" + }) + mcl_craftguide.register_craft_type(industrialtest.api.craftingMethods.extracting, { + description = S("Extracting"), + icon = "industrialtest_machine_block.png^industrialtest_extractor_front_active.png" + }) + mcl_craftguide.register_craft_type(industrialtest.api.craftingMethods.recycling, { + description = S("Recycling"), + icon = "industrialtest_machine_block.png^industrialtest_recycler_top_active.png" + }) + mcl_craftguide.register_craft_type(industrialtest.api.craftingMethods.cableForming, { + description = S("Cable Forming"), + icon = "industrialtest_machine_block.png^industrialtest_cable_former_front_active.png" + }) + mcl_craftguide.register_craft_type(industrialtest.api.craftingMethods.massFabricating, { + description = S("Mass Fabricating"), + icon = "industrialtest_machine_block.png^industrialtest_mass_fabricator_front_active.png" + }) elseif industrialtest.mtgAvailable then industrialtest.internal.explode=function(pos,radius) diff --git a/machines/cable_former.lua b/machines/cable_former.lua index 0d88718..5e134db 100644 --- a/machines/cable_former.lua +++ b/machines/cable_former.lua @@ -24,7 +24,7 @@ industrialtest.internal.registerSimpleElectricItemProcessor({ capacity=1400, flow=industrialtest.api.lvPowerFlow, opPower=80, - method="industrialtest.cable_forming", + method=industrialtest.api.craftingMethods.cableForming, efficiency=1 }) minetest.register_craft({ diff --git a/machines/common.lua b/machines/common.lua index 4102de2..9fdf434 100644 --- a/machines/common.lua +++ b/machines/common.lua @@ -453,7 +453,7 @@ local function craftResultProxy(method,item) time=output.time, src=after.items[1] } - elseif method=="industrialtest.macerating" then + elseif method==industrialtest.api.craftingMethods.macerating then local output=industrialtest.api.getMaceratorRecipeResult(item:get_name()) if not output then return { @@ -469,7 +469,7 @@ local function craftResultProxy(method,item) time=output.time, src=srcAfter } - elseif method=="industrialtest.compressing" then + elseif method==industrialtest.api.craftingMethods.compressing then local output=industrialtest.api.getCompressorRecipeResult(item:get_name()) if not output or item:get_count()