Refactor Compressor
This commit is contained in:
parent
18a1cbc983
commit
165450f857
@ -15,18 +15,57 @@
|
|||||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
local S=minetest.get_translator("industrialtest")
|
local S=minetest.get_translator("industrialtest")
|
||||||
|
industrialtest.Compressor=table.copy(industrialtest.SimpleElectricItemProcessor)
|
||||||
industrialtest.internal.registerSimpleElectricItemProcessor({
|
industrialtest.internal.unpackTableInto(industrialtest.Compressor,{
|
||||||
name="compressor",
|
name="industrialtest:compressor",
|
||||||
displayName=S("Compressor"),
|
description=S("Compressor"),
|
||||||
customFrontTexture=true,
|
tiles={
|
||||||
|
"industrialtest_machine_block.png",
|
||||||
|
"industrialtest_machine_block.png",
|
||||||
|
"industrialtest_machine_block.png",
|
||||||
|
"industrialtest_machine_block.png",
|
||||||
|
"industrialtest_machine_block.png",
|
||||||
|
"industrialtest_machine_block.png^industrialtest_compressor_front.png",
|
||||||
|
"industrialtest_machine_block.png"
|
||||||
|
},
|
||||||
requiresWrench=true,
|
requiresWrench=true,
|
||||||
|
active={
|
||||||
|
tiles={
|
||||||
|
"industrialtest_machine_block.png",
|
||||||
|
"industrialtest_machine_block.png",
|
||||||
|
"industrialtest_machine_block.png",
|
||||||
|
"industrialtest_machine_block.png",
|
||||||
|
"industrialtest_machine_block.png",
|
||||||
|
"industrialtest_machine_block.png^industrialtest_compressor_front_active.png",
|
||||||
|
"industrialtest_machine_block.png"
|
||||||
|
}
|
||||||
|
},
|
||||||
capacity=1400,
|
capacity=1400,
|
||||||
flow=industrialtest.api.lvPowerFlow,
|
flow=industrialtest.api.lvPowerFlow,
|
||||||
opPower=120,
|
opPower=120,
|
||||||
method="industrialtest.compressing",
|
|
||||||
efficiency=1
|
efficiency=1
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function industrialtest.Compressor.getCraftResult(self,itemstack)
|
||||||
|
local output=industrialtest.api.getCompressorRecipeResult(itemstack:get_name())
|
||||||
|
if not output or itemstack:get_count()<output.count then
|
||||||
|
return {
|
||||||
|
item=ItemStack(),
|
||||||
|
time=0,
|
||||||
|
src=item
|
||||||
|
}
|
||||||
|
end
|
||||||
|
local srcAfter=ItemStack(itemstack:get_name())
|
||||||
|
srcAfter:set_count(itemstack:get_count()-output.count)
|
||||||
|
return {
|
||||||
|
item=ItemStack(output.output),
|
||||||
|
time=output.time,
|
||||||
|
src=srcAfter
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
industrialtest.Compressor:register()
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type="shaped",
|
type="shaped",
|
||||||
output="industrialtest:compressor",
|
output="industrialtest:compressor",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user