forked from VoxeLibre/VoxeLibre
wirering
This commit is contained in:
parent
51b2700181
commit
1071f12faf
|
@ -61,7 +61,7 @@ local function wire_getconnect(from_pos, self_pos, from_rule)
|
|||
local xpmnode = mesecon.get_node_force(vector.add(from_pos, {x=from_rule.x, y=0, z=0}))
|
||||
--check blocks z=+-1
|
||||
local zmnode = mesecon.get_node_force(vector.add(from_pos, {x=0, y=0, z=-1}))
|
||||
if (mesecon.is_receptor(zmnode.name) or mesecon.is_conductor(zmnode.name)) and not (minetest.get_item_group(xpmnode.name, "opaque") == 1) then return false, 5 end
|
||||
if (mesecon.is_receptor(zmnode.name) or mesecon.is_conductor(zmnode.name)) then return false, 5 end
|
||||
if minetest.get_item_group(zmnode.name, "opaque") == 1 then
|
||||
--check upper
|
||||
local zmypnode = mesecon.get_node_force(vector.add(from_pos, {x=0, y= 1, z=-1}))
|
||||
|
@ -73,7 +73,7 @@ local function wire_getconnect(from_pos, self_pos, from_rule)
|
|||
end
|
||||
|
||||
local zpnode = mesecon.get_node_force(vector.add(from_pos, {x=0, y=0, z= 1}))
|
||||
if (mesecon.is_receptor(zpnode.name) or mesecon.is_conductor(zpnode.name)) and not (minetest.get_item_group(xpmnode.name, "opaque") == 1) then return false, 8 end
|
||||
if (mesecon.is_receptor(zpnode.name) or mesecon.is_conductor(zpnode.name)) then return false, 8 end
|
||||
if minetest.get_item_group(zpnode.name, "opaque") == 1 then
|
||||
--check upper
|
||||
local zpypnode = mesecon.get_node_force(vector.add(from_pos, {x=0, y=1, z= 1}))
|
||||
|
@ -83,13 +83,25 @@ local function wire_getconnect(from_pos, self_pos, from_rule)
|
|||
local zpymnode = mesecon.get_node_force(vector.add(from_pos, {x=0, y=-1, z= 1}))
|
||||
if mesecon.is_conductor(zpymnode.name) then return false, 10 end
|
||||
end
|
||||
if mesecon.is_effector(node.name) then
|
||||
--check block behind
|
||||
local xnode = mesecon.get_node_force(vector.add(from_pos, {x=from_rule.x*-1, y=0, z=0}))
|
||||
if xnode.name=="air" then
|
||||
--check lower
|
||||
xnode = mesecon.get_node_force(vector.add(from_pos, {x=from_rule.x*-1, y=-1, z=0}))
|
||||
elseif minetest.get_item_group(xnode.name, "opaque") == 1 then
|
||||
--check upper
|
||||
xnode = mesecon.get_node_force(vector.add(from_pos, {x=from_rule.x*-1, y= 1, z=0}))
|
||||
end
|
||||
if not(mesecon.is_receptor(xnode.name) or mesecon.is_conductor(xnode.name)) then return false end
|
||||
end
|
||||
end
|
||||
|
||||
if from_rule.z==1 or from_rule.z==-1 then
|
||||
local zpmnode = mesecon.get_node_force(vector.add(from_pos, {x=0, y=0, z=from_rule.z}))
|
||||
--check blocks x=+-1
|
||||
local xmnode = mesecon.get_node_force(vector.add(from_pos, {x=-1, y=0, z=0}))
|
||||
if (mesecon.is_receptor(xmnode.name) or mesecon.is_conductor(xmnode.name)) and not (minetest.get_item_group(zpmnode.name, "opaque") == 1) then return false, 12 end
|
||||
if (mesecon.is_receptor(xmnode.name) or mesecon.is_conductor(xmnode.name)) then return false, 12 end
|
||||
if minetest.get_item_group(xmnode.name, "opaque") == 1 then
|
||||
--check upper
|
||||
local xmypnode = mesecon.get_node_force(vector.add(from_pos, {x=-1, y=1, z=0}))
|
||||
|
@ -101,7 +113,7 @@ local function wire_getconnect(from_pos, self_pos, from_rule)
|
|||
end
|
||||
|
||||
local xpnode = mesecon.get_node_force(vector.add(from_pos, {x= 1, y=0, z=0}))
|
||||
if (mesecon.is_receptor(xpnode.name) or mesecon.is_conductor(xpnode.name)) and not (minetest.get_item_group(zpmnode.name, "opaque") == 1) then return false, 15 end
|
||||
if (mesecon.is_receptor(xpnode.name) or mesecon.is_conductor(xpnode.name)) then return false, 15 end
|
||||
if minetest.get_item_group(xpnode.name, "opaque") == 1 then
|
||||
--check upper
|
||||
local xpypnode = mesecon.get_node_force(vector.add(from_pos, {x= 1, y=1, z=0}))
|
||||
|
@ -111,6 +123,18 @@ local function wire_getconnect(from_pos, self_pos, from_rule)
|
|||
local xpymnode = mesecon.get_node_force(vector.add(from_pos, {x=1, y=-1, z= 0}))
|
||||
if mesecon.is_conductor(xpymnode.name) then return false, 17 end
|
||||
end
|
||||
if mesecon.is_effector(node.name) then
|
||||
--check block behind
|
||||
local znode = mesecon.get_node_force(vector.add(from_pos, {x=0, y=0, z=from_rule.z*-1}))
|
||||
if znode.name=="air" then
|
||||
--check lower
|
||||
znode = mesecon.get_node_force(vector.add(from_pos, {x=from_rule.x*-1, y=-1, z=0}))
|
||||
elseif minetest.get_item_group(znode.name, "opaque") == 1 then
|
||||
--check upper
|
||||
znode = mesecon.get_node_force(vector.add(from_pos, {x=from_rule.x*-1, y= 1, z=0}))
|
||||
end
|
||||
if not(mesecon.is_receptor(znode.name) or mesecon.is_conductor(znode.name)) then return false end
|
||||
end
|
||||
end
|
||||
return true, 0
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue