Implement copper cable

This commit is contained in:
2023-03-11 16:52:51 +01:00
parent 9d89c588ee
commit 4e7499279c
5 changed files with 126 additions and 32 deletions

View File

@@ -43,20 +43,6 @@ minetest.register_craft({
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
industrialtest.api.triggerNeighbours(pos)
end
end)