Add other cables

This commit is contained in:
mrkubax10 2023-03-23 11:30:16 +01:00
parent 46e362c6c2
commit cfdcd58569
2 changed files with 127 additions and 53 deletions

View File

@ -16,7 +16,7 @@
local S=minetest.get_translator("industrialtest")
local function registerCable(name,displayName,material,size,flow)
local function registerCable(name,displayName,size,flow,registerInsulated)
local definition={
description=S(displayName.." Cable"),
inventory_image="industrialtest_"..name.."_cable_inv.png",
@ -143,57 +143,129 @@ local function registerCable(name,displayName,material,size,flow)
end
definition.groups._industrialtest_hasPowerInput=1
minetest.register_node("industrialtest:"..name.."_cable",definition)
minetest.register_craft({
type="shaped",
output="industrialtest:"..name.."_cable 6",
recipe={
{material,material,material},
{"","",""},
{"","",""}
}
})
minetest.register_craft({
type="shaped",
output="industrialtest:"..name.."_cable 6",
recipe={
{"","",""},
{material,material,material},
{"","",""}
}
})
minetest.register_craft({
type="shaped",
output="industrialtest:"..name.."_cable 6",
recipe={
{"","",""},
{"","",""},
{material,material,material}
}
})
definition=table.copy(definition)
definition.description=S("Insulated "..displayName.." Cable")
definition.inventory_image="industrialtest_insulated_"..name.."_cable_inv.png"
definition.tiles={"industrialtest_insulated_copper_cable.png"}
definition.wield_image="industrialtest_insulated_"..name.."_cable_inv.png"
definition._industrialtest_electrocution=nil
minetest.register_node("industrialtest:insulated_"..name.."_cable",definition)
minetest.register_craft({
type="shapeless",
output="industrialtest:insulated_"..name.."_cable",
recipe={
"industrialtest:"..name.."_cable",
"industrialtest:rubber"
}
})
minetest.register_craft({
type="shaped",
output="industrialtest:insulated_"..name.."_cable 6",
recipe={
{"industrialtest:rubber","industrialtest:rubber","industrialtest:rubber"},
{"industrialtest:"..name.."_ingot","industrialtest:"..name.."_ingot","industrialtest:"..name.."_ingot"},
{"industrialtest:rubber","industrialtest:rubber","industrialtest:rubber"}
}
})
if registerInsulated then
definition=table.copy(definition)
definition.description=S("Insulated "..displayName.." Cable")
definition.inventory_image="industrialtest_insulated_"..name.."_cable_inv.png"
definition.tiles={"industrialtest_insulated_copper_cable.png"}
definition.wield_image="industrialtest_insulated_"..name.."_cable_inv.png"
definition._industrialtest_electrocution=nil
minetest.register_node("industrialtest:insulated_"..name.."_cable",definition)
end
end
registerCable("copper","Copper",industrialtest.elementKeys.copperIngot,0.15,industrialtest.api.mvPowerFlow)
registerCable("tin","Tin",0.15,industrialtest.api.lvPowerFlow,true)
minetest.register_craft({
type="shaped",
output="industrialtest:tin_cable 6",
recipe={
{industrialtest.elementKeys.tinIngot,industrialtest.elementKeys.tinIngot,industrialtest.elementKeys.tinIngot}
}
})
minetest.register_craft({
type="shapeless",
output="industrialtest:insulated_tin_cable",
recipe={
"industrialtest:tin_cable",
"industrialtest:rubber"
}
})
minetest.register_craft({
type="shaped",
output="industrialtest:insulated_tin_cable 6",
recipe={
{"industrialtest:rubber","industrialtest:rubber","industrialtest:rubber"},
{industrialtest.elementKeys.tinIngot,industrialtest.elementKeys.tinIngot,industrialtest.elementKeys.tinIngot},
{"industrialtest:rubber","industrialtest:rubber","industrialtest:rubber"}
}
})
registerCable("copper","Copper",0.15,industrialtest.api.mvPowerFlow,true)
minetest.register_craft({
type="shaped",
output="industrialtest:copper_cable 6",
recipe={
{industrialtest.elementKeys.copperIngot,industrialtest.elementKeys.copperIngot,industrialtest.elementKeys.copperIngot}
}
})
minetest.register_craft({
type="shapeless",
output="industrialtest:insulated_copper_cable",
recipe={
"industrialtest:copper_cable",
"industrialtest:rubber"
}
})
minetest.register_craft({
type="shaped",
output="industrialtest:insulated_copper_cable 6",
recipe={
{"industrialtest:rubber","industrialtest:rubber","industrialtest:rubber"},
{industrialtest.elementKeys.copperIngot,industrialtest.elementKeys.copperIngot,industrialtest.elementKeys.copperIngot},
{"industrialtest:rubber","industrialtest:rubber","industrialtest:rubber"}
}
})
registerCable("gold","Gold",0.15,industrialtest.api.hvPowerFlow,true)
minetest.register_craft({
type="shaped",
output="industrialtest:gold_cable 6",
recipe={
{industrialtest.elementKeys.goldIngot,industrialtest.elementKeys.goldIngot,industrialtest.elementKeys.goldIngot}
}
})
minetest.register_craft({
type="shapeless",
output="industrialtest:insulated_gold_cable",
recipe={
"industrialtest:gold_cable",
"industrialtest:rubber"
}
})
minetest.register_craft({
type="shaped",
output="industrialtest:insulated_gold_cable 6",
recipe={
{"industrialtest:rubber","industrialtest:rubber","industrialtest:rubber"},
{industrialtest.elementKeys.goldIngot,industrialtest.elementKeys.goldIngot,industrialtest.elementKeys.goldIngot},
{"industrialtest:rubber","industrialtest:rubber","industrialtest:rubber"}
}
})
registerCable("iron","Iron",0.15,industrialtest.api.uvPowerFlow,true)
minetest.register_craft({
type="shaped",
output="industrialtest:iron_cable 6",
recipe={
{"industrialtest:refined_iron_ingot","industrialtest:refined_iron_ingot","industrialtest:refined_iron_ingot"}
}
})
minetest.register_craft({
type="shapeless",
output="industrialtest:insulated_iron_cable",
recipe={
"industrialtest:iron_cable",
"industrialtest:rubber"
}
})
minetest.register_craft({
type="shaped",
output="industrialtest:insulated_iron_cable 6",
recipe={
{"industrialtest:rubber","industrialtest:rubber","industrialtest:rubber"},
{"industrialtest:refined_iron_ingot","industrialtest:refined_iron_ingot","industrialtest:refined_iron_ingot"},
{"industrialtest:rubber","industrialtest:rubber","industrialtest:rubber"}
}
})
registerCable("glass_fibre","Glass Fibre",0.15,industrialtest.api.ivPowerFlow,false)
minetest.register_craft({
type="shaped",
output="industrialtest:glass_fibre_cable 4",
recipe={
{industrialtest.elementKeys.glass,industrialtest.elementKeys.glass,industrialtest.elementKeys.glass},
{industrialtest.elementKeys.powerCarrier,industrialtest.elementKeys.diamond,industrialtest.elementKeys.powerCarrier},
{industrialtest.elementKeys.glass,industrialtest.elementKeys.glass,industrialtest.elementKeys.glass}
}
})
-- TODO: Add glass fibre cable craft with silver ingot

View File

@ -494,6 +494,7 @@ if industrialtest.mclAvailable then
industrialtest.elementKeys.clay="mcl_core:clay_lump"
industrialtest.elementKeys.diamond="mcl_core:diamond"
industrialtest.elementKeys.glowstone="mcl_nether:glowstone_dust"
industrialtest.elementKeys.glass="mcl_core:glass"
industrialtest.elementKeys.powerCarrier="mesecons:mesecon"
industrialtest.elementKeys.furnace="mcl_furnaces:furnace"
industrialtest.elementKeys.stone="mcl_core:stone"
@ -696,6 +697,7 @@ elseif industrialtest.mtgAvailable then
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"
industrialtest.elementKeys.stone="default:stone"