Started generalizing component

This commit is contained in:
Samy Avrillon 2024-05-18 01:19:24 +02:00
parent 55f9fa3367
commit 5873ebdd77
No known key found for this signature in database
GPG Key ID: 3E163E7603E330FE

View File

@ -1,8 +1,20 @@
--[[ --[[
0 : x+,z+ Component 2x3:
1 : TODO finish the comment
z+
/|\
\ 22 | 11 /
\ 22 | 11 /
\ 22 | 11 /
333 \ | / 000
333 \|/ 000
+> x+
444 /|\ 777
444 / | \ 777
/ 55 | 66 \
/ 55 | 66 \
/ 55 | 66 \
--]] --]]
local function vecTo8dir(vec) local function vecTo8dir(vec)
local x = vec[1] local x = vec[1]
@ -42,6 +54,19 @@ local function remove_no_destruct(pos)
minetest.check_for_falling(pos) minetest.check_for_falling(pos)
end end
-- Everything is described as if dir=0
-- {name,width,height,{cables_left,cables_right,cables_top,cables_bottom}}
components = {
"and" = {2,3,{{"in_1","in_2"},{"out"},{},{}}},
"switch" = {2,1,{{"in"},{"out"},{"activate"},{}}},
"demux" = {2,8,{{"in_1","in_2","in_3"},{"out_1","out_2","out_3","out_4","out_5","out_6","out_7","out_8"},{},{}}},
}
-- componentsblocks["block"] = {name,x,y}
componentsblocks = {}
minetest.register_node("logikraft:component_head", { minetest.register_node("logikraft:component_head", {
drawtype = "block", drawtype = "block",
tiles = {"component.png"}, tiles = {"component.png"},