Fixed the linker
This commit is contained in:
parent
3d9944921f
commit
6e4c9f1b02
@ -367,7 +367,8 @@ function logikraft.connFromDir(name,dir)
|
||||
for i,c in ipairs(conns)
|
||||
do
|
||||
if (math.fmod(c,2*dir8) - dir8 >= 0)
|
||||
then return i
|
||||
then
|
||||
return i
|
||||
end
|
||||
end
|
||||
return nil
|
||||
@ -390,10 +391,12 @@ function logikraft.connectContiguousCable(namea,posa,a,nameb,posb,b)
|
||||
|
||||
local connsa = table.copy(logikraft.cablesconn[namea])
|
||||
local connsb = table.copy(logikraft.cablesconn[nameb])
|
||||
print(dump(connsa))
|
||||
print(dump(connsb))
|
||||
local cia = logikraft.cablesnbconn[namea][a]
|
||||
local cib = logikraft.cablesnbconn[nameb][b]
|
||||
local cia2 = logikraft.connFromDir(namea,dira)
|
||||
local cib2 = logikraft.connFromDir(nameb,3 - dira)
|
||||
local cib2 = logikraft.connFromDir(nameb,math.fmod(dira+2,4))
|
||||
print(dira)
|
||||
print(cia)
|
||||
print(cia2)
|
||||
@ -407,7 +410,7 @@ function logikraft.connectContiguousCable(namea,posa,a,nameb,posb,b)
|
||||
if (cia2 == nil)
|
||||
then
|
||||
connsa[cia] = connsa[cia] + math.pow(2,dira)
|
||||
elseif (a ~= cia2)
|
||||
elseif (cia ~= cia2)
|
||||
then
|
||||
-- We take the v size of selected cable
|
||||
local v = math.fmod(math.floor(connsa[cia]/16),2)
|
||||
@ -417,8 +420,8 @@ function logikraft.connectContiguousCable(namea,posa,a,nameb,posb,b)
|
||||
|
||||
if (cib2 == nil)
|
||||
then
|
||||
connsb[cib] = connsb[cib] + math.pow(2,3-dira)
|
||||
elseif (b ~= cib2)
|
||||
connsb[cib] = connsb[cib] + math.pow(2,math.fmod(dira+2,4))
|
||||
elseif (cib ~= cib2)
|
||||
then
|
||||
-- We take the v size of selected cable
|
||||
local v = math.fmod(math.floor(connsb[cib]/16),2)
|
||||
|
||||
@ -40,8 +40,8 @@ minetest.register_craftitem("logikraft:linker", {
|
||||
else
|
||||
local thisnb = logikraft.lookingAtNbIndex(user,pointed_thing.under)
|
||||
local new = logikraft.connectContiguousCable(
|
||||
string.without(node.name,"logikraft:cable_"),selectedpos,selectednb,
|
||||
string.without(minetest.get_node(pointed_thing.under).name,"logikraft:cable_"),pointed_thing.under,thisnb)
|
||||
string.without(minetest.get_node(selectedpos).name,"logikraft:cable_"),selectedpos,selectednb,
|
||||
string.without(node.name,"logikraft:cable_"),pointed_thing.under,thisnb)
|
||||
if new
|
||||
then
|
||||
minetest.swap_node(selectedpos, {name = "logikraft:cable_" .. new[1]})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user