Add mass fabricator

This commit is contained in:
mrkubax10 2023-11-23 19:17:19 +01:00
parent 08ac8f5f39
commit 7446169bc0
6 changed files with 75 additions and 15 deletions

View File

@ -512,7 +512,6 @@ if industrialtest.mclAvailable then
industrialtest.elementKeys.bucket="mcl_buckets:bucket_empty" industrialtest.elementKeys.bucket="mcl_buckets:bucket_empty"
industrialtest.elementKeys.bucketWithLava="mcl_buckets:bucket_lava" industrialtest.elementKeys.bucketWithLava="mcl_buckets:bucket_lava"
industrialtest.elementKeys.bucketWithWater="mcl_buckets:bucket_water" industrialtest.elementKeys.bucketWithWater="mcl_buckets:bucket_water"
industrialtest.elementKeys.glowstone="mcl_nether:glowstone_dust"
industrialtest.elementKeys.glass="mcl_core:glass" industrialtest.elementKeys.glass="mcl_core:glass"
industrialtest.elementKeys.powerCarrier="mesecons:mesecon" industrialtest.elementKeys.powerCarrier="mesecons:mesecon"
industrialtest.elementKeys.furnace="mcl_furnaces:furnace" industrialtest.elementKeys.furnace="mcl_furnaces:furnace"
@ -728,7 +727,6 @@ elseif industrialtest.mtgAvailable then
industrialtest.elementKeys.bucketWithWater="bucket:bucket_water" industrialtest.elementKeys.bucketWithWater="bucket:bucket_water"
industrialtest.elementKeys.string="farming:string" industrialtest.elementKeys.string="farming:string"
industrialtest.elementKeys.junglePlanks="default:junglewood" industrialtest.elementKeys.junglePlanks="default:junglewood"
industrialtest.elementKeys.glowstone="dye:yellow"
industrialtest.elementKeys.glass="default:glass" industrialtest.elementKeys.glass="default:glass"
industrialtest.elementKeys.powerCarrier="default:mese_crystal_fragment" industrialtest.elementKeys.powerCarrier="default:mese_crystal_fragment"
industrialtest.elementKeys.furnace="default:furnace" industrialtest.elementKeys.furnace="default:furnace"

View File

