Implement Recycler

This commit is contained in:
mrkubax10 2023-03-23 09:51:49 +02:00
parent 53879fdd93
commit 31a1470ba0
3 changed files with 35 additions and 0 deletions

View File

@ -493,6 +493,7 @@ if industrialtest.mclAvailable then
industrialtest.elementKeys.coal="mcl_core:coal_lump"
industrialtest.elementKeys.clay="mcl_core:clay_lump"
industrialtest.elementKeys.diamond="mcl_core:diamond"
industrialtest.elementKeys.glowstone="mcl_nether:glowstone_dust"
industrialtest.elementKeys.powerCarrier="mesecons:mesecon"
industrialtest.elementKeys.furnace="mcl_furnaces:furnace"
industrialtest.elementKeys.stone="mcl_core:stone"
@ -501,6 +502,7 @@ if industrialtest.mclAvailable then
industrialtest.elementKeys.gravel="mcl_core:gravel"
industrialtest.elementKeys.ice="mcl_core:ice"
industrialtest.elementKeys.sandstone="mcl_core:sandstone"
industrialtest.elementKeys.dirt="mcl_core:dirt"
industrialtest.elementKeys.obsidian="mcl_core:obsidian"
industrialtest.elementKeys.whiteWool="mcl_wool:white"
industrialtest.elementKeys.coalBlock="mcl_core:coalblock"
@ -693,6 +695,7 @@ elseif industrialtest.mtgAvailable then
industrialtest.elementKeys.snowball="default:snow"
industrialtest.elementKeys.string="farming:string"
industrialtest.elementKeys.junglePlanks="default:junglewood"
industrialtest.elementKeys.glowstone="dye:yellow"
industrialtest.elementKeys.powerCarrier="default:mese_crystal_fragment"
industrialtest.elementKeys.furnace="default:furnace"
industrialtest.elementKeys.stone="default:stone"
@ -701,6 +704,7 @@ elseif industrialtest.mtgAvailable then
industrialtest.elementKeys.gravel="default:gravel"
industrialtest.elementKeys.ice="default:ice"
industrialtest.elementKeys.sandstone="default:sandstone"
industrialtest.elementKeys.dirt="default:dirt"
industrialtest.elementKeys.obsidian="default:obsidian"
industrialtest.elementKeys.whiteWool="wool:white"
industrialtest.elementKeys.coalBlock="default:coalblock"

View File

@ -334,6 +334,10 @@ minetest.register_craft({
{"industrialtest:insulated_copper_cable","industrialtest:insulated_copper_cable","industrialtest:insulated_copper_cable"}
}
})
minetest.register_craftitem("industrialtest:scrap",{
description=S("Scrap"),
inventory_image="industrialtest_scrap.png"
})
-- Item callbacks
minetest.register_on_player_inventory_action(function(player,action,inventory,info)

View File

@ -329,6 +329,14 @@ local function registerSimpleElectricItemProcessor(config)
time=output.time,
src=srcAfter
}
elseif method=="industrialtest.recycling" then
local srcAfter=ItemStack(item:get_name())
srcAfter:set_count(item:get_count()-1)
return {
item=ItemStack(industrialtest.random:next(1,8)==1 and "industrialtest:scrap" or ""),
time=2,
src=srcAfter
}
end
error("Unknown craft method passed to craftResultProxy")
end
@ -813,3 +821,22 @@ minetest.register_craft({
{"industrialtest:treetap","industrialtest:electronic_circuit","industrialtest:treetap"}
}
})
registerSimpleElectricItemProcessor({
name="recycler",
displayName="Recycler",
capacity=80,
flow=industrialtest.api.lvPowerFlow,
opPower=40,
method="industrialtest.recycling",
efficiency=1
})
minetest.register_craft({
type="shaped",
output="industrialtest:recycler",
recipe={
{"",industrialtest.elementKeys.glowstone,""},
{industrialtest.elementKeys.dirt,"industrialtest:compressor",industrialtest.elementKeys.dirt},
{"industrialtest:refined_iron_ingot",industrialtest.elementKeys.dirt,"industrialtest:refined_iron_ingot"}
}
})