Added a lot of circuits code
This commit is contained in:
@@ -113,6 +113,7 @@ end
|
||||
nbconn: Which correspond each nodebox correspond to
|
||||
ex: {1,1,2,1} -> nodeboxes 1,2,3 correspond to connection ES, and nodebox 2 correspond to connection W
|
||||
--]]
|
||||
logikraft.cablesblocks = {}
|
||||
logikraft.cablesnb = {}
|
||||
logikraft.cablesconn = {}
|
||||
logikraft.cablesnbconn = {}
|
||||
@@ -150,6 +151,7 @@ local function createCables(name,nodeboxes,connections,nbconn)
|
||||
if name == "EW8_N1_S1"
|
||||
then print(dump(connections2)) end
|
||||
|
||||
logikraft.cablesblocks["logikraft:cable_"..name] = name
|
||||
logikraft.cablesnb[name] = nodeboxes
|
||||
logikraft.cablesconn[name] = connections2
|
||||
logikraft.cablesnbconn[name] = nbconn2
|
||||
|
||||
+2
-1
@@ -33,7 +33,8 @@ minetest.register_node("logikraft:circuitBlock", {
|
||||
description = "Circuit Block",
|
||||
tiles = {"circuit_block.png"},
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
logikraft.discoverBlocks(pos)
|
||||
local poz = logikraft.discoverBlocks(pos)
|
||||
local circuit = logikraft.compileCircuit(poz)
|
||||
end,
|
||||
groups = {circuitry = 1,dig_immediate = 3}
|
||||
})
|
||||
@@ -12,16 +12,16 @@ end
|
||||
-- | XXX h
|
||||
-- +−−−−−−−−−−−> x+
|
||||
-- {name,width,height,{cables_left,cables_right,cables_top,cables_bottom}}
|
||||
components = {}
|
||||
components["and"] = {2,3,{{"in_2",nil,"in_1"},{nil,"out",nil},nil,nil}}
|
||||
components["switch"] = {2,1,{{"in"},{"out"},{"activate",nil},nil}}
|
||||
components["demux"] = {2,8,{{nil,nil,nil,nil,nil,"in_3","in_2","in_1"},{"out_8","out_7","out_6","out_5","out_4","out_3","out_2","out_1"},nil,nil}}
|
||||
|
||||
logikraft.components = {
|
||||
["and"] = {2,3,{{"in_2",nil,"in_1"},{nil,"out",nil},nil,nil}},
|
||||
["switch"] = {2,1,{{"in"},{"out"},{"activate",nil},nil}},
|
||||
["demux"] = {2,8,{{nil,nil,nil,nil,nil,"in_3","in_2","in_1"},{"out_8","out_7","out_6","out_5","out_4","out_3","out_2","out_1"},nil,nil}}
|
||||
}
|
||||
|
||||
-- componentsblocks["block"] = {name,x,y}
|
||||
componentsblocks = {}
|
||||
logikraft.componentsblocks = {}
|
||||
|
||||
for name,cmp in pairs(components)
|
||||
for name,cmp in pairs(logikraft.components)
|
||||
do
|
||||
local w = cmp[1]
|
||||
local h = cmp[2]
|
||||
@@ -109,7 +109,7 @@ do
|
||||
end
|
||||
end
|
||||
})
|
||||
componentsblocks["nodename"] = {name,x,y}
|
||||
logikraft.componentsblocks[nodename] = {name = name, x = x, y = y}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user