@ -578,6 +578,11 @@ minetest.register_craftitem("industrialtest:scrap",{
inventory_image="industrialtest_scrap.png" inventory_image="industrialtest_scrap.png"
}) })
minetest.register_craftitem("industrialtest:uu_matter",{
description=S("UU-Matter"),
inventory_image="industrialtest_uu_matter.png"
})
-- Item callbacks -- Item callbacks
minetest.register_on_player_inventory_action(function(player,action,inventory,info) minetest.register_on_player_inventory_action(function(player,action,inventory,info)
if action=="put" then if action=="put" then

View File

@ -41,6 +41,7 @@ dofile(modpath.."/machines/fluid_generator.lua")
dofile(modpath.."/machines/generator.lua") dofile(modpath.."/machines/generator.lua")
dofile(modpath.."/machines/iron_furnace.lua") dofile(modpath.."/machines/iron_furnace.lua")
dofile(modpath.."/machines/macerator.lua") dofile(modpath.."/machines/macerator.lua")
dofile(modpath.."/machines/mass_fabricator.lua")
dofile(modpath.."/machines/nuclear_reactor.lua") dofile(modpath.."/machines/nuclear_reactor.lua")
dofile(modpath.."/machines/power_storage.lua") dofile(modpath.."/machines/power_storage.lua")
dofile(modpath.."/machines/recycler.lua") dofile(modpath.."/machines/recycler.lua")

View File

@ -408,6 +408,21 @@ local function craftResultProxy(method,item)
time=output.time, time=output.time,
src=srcAfter 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 end
error("Unknown craft method passed to craftResultProxy") error("Unknown craft method passed to craftResultProxy")
end end
@ -622,6 +637,7 @@ simpleElectricItemProcessor.activeOnTimer=function(pos,elapsed,meta,inv,config)
end end
function industrialtest.internal.registerSimpleElectricItemProcessor(config) function industrialtest.internal.registerSimpleElectricItemProcessor(config)
local machineBlockTexture=config.machineBlockTexture or "industrialtest_machine_block.png"
industrialtest.internal.registerMachine({ industrialtest.internal.registerMachine({
name=config.name, name=config.name,
displayName=config.displayName, displayName=config.displayName,
@ -639,12 +655,12 @@ function industrialtest.internal.registerSimpleElectricItemProcessor(config)
}, },
customKeys={ customKeys={
tiles={ tiles={
"industrialtest_machine_block.png"..(config.customTopTexture and "^industrialtest_"..config.name.."_top.png" or ""), machineBlockTexture..(config.customTopTexture and "^industrialtest_"..config.name.."_top.png" or ""),
"industrialtest_machine_block.png"..(config.customBottomTexture and "^industrialtest_"..config.name.."_bottom.png" or ""), machineBlockTexture..(config.customBottomTexture and "^industrialtest_"..config.name.."_bottom.png" or ""),
"industrialtest_machine_block.png"..(config.customRightTexture and "^industrialtest_"..config.name.."_right.png" or ""), machineBlockTexture..(config.customRightTexture and "^industrialtest_"..config.name.."_right.png" or ""),
"industrialtest_machine_block.png"..(config.customLeftTexture and "^industrialtest_"..config.name.."_left.png" or ""), machineBlockTexture..(config.customLeftTexture and "^industrialtest_"..config.name.."_left.png" or ""),
"industrialtest_machine_block.png"..(config.customBackTexture and "^industrialtest_"..config.name.."_back.png" or ""), machineBlockTexture..(config.customBackTexture and "^industrialtest_"..config.name.."_back.png" or ""),
"industrialtest_machine_block.png"..(config.customFrontTexture and "^industrialtest_"..config.name.."_front.png" or "") machineBlockTexture..(config.customFrontTexture and "^industrialtest_"..config.name.."_front.png" or "")
}, },
paramtype2="facedir", paramtype2="facedir",
legacy_facedir_simple=true, legacy_facedir_simple=true,
@ -652,12 +668,12 @@ function industrialtest.internal.registerSimpleElectricItemProcessor(config)
}, },
activeCustomKeys={ activeCustomKeys={
tiles={ tiles={
"industrialtest_machine_block.png"..(config.customTopTexture and "^industrialtest_"..config.name.."_top_active.png" or ""), machineBlockTexture..(config.customTopTexture and "^industrialtest_"..config.name.."_top_active.png" or ""),
"industrialtest_machine_block.png"..(config.customBottomTexture and "^industrialtest_"..config.name.."_bottom_active.png" or ""), machineBlockTexture..(config.customBottomTexture and "^industrialtest_"..config.name.."_bottom_active.png" or ""),
"industrialtest_machine_block.png"..(config.customRightTexture and "^industrialtest_"..config.name.."_right_active.png" or ""), machineBlockTexture..(config.customRightTexture and "^industrialtest_"..config.name.."_right_active.png" or ""),
"industrialtest_machine_block.png"..(config.customLeftTexture and "^industrialtest_"..config.name.."_left_active.png" or ""), machineBlockTexture..(config.customLeftTexture and "^industrialtest_"..config.name.."_left_active.png" or ""),
"industrialtest_machine_block.png"..(config.customBackTexture and "^industrialtest_"..config.name.."_back_active.png" or ""), machineBlockTexture..(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.customFrontTexture and "^industrialtest_"..config.name.."_front_active.png" or "")
} }
}, },
onConstruct=simpleElectricItemProcessor.onConstruct, onConstruct=simpleElectricItemProcessor.onConstruct,

View File

@ -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 <http://www.gnu.org/licenses/>.
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}
}
})

View File

@ -31,7 +31,7 @@ minetest.register_craft({
type="shaped", type="shaped",
output="industrialtest:recycler", output="industrialtest:recycler",
recipe={ recipe={
{"",industrialtest.elementKeys.glowstone,""}, {"",industrialtest.elementKeys.yellowDust,""},
{industrialtest.elementKeys.dirt,"industrialtest:compressor",industrialtest.elementKeys.dirt}, {industrialtest.elementKeys.dirt,"industrialtest:compressor",industrialtest.elementKeys.dirt},
{"industrialtest:refined_iron_ingot",industrialtest.elementKeys.dirt,"industrialtest:refined_iron_ingot"} {"industrialtest:refined_iron_ingot",industrialtest.elementKeys.dirt,"industrialtest:refined_iron_ingot"}
} }