From 5873ebdd77d3f214191ed0b66f358fbaabc2c727 Mon Sep 17 00:00:00 2001 From: Samy Avrillon Date: Sat, 18 May 2024 01:19:24 +0200 Subject: [PATCH] Started generalizing component --- blocks/component.lua | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/blocks/component.lua b/blocks/component.lua index 4500669..14a523c 100644 --- a/blocks/component.lua +++ b/blocks/component.lua @@ -1,8 +1,20 @@ - --[[ -0 : x+,z+ -1 : TODO finish the comment +Component 2x3: + + 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 x = vec[1] @@ -42,6 +54,19 @@ local function remove_no_destruct(pos) minetest.check_for_falling(pos) 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", { drawtype = "block", tiles = {"component.png"},