From 7446169bc034b3e6c373933c926cbdf8e527e464 Mon Sep 17 00:00:00 2001 From: mrkubax10 Date: Thu, 23 Nov 2023 19:17:19 +0100 Subject: [PATCH] Add mass fabricator --- compatibility.lua | 2 -- craftitems.lua | 5 +++++ init.lua | 1 + machines/common.lua | 40 +++++++++++++++++++++++++----------- machines/mass_fabricator.lua | 40 ++++++++++++++++++++++++++++++++++++ machines/recycler.lua | 2 +- 6 files changed, 75 insertions(+), 15 deletions(-) create mode 100644 machines/mass_fabricator.lua diff --git a/compatibility.lua b/compatibility.lua index 6ec3c06..4dcd890 100644 --- a/compatibility.lua +++ b/compatibility.lua @@ -512,7 +512,6 @@ if industrialtest.mclAvailable then industrialtest.elementKeys.bucket="mcl_buckets:bucket_empty" industrialtest.elementKeys.bucketWithLava="mcl_buckets:bucket_lava" industrialtest.elementKeys.bucketWithWater="mcl_buckets:bucket_water" - industrialtest.elementKeys.glowstone="mcl_nether:glowstone_dust" industrialtest.elementKeys.glass="mcl_core:glass" industrialtest.elementKeys.powerCarrier="mesecons:mesecon" industrialtest.elementKeys.furnace="mcl_furnaces:furnace" @@ -728,7 +727,6 @@ elseif industrialtest.mtgAvailable then industrialtest.elementKeys.bucketWithWater="bucket:bucket_water" industrialtest.elementKeys.string="farming:string" industrialtest.elementKeys.junglePlanks="default:junglewood" - industrialtest.elementKeys.glowstone="dye:yellow" industrialtest.elementKeys.glass="default:glass" industrialtest.elementKeys.powerCarrier="default:mese_crystal_fragment" industrialtest.elementKeys.furnace="default:furnace" diff --git a/craftitems.lua b/craftitems.lua index f9599a4..370b82d 100644 --- a/craftitems.lua +++ b/craftitems.lua @@ -578,6 +578,11 @@ minetest.register_craftitem("industrialtest:scrap",{ inventory_image="industrialtest_scrap.png" }) +minetest.register_craftitem("industrialtest:uu_matter",{ + description=S("UU-Matter"), + inventory_image="industrialtest_uu_matter.png" +}) + -- Item callbacks minetest.register_on_player_inventory_action(function(player,action,inventory,info) if action=="put" then diff --git a/init.lua b/init.lua index 9b2e682..7196380 100644 --- a/init.lua +++ b/init.lua @@ -41,6 +41,7 @@ dofile(modpath.."/machines/fluid_generator.lua") dofile(modpath.."/machines/generator.lua") dofile(modpath.."/machines/iron_furnace.lua") dofile(modpath.."/machines/macerator.lua") +dofile(modpath.."/machines/mass_fabricator.lua") dofile(modpath.."/machines/nuclear_reactor.lua") dofile(modpath.."/machines/power_storage.lua") dofile(modpath.."/machines/recycler.lua") diff --git a/machines/common.lua b/machines/common.lua index 86bfe33..a4af5aa 100644 --- a/machines/common.lua +++ b/machines/common.lua @@ -408,6 +408,21 @@ local function craftResultProxy(method,item) time=output.time, src=srcAfter } + elseif method=="industrialtest.mass_fabricating" then + if item:get_count()<34 then + return { + item=ItemStack(), + time=0, + src=item + } + end + local srcAfter=ItemStack(item:get_name()) + srcAfter:set_count(item:get_count()-34) + return { + item=ItemStack("industrialtest:uu_matter"), + time=15, + src=srcAfter + } end error("Unknown craft method passed to craftResultProxy") end @@ -622,6 +637,7 @@ simpleElectricItemProcessor.activeOnTimer=function(pos,elapsed,meta,inv,config) end function industrialtest.internal.registerSimpleElectricItemProcessor(config) + local machineBlockTexture=config.machineBlockTexture or "industrialtest_machine_block.png" industrialtest.internal.registerMachine({ name=config.name, displayName=config.displayName, @@ -639,12 +655,12 @@ function industrialtest.internal.registerSimpleElectricItemProcessor(config) }, customKeys={ tiles={ - "industrialtest_machine_block.png"..(config.customTopTexture and "^industrialtest_"..config.name.."_top.png" or ""), - "industrialtest_machine_block.png"..(config.customBottomTexture and "^industrialtest_"..config.name.."_bottom.png" or ""), - "industrialtest_machine_block.png"..(config.customRightTexture and "^industrialtest_"..config.name.."_right.png" or ""), - "industrialtest_machine_block.png"..(config.customLeftTexture and "^industrialtest_"..config.name.."_left.png" or ""), - "industrialtest_machine_block.png"..(config.customBackTexture and "^industrialtest_"..config.name.."_back.png" or ""), - "industrialtest_machine_block.png"..(config.customFrontTexture and "^industrialtest_"..config.name.."_front.png" or "") + machineBlockTexture..(config.customTopTexture and "^industrialtest_"..config.name.."_top.png" or ""), + machineBlockTexture..(config.customBottomTexture and "^industrialtest_"..config.name.."_bottom.png" or ""), + machineBlockTexture..(config.customRightTexture and "^industrialtest_"..config.name.."_right.png" or ""), + machineBlockTexture..(config.customLeftTexture and "^industrialtest_"..config.name.."_left.png" or ""), + machineBlockTexture..(config.customBackTexture and "^industrialtest_"..config.name.."_back.png" or ""), + machineBlockTexture..(config.customFrontTexture and "^industrialtest_"..config.name.."_front.png" or "") }, paramtype2="facedir", legacy_facedir_simple=true, @@ -652,12 +668,12 @@ function industrialtest.internal.registerSimpleElectricItemProcessor(config) }, activeCustomKeys={ tiles={ - "industrialtest_machine_block.png"..(config.customTopTexture and "^industrialtest_"..config.name.."_top_active.png" or ""), - "industrialtest_machine_block.png"..(config.customBottomTexture and "^industrialtest_"..config.name.."_bottom_active.png" or ""), - "industrialtest_machine_block.png"..(config.customRightTexture and "^industrialtest_"..config.name.."_right_active.png" or ""), - "industrialtest_machine_block.png"..(config.customLeftTexture and "^industrialtest_"..config.name.."_left_active.png" or ""), - "industrialtest_machine_block.png"..(config.customBackTexture and "^industrialtest_"..config.name.."_back_active.png" or ""), - "industrialtest_machine_block.png"..(config.customFrontTexture and "^industrialtest_"..config.name.."_front_active.png" or "") + machineBlockTexture..(config.customTopTexture and "^industrialtest_"..config.name.."_top_active.png" or ""), + machineBlockTexture..(config.customBottomTexture and "^industrialtest_"..config.name.."_bottom_active.png" or ""), + machineBlockTexture..(config.customRightTexture and "^industrialtest_"..config.name.."_right_active.png" or ""), + machineBlockTexture..(config.customLeftTexture and "^industrialtest_"..config.name.."_left_active.png" or ""), + machineBlockTexture..(config.customBackTexture and "^industrialtest_"..config.name.."_back_active.png" or ""), + machineBlockTexture..(config.customFrontTexture and "^industrialtest_"..config.name.."_front_active.png" or "") } }, onConstruct=simpleElectricItemProcessor.onConstruct, diff --git a/machines/mass_fabricator.lua b/machines/mass_fabricator.lua new file mode 100644 index 0000000..d471a0c --- /dev/null +++ b/machines/mass_fabricator.lua @@ -0,0 +1,40 @@ +-- 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 . + +local S=minetest.get_translator("industrialtest") +local massFabricator={} + +industrialtest.internal.registerSimpleElectricItemProcessor({ + name="mass_fabricator", + displayName=S("Mass Fabricator"), + capacity=100000, + requiresWrench=true, + flow=industrialtest.api.evPowerFlow, + opPower=10000, + machineBlockTexture="industrialtest_advanced_machine_block.png", + customFrontTexture=true, + method="industrialtest.mass_fabricating", + efficiency=1 +}) +minetest.register_craft({ + type="shaped", + output="industrialtest:mass_fabricator", + recipe={ + {industrialtest.elementKeys.yellowDust,"industrialtest:advanced_circuit",industrialtest.elementKeys.yellowDust}, + {"industrialtest:advanced_machine_block","industrialtest:lapotron_crystal","industrialtest:advanced_machine_block"}, + {industrialtest.elementKeys.yellowDust,"industrialtest:advanced_circuit",industrialtest.elementKeys.yellowDust} + } +}) diff --git a/machines/recycler.lua b/machines/recycler.lua index fb4971b..3068e2e 100644 --- a/machines/recycler.lua +++ b/machines/recycler.lua @@ -31,7 +31,7 @@ minetest.register_craft({ type="shaped", output="industrialtest:recycler", recipe={ - {"",industrialtest.elementKeys.glowstone,""}, + {"",industrialtest.elementKeys.yellowDust,""}, {industrialtest.elementKeys.dirt,"industrialtest:compressor",industrialtest.elementKeys.dirt}, {"industrialtest:refined_iron_ingot",industrialtest.elementKeys.dirt,"industrialtest:refined_iron_ingot"} }