Implement Electric Furnace :O
This commit is contained in:
22
nodes.lua
22
nodes.lua
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user