Implement Electric Furnace :O

This commit is contained in:
2023-03-07 20:41:35 +01:00
parent be74c6c2ee
commit e253564a91
4 changed files with 326 additions and 20 deletions

View File

@@ -38,3 +38,25 @@ minetest.register_craft({
{"industrialtest:refined_iron_ingot","industrialtest:refined_iron_ingot","industrialtest:refined_iron_ingot"}
}
})
-- Node callbacks
minetest.register_on_placenode(function(pos,newNode)
local def=minetest.registered_nodes[newNode.name]
if def and def._industrialtest_hasPowerInput then
local neighbourPositions={
vector.offset(pos,-1,0,0),
vector.offset(pos,1,0,0),
vector.offset(pos,0,-1,0),
vector.offset(pos,0,1,0),
vector.offset(pos,0,0,-1),
vector.offset(pos,0,0,1)
}
for key,value in ipairs(neighbourPositions) do
local meta=minetest.get_meta(value)
local strIndex=(key%2==0 and key-1 or key+1)
if industrialtest.api.hasPowerStorage(meta) and string.sub(meta:get_string("industrialtest.ioConfig"),strIndex,strIndex)=="o" then
minetest.get_node_timer(value):start(1.0)
end
end
end
end)