From 1f6b7789efc6d5a62ba3185b6196a7dd89f3be27 Mon Sep 17 00:00:00 2001 From: Deet Mit Date: Fri, 4 Sep 2020 16:20:32 +0200 Subject: [PATCH] fix --- mesecons_autotools | 1 - mesecons_autotools_tmp/book/circuit.lua | 405 ++++++++++++ mesecons_autotools_tmp/book/file.lua | 47 ++ mesecons_autotools_tmp/book/formspec.lua | 88 +++ mesecons_autotools_tmp/book/image.lua | 125 ++++ mesecons_autotools_tmp/book/library.lua | 220 +++++++ mesecons_autotools_tmp/book/m3.lua | 271 ++++++++ mesecons_autotools_tmp/book/misc.lua | 48 ++ mesecons_autotools_tmp/book/mx.lua | 109 ++++ mesecons_autotools_tmp/book/stats.lua | 71 +++ .../commands/all_commands.lua | 0 mesecons_autotools_tmp/debug.lua | 16 + mesecons_autotools_tmp/init.lua | 353 +++++++++++ mesecons_autotools_tmp/render.lua | 156 +++++ .../textures/circuit_empty.png | Bin 0 -> 257 bytes .../textures/circuit_full.png | Bin 0 -> 315 bytes .../textures/circuit_test.png | Bin 0 -> 244 bytes .../textures/formspec/empty.png | Bin 0 -> 123 bytes .../textures/formspec/gate/and0.png | Bin 0 -> 178 bytes .../textures/formspec/gate/and1.png | Bin 0 -> 177 bytes .../textures/formspec/gate/and2.png | Bin 0 -> 179 bytes .../textures/formspec/gate/and3.png | Bin 0 -> 176 bytes .../textures/formspec/gate/diode0.png | Bin 0 -> 181 bytes .../textures/formspec/gate/diode1.png | Bin 0 -> 179 bytes .../textures/formspec/gate/diode2.png | Bin 0 -> 181 bytes .../textures/formspec/gate/diode3.png | Bin 0 -> 178 bytes .../textures/formspec/gate/nand0.png | Bin 0 -> 180 bytes .../textures/formspec/gate/nand1.png | Bin 0 -> 180 bytes .../textures/formspec/gate/nand2.png | Bin 0 -> 180 bytes .../textures/formspec/gate/nand3.png | Bin 0 -> 179 bytes .../textures/formspec/gate/nor0.png | Bin 0 -> 180 bytes .../textures/formspec/gate/nor1.png | Bin 0 -> 183 bytes .../textures/formspec/gate/nor2.png | Bin 0 -> 180 bytes .../textures/formspec/gate/nor3.png | Bin 0 -> 183 bytes .../textures/formspec/gate/not0.png | Bin 0 -> 181 bytes .../textures/formspec/gate/not1.png | Bin 0 -> 179 bytes .../textures/formspec/gate/not2.png | Bin 0 -> 181 bytes .../textures/formspec/gate/not3.png | Bin 0 -> 178 bytes .../textures/formspec/gate/or0.png | Bin 0 -> 182 bytes .../textures/formspec/gate/or1.png | Bin 0 -> 182 bytes .../textures/formspec/gate/or2.png | Bin 0 -> 182 bytes .../textures/formspec/gate/or3.png | Bin 0 -> 182 bytes .../textures/formspec/gate/xor0.png | Bin 0 -> 184 bytes .../textures/formspec/gate/xor1.png | Bin 0 -> 186 bytes .../textures/formspec/gate/xor2.png | Bin 0 -> 183 bytes .../textures/formspec/gate/xor3.png | Bin 0 -> 187 bytes .../gate3/and3/jeija_gate3_and3r0.png | Bin 0 -> 183 bytes .../gate3/and3/jeija_gate3_and3r1.png | Bin 0 -> 179 bytes .../gate3/and3/jeija_gate3_and3r2.png | Bin 0 -> 183 bytes .../gate3/and3/jeija_gate3_and3r3.png | Bin 0 -> 177 bytes .../gate3/nand3/jeija_gate3_nand3r0.png | Bin 0 -> 187 bytes .../gate3/nand3/jeija_gate3_nand3r1.png | Bin 0 -> 184 bytes .../gate3/nand3/jeija_gate3_nand3r2.png | Bin 0 -> 187 bytes .../gate3/nand3/jeija_gate3_nand3r3.png | Bin 0 -> 182 bytes .../gate3/nor3/jeija_gate3_nor3r0.png | Bin 0 -> 187 bytes .../gate3/nor3/jeija_gate3_nor3r1.png | Bin 0 -> 187 bytes .../gate3/nor3/jeija_gate3_nor3r2.png | Bin 0 -> 187 bytes .../gate3/nor3/jeija_gate3_nor3r3.png | Bin 0 -> 186 bytes .../formspec/gate3/nor3/jeija_gate_nor3.png | Bin 0 -> 187 bytes .../formspec/gate3/or3/jeija_gate3_or3r0.png | Bin 0 -> 188 bytes .../formspec/gate3/or3/jeija_gate3_or3r1.png | Bin 0 -> 184 bytes .../formspec/gate3/or3/jeija_gate3_or3r2.png | Bin 0 -> 186 bytes .../formspec/gate3/or3/jeija_gate3_or3r3.png | Bin 0 -> 183 bytes .../textures/formspec/pink.png | Bin 0 -> 141 bytes .../textures/formspec/regs/ff0.png | Bin 0 -> 188 bytes .../textures/formspec/regs/ff1.png | Bin 0 -> 192 bytes .../textures/formspec/regs/ff2.png | Bin 0 -> 188 bytes .../textures/formspec/regs/ff3.png | Bin 0 -> 190 bytes .../textures/formspec/regs/latch0.png | Bin 0 -> 181 bytes .../textures/formspec/regs/latch1.png | Bin 0 -> 184 bytes .../textures/formspec/regs/latch2.png | Bin 0 -> 184 bytes .../textures/formspec/regs/latch3.png | Bin 0 -> 183 bytes .../textures/formspec/unknown.png | Bin 0 -> 201 bytes .../textures/formspec/wires/corner0.png | Bin 0 -> 142 bytes .../textures/formspec/wires/corner1.png | Bin 0 -> 144 bytes .../textures/formspec/wires/corner2.png | Bin 0 -> 146 bytes .../textures/formspec/wires/corner3.png | Bin 0 -> 137 bytes .../textures/formspec/wires/corssover.png | Bin 0 -> 160 bytes .../textures/formspec/wires/tjunction0.png | Bin 0 -> 142 bytes .../textures/formspec/wires/tjunction1.png | Bin 0 -> 145 bytes .../textures/formspec/wires/tjunction2.png | Bin 0 -> 144 bytes .../textures/formspec/wires/tjunction3.png | Bin 0 -> 143 bytes .../textures/formspec/wires/wireh.png | Bin 0 -> 130 bytes .../textures/formspec/wires/wirev.png | Bin 0 -> 134 bytes .../textures/formspec/wires/xjunction.png | Bin 0 -> 170 bytes mesecons_autotools_tmp/textures/library.png | Bin 0 -> 14925 bytes mesecons_autotools_tmp/textures/pos.png | Bin 0 -> 150 bytes .../textures/selection/pos1.png | Bin 0 -> 142 bytes .../textures/selection/pos2.png | Bin 0 -> 157 bytes mesecons_autotools_tmp/textures/test.png | Bin 0 -> 253 bytes .../textures/tools/black.png | Bin 0 -> 223 bytes .../textures/tools/blue.png | Bin 0 -> 249 bytes .../textures/tools/orange.png | Bin 0 -> 257 bytes .../textures/tools/orange_up.png | Bin 0 -> 246 bytes mesecons_autotools_tmp/textures/tools/red.png | Bin 0 -> 228 bytes .../textures/tools/refresh.png | Bin 0 -> 263 bytes .../textures/tools/white.png | Bin 0 -> 279 bytes .../textures/tools/white_down (copy).png | Bin 0 -> 255 bytes .../textures/tools/white_down.png | Bin 0 -> 271 bytes .../textures/tools/white_up.png | Bin 0 -> 257 bytes .../textures/tools/yellow.png | Bin 0 -> 298 bytes .../textures/tools/yellow_updown.png | Bin 0 -> 278 bytes mesecons_autotools_tmp/textures/wall.png | Bin 0 -> 147 bytes mesecons_autotools_tmp/tools.lua | 133 ++++ mesecons_autotools_tmp/tools/black/black.lua | 63 ++ mesecons_autotools_tmp/tools/blue/blue.lua | 30 + mesecons_autotools_tmp/tools/bundle.lua | 599 ++++++++++++++++++ mesecons_autotools_tmp/tools/direction.lua | 28 + .../tools/orange/orange.lua | 106 ++++ .../tools/orange_up/orange_up.lua | 92 +++ mesecons_autotools_tmp/tools/red/red.lua | 43 ++ .../tools/refresh/refresh.lua | 105 +++ mesecons_autotools_tmp/tools/selection.lua | 135 ++++ mesecons_autotools_tmp/tools/test/test.lua | 23 + mesecons_autotools_tmp/tools/white/white.lua | 151 +++++ .../tools/white_down/white_down.lua | 72 +++ .../tools/white_up/white_up.lua | 73 +++ mesecons_autotools_tmp/tools/wire.lua | 445 +++++++++++++ .../tools/yellow/yellow.lua | 218 +++++++ .../tools/yellow_updown/yellow_updown.lua | 73 +++ 120 files changed, 4298 insertions(+), 1 deletion(-) delete mode 160000 mesecons_autotools create mode 100644 mesecons_autotools_tmp/book/circuit.lua create mode 100644 mesecons_autotools_tmp/book/file.lua create mode 100644 mesecons_autotools_tmp/book/formspec.lua create mode 100644 mesecons_autotools_tmp/book/image.lua create mode 100644 mesecons_autotools_tmp/book/library.lua create mode 100644 mesecons_autotools_tmp/book/m3.lua create mode 100644 mesecons_autotools_tmp/book/misc.lua create mode 100644 mesecons_autotools_tmp/book/mx.lua create mode 100644 mesecons_autotools_tmp/book/stats.lua create mode 100644 mesecons_autotools_tmp/commands/all_commands.lua create mode 100644 mesecons_autotools_tmp/debug.lua create mode 100644 mesecons_autotools_tmp/init.lua create mode 100644 mesecons_autotools_tmp/render.lua create mode 100644 mesecons_autotools_tmp/textures/circuit_empty.png create mode 100644 mesecons_autotools_tmp/textures/circuit_full.png create mode 100644 mesecons_autotools_tmp/textures/circuit_test.png create mode 100644 mesecons_autotools_tmp/textures/formspec/empty.png create mode 100644 mesecons_autotools_tmp/textures/formspec/gate/and0.png create mode 100644 mesecons_autotools_tmp/textures/formspec/gate/and1.png create mode 100644 mesecons_autotools_tmp/textures/formspec/gate/and2.png create mode 100644 mesecons_autotools_tmp/textures/formspec/gate/and3.png create mode 100644 mesecons_autotools_tmp/textures/formspec/gate/diode0.png create mode 100644 mesecons_autotools_tmp/textures/formspec/gate/diode1.png create mode 100644 mesecons_autotools_tmp/textures/formspec/gate/diode2.png create mode 100644 mesecons_autotools_tmp/textures/formspec/gate/diode3.png create mode 100644 mesecons_autotools_tmp/textures/formspec/gate/nand0.png create mode 100644 mesecons_autotools_tmp/textures/formspec/gate/nand1.png create mode 100644 mesecons_autotools_tmp/textures/formspec/gate/nand2.png create mode 100644 mesecons_autotools_tmp/textures/formspec/gate/nand3.png create mode 100644 mesecons_autotools_tmp/textures/formspec/gate/nor0.png create mode 100644 mesecons_autotools_tmp/textures/formspec/gate/nor1.png create mode 100644 mesecons_autotools_tmp/textures/formspec/gate/nor2.png create mode 100644 mesecons_autotools_tmp/textures/formspec/gate/nor3.png create mode 100644 mesecons_autotools_tmp/textures/formspec/gate/not0.png create mode 100644 mesecons_autotools_tmp/textures/formspec/gate/not1.png create mode 100644 mesecons_autotools_tmp/textures/formspec/gate/not2.png create mode 100644 mesecons_autotools_tmp/textures/formspec/gate/not3.png create mode 100644 mesecons_autotools_tmp/textures/formspec/gate/or0.png create mode 100644 mesecons_autotools_tmp/textures/formspec/gate/or1.png create mode 100644 mesecons_autotools_tmp/textures/formspec/gate/or2.png create mode 100644 mesecons_autotools_tmp/textures/formspec/gate/or3.png create mode 100644 mesecons_autotools_tmp/textures/formspec/gate/xor0.png create mode 100644 mesecons_autotools_tmp/textures/formspec/gate/xor1.png create mode 100644 mesecons_autotools_tmp/textures/formspec/gate/xor2.png create mode 100644 mesecons_autotools_tmp/textures/formspec/gate/xor3.png create mode 100644 mesecons_autotools_tmp/textures/formspec/gate3/and3/jeija_gate3_and3r0.png create mode 100644 mesecons_autotools_tmp/textures/formspec/gate3/and3/jeija_gate3_and3r1.png create mode 100644 mesecons_autotools_tmp/textures/formspec/gate3/and3/jeija_gate3_and3r2.png create mode 100644 mesecons_autotools_tmp/textures/formspec/gate3/and3/jeija_gate3_and3r3.png create mode 100644 mesecons_autotools_tmp/textures/formspec/gate3/nand3/jeija_gate3_nand3r0.png create mode 100644 mesecons_autotools_tmp/textures/formspec/gate3/nand3/jeija_gate3_nand3r1.png create mode 100644 mesecons_autotools_tmp/textures/formspec/gate3/nand3/jeija_gate3_nand3r2.png create mode 100644 mesecons_autotools_tmp/textures/formspec/gate3/nand3/jeija_gate3_nand3r3.png create mode 100644 mesecons_autotools_tmp/textures/formspec/gate3/nor3/jeija_gate3_nor3r0.png create mode 100644 mesecons_autotools_tmp/textures/formspec/gate3/nor3/jeija_gate3_nor3r1.png create mode 100644 mesecons_autotools_tmp/textures/formspec/gate3/nor3/jeija_gate3_nor3r2.png create mode 100644 mesecons_autotools_tmp/textures/formspec/gate3/nor3/jeija_gate3_nor3r3.png create mode 100644 mesecons_autotools_tmp/textures/formspec/gate3/nor3/jeija_gate_nor3.png create mode 100644 mesecons_autotools_tmp/textures/formspec/gate3/or3/jeija_gate3_or3r0.png create mode 100644 mesecons_autotools_tmp/textures/formspec/gate3/or3/jeija_gate3_or3r1.png create mode 100644 mesecons_autotools_tmp/textures/formspec/gate3/or3/jeija_gate3_or3r2.png create mode 100644 mesecons_autotools_tmp/textures/formspec/gate3/or3/jeija_gate3_or3r3.png create mode 100644 mesecons_autotools_tmp/textures/formspec/pink.png create mode 100644 mesecons_autotools_tmp/textures/formspec/regs/ff0.png create mode 100644 mesecons_autotools_tmp/textures/formspec/regs/ff1.png create mode 100644 mesecons_autotools_tmp/textures/formspec/regs/ff2.png create mode 100644 mesecons_autotools_tmp/textures/formspec/regs/ff3.png create mode 100644 mesecons_autotools_tmp/textures/formspec/regs/latch0.png create mode 100644 mesecons_autotools_tmp/textures/formspec/regs/latch1.png create mode 100644 mesecons_autotools_tmp/textures/formspec/regs/latch2.png create mode 100644 mesecons_autotools_tmp/textures/formspec/regs/latch3.png create mode 100644 mesecons_autotools_tmp/textures/formspec/unknown.png create mode 100644 mesecons_autotools_tmp/textures/formspec/wires/corner0.png create mode 100644 mesecons_autotools_tmp/textures/formspec/wires/corner1.png create mode 100644 mesecons_autotools_tmp/textures/formspec/wires/corner2.png create mode 100644 mesecons_autotools_tmp/textures/formspec/wires/corner3.png create mode 100644 mesecons_autotools_tmp/textures/formspec/wires/corssover.png create mode 100644 mesecons_autotools_tmp/textures/formspec/wires/tjunction0.png create mode 100644 mesecons_autotools_tmp/textures/formspec/wires/tjunction1.png create mode 100644 mesecons_autotools_tmp/textures/formspec/wires/tjunction2.png create mode 100644 mesecons_autotools_tmp/textures/formspec/wires/tjunction3.png create mode 100644 mesecons_autotools_tmp/textures/formspec/wires/wireh.png create mode 100644 mesecons_autotools_tmp/textures/formspec/wires/wirev.png create mode 100644 mesecons_autotools_tmp/textures/formspec/wires/xjunction.png create mode 100644 mesecons_autotools_tmp/textures/library.png create mode 100644 mesecons_autotools_tmp/textures/pos.png create mode 100644 mesecons_autotools_tmp/textures/selection/pos1.png create mode 100644 mesecons_autotools_tmp/textures/selection/pos2.png create mode 100644 mesecons_autotools_tmp/textures/test.png create mode 100644 mesecons_autotools_tmp/textures/tools/black.png create mode 100644 mesecons_autotools_tmp/textures/tools/blue.png create mode 100644 mesecons_autotools_tmp/textures/tools/orange.png create mode 100644 mesecons_autotools_tmp/textures/tools/orange_up.png create mode 100644 mesecons_autotools_tmp/textures/tools/red.png create mode 100644 mesecons_autotools_tmp/textures/tools/refresh.png create mode 100644 mesecons_autotools_tmp/textures/tools/white.png create mode 100644 mesecons_autotools_tmp/textures/tools/white_down (copy).png create mode 100644 mesecons_autotools_tmp/textures/tools/white_down.png create mode 100644 mesecons_autotools_tmp/textures/tools/white_up.png create mode 100644 mesecons_autotools_tmp/textures/tools/yellow.png create mode 100644 mesecons_autotools_tmp/textures/tools/yellow_updown.png create mode 100644 mesecons_autotools_tmp/textures/wall.png create mode 100644 mesecons_autotools_tmp/tools.lua create mode 100644 mesecons_autotools_tmp/tools/black/black.lua create mode 100644 mesecons_autotools_tmp/tools/blue/blue.lua create mode 100644 mesecons_autotools_tmp/tools/bundle.lua create mode 100644 mesecons_autotools_tmp/tools/direction.lua create mode 100644 mesecons_autotools_tmp/tools/orange/orange.lua create mode 100644 mesecons_autotools_tmp/tools/orange_up/orange_up.lua create mode 100644 mesecons_autotools_tmp/tools/red/red.lua create mode 100644 mesecons_autotools_tmp/tools/refresh/refresh.lua create mode 100644 mesecons_autotools_tmp/tools/selection.lua create mode 100644 mesecons_autotools_tmp/tools/test/test.lua create mode 100644 mesecons_autotools_tmp/tools/white/white.lua create mode 100644 mesecons_autotools_tmp/tools/white_down/white_down.lua create mode 100644 mesecons_autotools_tmp/tools/white_up/white_up.lua create mode 100644 mesecons_autotools_tmp/tools/wire.lua create mode 100644 mesecons_autotools_tmp/tools/yellow/yellow.lua create mode 100644 mesecons_autotools_tmp/tools/yellow_updown/yellow_updown.lua diff --git a/mesecons_autotools b/mesecons_autotools deleted file mode 160000 index 700e2e9..0000000 --- a/mesecons_autotools +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 700e2e90b5f3aef873721158c4dd09accf8341b7 diff --git a/mesecons_autotools_tmp/book/circuit.lua b/mesecons_autotools_tmp/book/circuit.lua new file mode 100644 index 0000000..3b8d958 --- /dev/null +++ b/mesecons_autotools_tmp/book/circuit.lua @@ -0,0 +1,405 @@ +dofile(minetest.get_modpath("mesecons_autotools").."/book/mx.lua"); +dofile(minetest.get_modpath("mesecons_autotools").."/book/m3.lua"); + +dofile(minetest.get_modpath("mesecons_autotools").."/book/formspec.lua"); +dofile(minetest.get_modpath("mesecons_autotools").."/book/image.lua"); + +dofile(minetest.get_modpath("mesecons_autotools").."/book/misc.lua"); +dofile(minetest.get_modpath("mesecons_autotools").."/book/stats.lua"); + +local esc = minetest.formspec_escape + + + + +local function show_dialog_new(user,direction) + + local pos1 = mesecons_autotools.get_pos(user,1) + local pos2 = mesecons_autotools.get_pos(user,2) + local sel = {pos1=pos1,pos2=pos2} + + if not mesecons_autotools.is_full_selection(user) then return end + + local nodes = selection_to_m3(pos1,pos2,direction) + local view = m3_to_mx(nodes) + + local db = { + title = "", + text = "", + nodes = nodes, + direction = direction, + view = view, + } + local formspec = fs_all(db) + + minetest.show_formspec(user, "mesecons_autotools:circuit_new", formspec) + +end + + +local function show_dialog_full(user,file) + local info = read_table_from_file(file) + local view = m3_to_mx(info.nodes) + + local db = { + title = info.title, + text = info.text, + nodes = info.nodes, + direction = info.direction, + view = view, + } + + local formspec = fs_all(db) + minetest.show_formspec(user, "mesecons_autotools:circuit_edit", formspec) +end + + + + +minetest.register_on_player_receive_fields(function(player, formname, fields) + if formname ~= "mesecons_autotools:circuit_new" then return end + + if (fields.save) or fields.key_enter_field == "title" then + + local user = player:get_player_name() + local file = generate_file_name(user) + local rad = player:get_look_horizontal() + local direction = radians_to_direction_looking_forward(rad) + + local stack = player:get_wielded_item() + local inv = player:get_inventory() + + local new_stack = nil + local info = {} + local data = {} + + if( stack:get_name() == "mesecons_autotools:circuit_empty" ) then + + new_stack = ItemStack("mesecons_autotools:circuit_full") + data.file = file + data.description = fields.title + new_stack:get_meta():from_table({ fields = data}) + + if inv:room_for_item("main", new_stack) then + inv:add_item("main", new_stack) + else + minetest.add_item(player:get_pos(), new_stack) + end + + -- standart info + info.title = fields.title + info.text = fields.text + + -- direction + info.direction = direction + + --info.direction = direction + + -- selection + + local pos1 = mesecons_autotools.get_pos(user,1) + local pos2 = mesecons_autotools.get_pos(user,2) + local nodes = selection_to_m3(pos1,pos2,direction) + + + info.nodes = nodes + save_table_to_file(file,info) + end + end + +end) + +minetest.register_on_player_receive_fields(function(player, formname, fields) + if formname ~= "mesecons_autotools:circuit_edit" then return end + + if (fields.save) or fields.key_enter_field == "title" then + local user = player:get_player_name() + local rad = player:get_look_horizontal() + local direction = radians_to_direction_looking_forward(rad) + + local stack = player:get_wielded_item() + local data = stack:get_meta():to_table().fields + --local inv = player:get_inventory() + + local info = {} + local file = data.file + + --[[ + info = read_table_from_file(file) + info.title = fields.title + info.text = fields.text + save_table_to_file(file,info) + ]]-- + + data.title = fields.title + data.text = fields.text + + + + data.description = fields.title + stack:get_meta():from_table({ fields = data}) + + + + + player:set_wielded_item(stack) + + end +end) + + +function rotate_direction_right(direction) + local d = {x=0,y=0,z=0} + if direction.z == 1 then + d.x = 1 + end + if direction.x == 1 then + d.z = -1 + end + if direction.z == -1 then + d.x = -1 + end + if direction.x == -1 then + d.z = 1 + end + return d +end + +function make_pos2(pos1,direction,sx,sy,sz) + + local right = rotate_direction_right(direction) + + local hv = vector.multiply(direction,sz-1) + local vv = vector.multiply(right,sx-1) + local uv = vector.multiply({x=0,y=1,z=0},sy-1) + local shift = vector.add(hv, vector.add(vv,uv)) + + local pos2 = vector.add(pos1, shift) + + return pos2 +end + +function get_all_corners_flat(sel) + local pos = {} + pos[1] = sel.pos1 + pos[2] = sel.pos2 + + local xmax = math.max(pos[1].x, pos[2].x) + local xmin = math.min(pos[1].x, pos[2].x) + + local ymax = math.max(pos[1].y, pos[2].y) + local ymin = math.min(pos[1].y, pos[2].y) + + local zmax = math.max(pos[1].z, pos[2].z) + local zmin = math.min(pos[1].z, pos[2].z) + + local pos00 = vector.new(xmin,ymin,zmin) + local pos11 = vector.new(xmax,ymin,zmax) + local pos10 = vector.new(xmax,ymin,zmin) + local pos01 = vector.new(xmin,ymin,zmax) + return {pos00=pos00,pos01=pos01,pos10=pos10,pos11=pos11} +end + + + +function get_corner00(sel,direction) + local crs = get_all_corners_flat(sel) + + + + if direction.z == 1 then + return crs.pos00 + end + if direction.x == 1 then + return crs.pos01 + end + if direction.z == -1 then + return crs.pos11 + end + if direction.x == -1 then + return crs.pos10 + end + + +end + +function add_vectors(a,b,c) + return vector.add(a,vector.add(b,c)) +end + + + + +function direction_to_number(direction) + if direction.z == 1 then return 0 end + if direction.x == 1 then return 1 end + if direction.z == -1 then return 2 end + if direction.x == - 1 then return 3 end +end + +function number_to_direction(nr) + if nr == 0 then return {x=0,y=0,z=1} end + if nr == 1 then return {x=1,y=0,z=0} end + if nr == 2 then return {x=0,y=0,z=-1} end + if nr == 3 then return {x=-1,y=0,z=0} end +end + + + + +function diff_directions(d1,d2) + local p1 = direction_to_number(d1) + local p2 = direction_to_number(d2) + + return number_to_direction( (p2-p1+4)%4 ) +end + +function flip(v) + if v == nil then return nil end + return vector.multiply(v,-1) +end + + +function paste_circuit(sel,file,direction) + if sel.pos1 == nil then return end + if sel.pos2 == nil then return end + + local info = read_table_from_file(file) + + --local rotate_direction = diff_directions(direction) + --local nodes = rotate_m3(info.nodes,direction) + local nodes = info.nodes + + + local sx = nodes.sx + local sy = nodes.sy + local sz = nodes.sz + + local right = rotate_direction_right(direction) + + local start_pos = get_corner00(sel,direction) + + for xi=1,sx do + for zi=1,sz do + for yi=1,sy do + local shift= add_vectors( + vector.multiply(right,xi-1), + vector.multiply(direction,zi-1), + vector.multiply({x=0,y=1,z=0},yi-1)) + + local pos = vector.add(start_pos, shift) + + if is_in_selection(sel,pos) then + + local node = m3_get(nodes,xi,yi,zi) + node = rotate_node(node,{x=0,y=0,z=1},direction) + --minetest.set_node(pos, node) + mesecons_autotools.set_node(pos,node,"paste_circuit") + end + + end + + end + end +end + + + +local function make_selection(user,file,direction,pos) + local info = read_table_from_file(file) + --local rotate_direction = diff_directions(info.direction,direction) + local rotate_direction= info.direction + + local nodes = info.nodes + local sx = nodes.sx + local sy = nodes.sy + local sz = nodes.sz + + + local pos2 = make_pos2(pos,direction,sx,sy,sz) + + -- Update + mesecons_autotools.set_pos(user,1,pos) + mesecons_autotools.set_pos(user,2,pos2) + mesecons_autotools.render(user) + mesecons_autotools.zero_stack_counter(user) + mesecons_autotools.zero_stack_direction(user) +end + +local function on_place_full_circuit(itemstack, player, pointed_thing) + local user = player:get_player_name() + local rad = player:get_look_horizontal() + local direction = radians_to_direction_looking_forward(rad) + local fields = itemstack:get_meta():to_table().fields + local file = fields.file + + if not mesecons_autotools.is_full_selection(user) then return nil end + local pos1 = mesecons_autotools.get_pos(user,1) + local pos2 = mesecons_autotools.get_pos(user,2) + local sel = {pos1=pos1,pos2=pos2} + paste_circuit(sel,file,direction) + +end + + +local function on_use_new_circuit(itemstack, player, pointed_thing) + local user = player:get_player_name() + local rad = player:get_look_horizontal() + local direction = radians_to_direction_looking_forward(rad) + + if not mesecons_autotools.is_full_selection(user) then + -- show dialog with info or chat info + return + end + show_dialog_new(user,direction) + + return nil +end + +local function on_use_full_circuit(itemstack, player, pointed_thing) + local user = player:get_player_name() + local rad = player:get_look_horizontal() + local direction = radians_to_direction_looking_forward(rad) + local fields = itemstack:get_meta():to_table().fields + local file = fields.file + + + if( pointed_thing.type == "node" ) then + make_selection(user,file,direction,pointed_thing.above) + else + show_dialog_full(user,file,player) + end + + return nil +end + +local function none(itemstack, player, pointed_thing) + return nil +end + + + +--minetest.register_craftitem("mesecons_autotools:circuit_empty", { +minetest.register_tool("mesecons_autotools:circuit_empty", { + description = "Circuit Empty", + inventory_image = "circuit_empty.png", + stack_max = 1, + + on_use = on_use_new_circuit, + on_place = none, + on_secondary_use = none, + + }) + +--minetest.register_craftitem("mesecons_autotools:circuit_full", { +minetest.register_tool("mesecons_autotools:circuit_full", { + description = "Circuit saved", + inventory_image = "circuit_full.png", + groups = {not_in_creative_inventory = 1}, + stack_max = 1, + on_use = on_use_full_circuit, + on_place = on_place_full_circuit, + --on_secondary_use = on_place_full_circuit, + + + }) diff --git a/mesecons_autotools_tmp/book/file.lua b/mesecons_autotools_tmp/book/file.lua new file mode 100644 index 0000000..7c4ac1c --- /dev/null +++ b/mesecons_autotools_tmp/book/file.lua @@ -0,0 +1,47 @@ +mesecons_autotools.rand = PcgRandom(2); + + +function generate_file_name(user) + local days = minetest.get_day_count() + local sec = minetest.get_gametime() + local rand = math.abs(mesecons_autotools.rand:next()) + local file = "circuit-"..user.."-"..sec.."-" .. rand + return file +end + +local path = minetest.get_worldpath() .. "/circuits/" + +function save_table_to_file(filename,tab) + minetest.mkdir(path) + local file, err = io.open(path .. filename, "wb") + if err ~= nil then + -- player_notify(name, "Could not save file to \"" .. filename .. "\"") + print ("mesecons_autotools: ERROR: file save error") + return + end + local result = minetest.serialize(tab) + + file:write(result) + file:flush() + file:close() +end + + +function read_table_from_file(filename) + minetest.mkdir(path) + local file, err = io.open(path .. filename, "rb") + if err ~= nil then + -- notify + print ("mesecons_autotools: ERROR: file read error") + return nil + end + + local value = file:read("*a") + file:close() + + local tab = minetest.deserialize(value) + return tab +end + + + diff --git a/mesecons_autotools_tmp/book/formspec.lua b/mesecons_autotools_tmp/book/formspec.lua new file mode 100644 index 0000000..64e0df1 --- /dev/null +++ b/mesecons_autotools_tmp/book/formspec.lua @@ -0,0 +1,88 @@ +local esc = minetest.formspec_escape + +function fs_all(db) + local info = fs_info(db.title,db.text,db) + local stats = fs_stats(db.nodes, db.direction) + local circuit = fs_circuit(db.view) + + local spec = info .. stats .. circuit + return spec +end + + + +function fs_info(title,text) + local formspec = + "formspec_version[3]".. + "size[32,25]".. + "field[0.5,1;8,1;title;".."Name"..";"..esc(title).."]".. + "label[15,0.7;Circuit Preview]".. + "textarea[0.5,3;8,15;text;" .. "Description:" .. ";" .. + esc(text) .. "]" .. + "button_exit[2.5,18;3,1;save;" .. "Save" .. "]" + + return formspec +end + + +function fs_circuit(mx_view) + local W = 20 + local H = 20 + local startx = 10 + local starty = 2 + + local imagew = W/(mx_view.w) + local imageh = H/(mx_view.h) + + if imageh > 1 then imageh = 1 end + if imagew > 1 then imagew = 1 end + + local minsize = math.min(imageh,imagew) + imageh = minsize + imagew = minsize + + local epsilon = 0.07 + + + local spec = "" + for ix=1,mx_view.w do + for iy=1,mx_view.h do + local n = mx_get(mx_view,ix,iy) + if n == nil then n = {name="air",param2=0} end + local img = node_to_image( n ) + + + spec = spec .. "image[".. + startx+ix*imagew .. "," .. + starty+(mx_view.h-iy+1)*imageh .. ";" .. + imagew +epsilon .. "," .. + imageh +epsilon .. ";" .. + img .. "]" + + end + end + + return spec + +end + +function fs_stats(nodes,direction) + local block, gate, wire = get_stats(nodes) + + + + + local sx = nodes.sx + local sy = nodes.sy + local sz = nodes.sz + + local stats = "size : " .. sx .. "x"..sy .. "x"..sz .. "(=".. sx*sy*sz .. ")\n" .. + "wires : " .. wire .. "\n" .. + "gates : " .. gate .. "\n" .. + "others : ".. block - wire - gate .. "\n" .. + "blocks: " .. block + local spec = "textarea[0.5,19;8,5;;;" .. esc(stats) .. "]" + return spec +end + + diff --git a/mesecons_autotools_tmp/book/image.lua b/mesecons_autotools_tmp/book/image.lua new file mode 100644 index 0000000..bded875 --- /dev/null +++ b/mesecons_autotools_tmp/book/image.lua @@ -0,0 +1,125 @@ + + +function node_to_image(node) + if node == nil then + return "empty.png" + end + + local name = node.name + local param2 = node.param2 or 0 + + + if( name == "air" ) then + return "empty.png" + end + + + if (name == "mesecons_insulated:insulated_off") or + (name == "mesecons_insulated:insulated_on" ) then + if( param2 % 2 == 0 ) then + return "wireh.png" + else + return "wirev.png" + end + end + + if (name == "mesecons_extrawires:crossover_off") or + (name == "mesecons_extrawires:crossover_on") or + (name == "mesecons_extrawires:crossover_01") or + (name == "mesecons_extrawires:crossover_10" ) then + return "corssover.png" + end + + if (name == "mesecons_extrawires:corner_off" ) or + (name == "mesecons_extrawires:corner_on" ) then + + return "corner"..param2 .. ".png" + end + + if (name == "mesecons_extrawires:tjunction_off" ) or + (name == "mesecons_extrawires:tjunction_on" ) then + + return "tjunction"..param2 .. ".png" + end + + if ( name == "mesecons_morewires:xjunction_off" ) or + ( name == "mesecons_morewires:xjunction_on" ) then + return "xjunction.png" + end + + + if( name == "mesecons_regs:flipflop_off" ) or ( name == "mesecons_regs:flipflop_on") then + return "ff"..param2..".png" + end + if( name == "mesecons_regs:latch_off" ) or ( name == "mesecons_regs:latch_on") then + return "latch"..param2..".png" + end + + + if( name == "mesecons_gates:and_off" ) or ( name =="mesecons_gates:and_on" )then + return "and".. param2 .. ".png" + end + if( name == "mesecons_gates:nand_off" ) or ( name =="mesecons_gates:nand_on" )then + return "nand".. param2 .. ".png" + end + + if( name == "mesecons_gates:nor_off" ) or ( name =="mesecons_gates:nor_on" )then + return "nor".. param2 .. ".png" + end + if( name == "mesecons_gates:or_off" ) or ( name =="mesecons_gates:or_on" )then + return "or".. param2 .. ".png" + end + if( name == "mesecons_gates:xor_off" ) or ( name =="mesecons_gates:xor_on" )then + return "xor".. param2 .. ".png" + end + + + if( name == "mesecons_gates:diode_off" ) or ( name =="mesecons_gates:diode_on" )then + return "diode".. param2 .. ".png" + end + + if( name == "mesecons_gates:not_off" ) or ( name =="mesecons_gates:not_on" )then + return "not".. param2 .. ".png" + end + + if( name == "mesecons_switch:mesecon_switch_off" ) or ( name =="mesecons_switch:mesecon_switch_on" )then + return "mesecons_switch_off.png" + end + + if ( name == "mesecons_lightstone:lightstone_white_off" ) or ( name == "mesecons_lightstone:lightstone_white_on" ) then + return "jeija_lightstone_white_on.png" + end + + if (name == "mesecons_walllever:wall_lever_off" ) or (name == "mesecons_walllever:wall_lever_on" ) then + + return "jeija_wall_lever_inv.png" + end + + if (name == "default:mese" ) or (name == "mesecons_extrawires:mese_powered" )then + return "default_mese_block.png" + end + + if (name == "mesecons_powerplant:power_plant") then + return "jeija_power_plant.png" + end + + + if (name == "mesecons_gates3:and3_off") or (name == "mesecons_gates3:and3_on" ) then + return "jeija_gate3_and3r"..param2..".png" + end + + + if (name == "mesecons_gates3:nand3_off") or (name == "mesecons_gates3:nand3_on" ) then + return "jeija_gate3_nand3r"..param2..".png" + end + + if (name == "mesecons_gates3:or3_off") or (name == "mesecons_gates3:or3_on" ) then + return "jeija_gate3_or3r"..param2..".png" + end + + if (name == "mesecons_gates3:nor3_off") or (name == "mesecons_gates3:nor3_on" ) then + return "jeija_gate3_nor3r"..param2..".png" + end + + return "unknown.png" +end diff --git a/mesecons_autotools_tmp/book/library.lua b/mesecons_autotools_tmp/book/library.lua new file mode 100644 index 0000000..507fdca --- /dev/null +++ b/mesecons_autotools_tmp/book/library.lua @@ -0,0 +1,220 @@ + + + +function render_circuit(circ,start_x,start_y) + circ.title = circ.title or "" + local spec = "button["..start_x..","..start_y..";10,1;".. "title_" .. circ.id .. ";"..circ.title.."]" + return spec,1 +end + + +function f_fold(id,x,y,folded) + local fold_sign + if folded == true then + fold_sign = "+" + else + fold_sign = "-" + end + + local spec = "button["..x..","..y..";1,1;".. "fold_" .. id ..";".. fold_sign.."]" + + return spec, 1, 0 +end + + +function render_lib(lib,start_x,start_y) + local xshift = 1 + local yshift = 1 + local total_yshift = 0 + local total_xshift = 0 + local id = lib.id + + lib.title = lib.title or "" + lib.folded = lib.folded or false + + + local spec = "" + + -- fold button + local ss,shx,shy = f_fold(id,start_x+total_xshift, start_y+total_yshift, lib.folded) + total_xshift = total_xshift+shx + total_yshift = total_yshift+shy + spec = spec .. ss + + + spec = spec .. + "button[".. start_x + total_xshift ..",".. start_y + total_yshift.. + ";10,1;".. "title_"..lib.id .. ";"..lib.title.."]" + total_xshift = start_x + 1 + total_yshift = total_yshift+1 + + + + + if lib.folded == false then + for _,v in ipairs(lib.list) do + if v.type == "library" then + local sp, ys = render_lib(v, start_x+total_xshift, start_y+total_yshift) + spec = spec .. sp + total_yshift = total_yshift + ys + elseif v.type == "circuit" then + local sp, ys = render_circuit(v,start_x+total_xshift, start_y+total_yshift) + spec = spec .. sp + total_yshift = total_yshift + ys + end + + end + end + + return spec, total_yshift + +end + +function traverse_list(list,action) + if list == nil then return end + + for _,v in ipairs(list) do + print("traverser.id =" .. v.id) + if v.type == "circuit" then + action(v) + elseif v.type == "library" then + action(v) + traverse_list(v.list,action) + end + + end + + +end + +function foreach_id(list,action) + if list == nil then return end + traverse_list(list, function(elem) + action(elem.id) + end) +end + +function get_elem_by_id(list,id) + local found + traverse_list(list,function(e) + if e.id == id then + found = e + end + + end) + return found +end + + + + + +minetest.register_on_player_receive_fields(function(player, formname, fields) + if formname ~= "mesecons_autotools:library_view" then return end + --print ("RECEIVE:=player="..dump(player) .. ", formname="..formname .. ".fiels="..dump(fields)) + local user = player:get_player_name() + local stack = player:get_wielded_item() + local data = stack:get_meta():to_table().fields + local lib = data.lib + + + print("lib="..dump(lib)) + if fields.quit then return end + --if lib == nil then return end + + -- print("DB2: " .. dump(data)) + -- print("FIELDS:"..dump(fields)) + + + + lib = lib or {} + -- print ("lib="..dump(lib)) + traverse_list(lib.list,function(elem) + print("#") + if fields["fold_".. elem.id] == true then + elem.folded = not elem.folded + end + end) + + -- print("libafger="..dump(lib)) + --[[ + if (fields.save) or fields.key_enter_field == "title" then + ]]-- + data.lib = lib + stack:get_meta():from_table({ fields = data}) + player:set_wielded_item(stack) + + local formspec = render_formspec(lib) + minetest.show_formspec(user, "mesecons_autotools:library_view", formspec) + +end) + +function render_formspec(lib) + local formspec = "formspec_version[3]".. + "size[32,25]" + + formspec = formspec .. render_lib(lib,1,1) + return formspec +end + + + lib = { + id = "l1", + title = "library bla bla ", + type = "library", + list = { + {id = "c1", type="circuit", title="somethign something"}, + {id = "c2", type="circuit", title="somethign something2"}, + {id = "l2", type="library", title="wooihoihoh/", folded = false, + list = { + {id = "c11", type="circuit", title="somethign something"}, + {id = "c21", type="circuit", title="somethign something2"}, + } + + }, + {id = "c111", type="circuit", title="circuit sak/32/d0"}, + } + } + + +function on_place_library(itemstack, player, pointed_thing) + local user = player:get_player_name() + local stack = player:get_wielded_item() + local data = stack:get_meta():to_table().fields + + + print("DU:"..dump(itemstack:get_meta():to_table())) + print("item stackc:" .. dump(itemstack)) + + if data.count == nil then data.count = 0 end + data.count = data.count + 1 + + + stack:get_meta():from_table({ fields = data}) + player:set_wielded_item(stack) + + + local formspec = render_formspec(lib) + -- print("formtspec="..formspec) + + + minetest.show_formspec(user, "mesecons_autotools:library_view", formspec) + +end + + + +minetest.register_tool("mesecons_autotools:library", { + description = "Library of Circuits", + inventory_image = "library.png", + stack_max = 1, + + + on_place = on_place_library, +--[[ + on_use = on_use_new_circuit, + + on_secondary_use = none, + ]]-- + }) + \ No newline at end of file diff --git a/mesecons_autotools_tmp/book/m3.lua b/mesecons_autotools_tmp/book/m3.lua new file mode 100644 index 0000000..cda6c53 --- /dev/null +++ b/mesecons_autotools_tmp/book/m3.lua @@ -0,0 +1,271 @@ + + +function m3_get(m,x,y,z) + if m == nil then return nil end + if m[x] == nil then return nil end + if m[x][y] == nil then return nil end + if m[x][y][z] == nil then return nil end + return m[x][y][z] +end + +function m3_set(m,x,y,z,value) + if m == nil then m = {} end + if m[x] == nil then m[x] = {} end + if m[x][y] == nil then m[x][y] = {} end + if m[x][y][z] == nil then m[x][y][z] = {} end + m[x][y][z] = value +end +--[[ +function m3_set_pos(m,pos1,pos2) + m.pos1 = pos1 + m.pos2 = pos2 +end +]]-- + +function m3_flip_xy(m) + local new_m = {} + for ix=1,m.sx do + for iz=1,m.sz do + for iy=1,m.sy do + m3_set(new_m,iz,iy,ix, m3_get(m,ix,iy,iz)) + end + end + end + --[[ + -- Rotate node + for ix=1,m.sx do + for iz=1,m.sz do + for iy=1,m.sy do + local node = m3_get(m,ix,iy,iz) + + local rotated_node = + rotate_node_to_direction(node,{x=1,y=0,z=0}) + m3_set(m,ix,iy,iz,rotated_node) + end + end + end + ]]-- + new_m.sx = m.sz + new_m.sz = m.sx + new_m.sy = m.sy + return new_m +end + +function m3_flip_x(m) + local new_m = {} + for ix=1,m.sx do + for iz=1,m.sz do + for iy=1,m.sy do + m3_set(new_m,ix,iy,m.sz-iz+1, m3_get(m,ix,iy,iz)) + end + end + end + + --[[ + for ix=1,m.sx do + for iz=1,m.sz do + for iy=1,m.sy do + local node = m3_get(m,ix,iy,iz) + + local rotated_node = + rotate_node_to_direction(node,{x=0,y=0,z=-1}) + m3_set(m,ix,iy,iz,rotated_node) + end + end + end + +]]-- + new_m.sx = m.sx + new_m.sz = m.sz + new_m.sy = m.sy + return new_m +end + + +function m3_rotate90(m) + return m3_flip_x( m3_flip_xy (m)) +end + +function m3_rotate180(m) + return m3_rotate90(m3_rotate90(m)) +end + +function m3_rotate270(m) + return m3_rotate90(m3_rotate90(m3_rotate90(m))) +end + +function rotate_m3(m,direction) + + if direction.x == 1 then + return m3_rotate270(m) + end + if direction.x == -1 then + return m3_rotate90(m) + end + if direction.z == 1 then + return m + end + if direction.z == -1 then + return m3_rotate180(m) + end + return m +end + + + +function m3_move_to_000(m) + local new_m = {} + + local pos1 = m.pos1 + local pos2 = m.pos2 + + local xmin = math.min(pos1.x,pos2.x) + local ymin = math.min(pos1.y,pos2.y) + local zmin = math.min(pos1.z,pos2.z) + + local xmax = math.max(pos1.x,pos2.x) + local ymax = math.max(pos1.y,pos2.y) + local zmax = math.max(pos1.z,pos2.z) + + + + local sx = xmax - xmin + 1 + local sy = ymax - ymin + 1 + local sz = zmax - zmin + 1 + + for x=1,sx,1 do + for y=1,sy,1 do + for z=1,sz,1 do + m3_set(new_m,x,y,z, + m3_get(m, x-1 + xmin, y-1 + ymin, z-1+zmin)) + end + end + end + + new_m.sx = sx + new_m.sy = sy + new_m.sz = sz + return new_m +end + + + + + +function selection_to_m3(pos1,pos2,direction) + local m = {} + iterate_selection(pos1,pos2,function(pos) + local node = minetest.get_node(pos) + m3_set(m,pos.x,pos.y,pos.z,node) + end) + m.pos1 = pos1 + m.pos2 = pos2 + + m = m3_move_to_000(m) + + m = rotate_m3(m,direction) + + for ix=1,m.sx do + for iz=1,m.sz do + for iy=m.sy,1,-1 do + local node = m3_get(m,ix,iy,iz) + local rotated_node = rotate_node_to_direction(node,direction) + m3_set(m,ix,iy,iz,rotated_node) + end + end + end + + + + return m +end + + +function m3_to_mx(m) + local mx={} + for ix=1,m.sx do + for iz=1,m.sz do + for iy=m.sy,1,-1 do + local pos = { x = ix, y=iy, z = iz } + local node = m3_get(m,ix,iy,iz) + + if node.name ~= "air" then + mx_set(mx,ix,iz,node) + break + end + + end + end + end + mx.w = m.sx + mx.h = m.sz + return mx +end + + +local function lmin(a,b) + if a == nil then + return b + else + if b == nil then + return a + else + return math.min(a,b) + end + end +end +local function lmax(a,b) + if a == nil then + return b + else + if b == nil then + return a + else + return math.max(a,b) + end + end +end + +function list_to_m3(list) + local m = {} + + local xmin,xmax,ymin,ymax,zmin,zmax + + for _,v in pairs(list) do + local pos = v.pos + local node = v.node + + m3_set(m,pos.x,pos.y,pos.z, node) + + xmin = lmin(xmin, pos.x) + ymin = lmin(ymin, pos.y) + zmin = lmin(zmin, pos.z) + + xmax = lmax(xmax, pos.x) + ymax = lmax(ymax, pos.y) + zmax = lmax(zmax, pos.z) + + + end + + m.pos1 = {x=xmin,y=ymin,z=zmin} + m.pos2 = {x=xmax,y=ymax,z=zmax} + return m +end + + +function iterate_m3(m,action) + for x=1,m.sx do + for y=1,m.sy do + for z=1,m.sz do + action(m3_get(m,x,y,z)) + end + end + end +end + + + + + + diff --git a/mesecons_autotools_tmp/book/misc.lua b/mesecons_autotools_tmp/book/misc.lua new file mode 100644 index 0000000..beeec48 --- /dev/null +++ b/mesecons_autotools_tmp/book/misc.lua @@ -0,0 +1,48 @@ +function rotate_node_to_direction(node,direction) + local add = 0 + if direction.x == 1 then add = 3 end + if direction.x == -1 then add = 1 end + if direction.z == 1 then add = 0 end + if direction.z == -1 then add = 2 end + + local param2 = node.param2 + + param2 = (param2+add)% 4 + + return { name = node.name , param2 = param2 } +end + +local function direction_to_number(direction) + if( direction.z == 1 ) then + return 1 + elseif( direction.x == 1 ) then + return 2 + elseif(direction.z == -1 )then + return 3 + else + return 4 + end + +end + + + +function rotate_node(node, saved_direction,direction) + + local values = + { + {0,1,2,3}, + {3,0,1,2}, + {2,3,0,1}, + {1,2,3,0} + } + + local rotate = + values[direction_to_number(saved_direction)][direction_to_number(direction)] + + local new_node = {} + new_node.name = node.name + new_node.param2 = (node.param2+rotate)%4 + + return new_node +end diff --git a/mesecons_autotools_tmp/book/mx.lua b/mesecons_autotools_tmp/book/mx.lua new file mode 100644 index 0000000..876d6e9 --- /dev/null +++ b/mesecons_autotools_tmp/book/mx.lua @@ -0,0 +1,109 @@ + + +function mx_get(m,x,y) + if m == nil then return nil end + if m[x] == nil then return nil end + if m[x][y] == nil then return nil end + return m[x][y] +end + +function mx_set(m,x,y,value) + if m == nil then m = {} end + if m[x] == nil then m[x] = {} end + if m[x][y] == nil then m[x][y] = {} end + m[x][y] = value +end + +function mx_flip_xy(m) + local new_m = {} + for i=1,m.w do + for k=1,m.h do + mx_set(new_m,k,i, mx_get(m,i,k)) + end + end + new_m.h = m.w + new_m.w = m.h + return new_m +end + +function mx_flip_y(m) + local new_m = {} + for i=1,m.w do + for k=1,m.h do + mx_set(new_m,m.w+1-i,k, mx_get(m,i,k)) + end + end + new_m.h = m.h + new_m.w = m.w + return new_m +end + +function mx_flip_x(m) + local new_m = {} + for i=1,m.w do + for k=1,m.h do + mx_set(new_m,i,m.h+1-k, mx_get(m,i,k)) + end + end + new_m.h = m.h + new_m.w = m.w + return new_m +end + + +function mx_rotate90(m) + return mx_flip_x( mx_flip_xy (m)) +end + +function mx_rotate180(m) + return mx_rotate90(mx_rotate90(m)) +end + +function mx_rotate270(m) + return mx_rotate90(mx_rotate90(mx_rotate90(m))) +end + +function rotate_mx(mx,direction) + + if direction.x == 1 then + return mx_rotate270(mx) + end + if direction.x == -1 then + return mx_rotate90(mx) + end + if direction.z == 1 then + return mx + end + if direction.z == -1 then + return mx_rotate180(mx) + end + return mx +end + + + +function move_mx_to_00(mx) + local new_mx = {} + + local xmax = mx.xmax + local xmin = mx.xmin + + local ymax = mx.ymax + local ymin = mx.ymin + + + local sx = xmax - xmin + 1 + local sy = ymax - ymin + 1 + + for x=1,sx,1 do + for y=1,sy,1 do + mx_set(new_mx,x,y, mx_get(mx, x-1 + xmin, y-1 + ymin)) + end + end + + new_mx.w = sx + new_mx.h = sy + return new_mx + +end + diff --git a/mesecons_autotools_tmp/book/stats.lua b/mesecons_autotools_tmp/book/stats.lua new file mode 100644 index 0000000..5196548 --- /dev/null +++ b/mesecons_autotools_tmp/book/stats.lua @@ -0,0 +1,71 @@ +function is_gate(node) + local gates = { + "mesecons_gates:and", + "mesecons_gates:or", + "mesecons_gates:xor", + "mesecons_gates:nand", + "mesecons_gates:nor", + "mesecons_gates:not", + "mesecons_gates:diode", + "mesecons_gates3:and3", + "mesecons_gates3:or3", + "mesecons_gates3:nor3", + "mesecons_gates3:nand3", + "mesecons_regs:flipflop", + "mesecons_regs:latch" + } + + local gates_with_states = {} + for _,v in ipairs(gates) do + table.insert(gates_with_states,v.."_on") + table.insert(gates_with_states,v.."_off") + end + + for _,v in ipairs(gates_with_states) do + if node.name == v then + return true + end + end + return false +end + +function is_wire_node(node) + local list = { + "mesecons_insulated:insulated_off", "mesecons_insulated:insulated_on", + "mesecons_extrawires:corner_off", "mesecons_extrawires:corner_on", + "mesecons_extrawires:tjunction_off", "mesecons_extrawires:tjunction_on", + "mesecons_extrawires:crossover_off", "mesecons_extrawires:crossover_on", + "mesecons_extrawires:crossover_10", "mesecons_extrawires:crossover_01", + "mesecons_morewires:xjunction_off", "mesecons_morewires:xjunction_on", + } + + local pos_name = node.name + for i,name in ipairs(list) do + if name == pos_name then + return true + end + end + return false +end + + + + +function get_stats(m) + local blocks,gates,wires = 0,0,0 + iterate_m3(m, function(node) + if is_wire_node(node) then + wires = wires + 1 + end + if is_gate(node) then + gates = gates+1 + end + if node.name ~= "air" then + blocks = blocks + 1 + end + + end) + + return blocks,gates,wires + +end diff --git a/mesecons_autotools_tmp/commands/all_commands.lua b/mesecons_autotools_tmp/commands/all_commands.lua new file mode 100644 index 0000000..e69de29 diff --git a/mesecons_autotools_tmp/debug.lua b/mesecons_autotools_tmp/debug.lua new file mode 100644 index 0000000..221f67c --- /dev/null +++ b/mesecons_autotools_tmp/debug.lua @@ -0,0 +1,16 @@ + +-- Debug + +function dump(o) + if type(o) == 'table' then + local s = '{ ' + for k,v in pairs(o) do + if type(k) ~= 'number' then k = '"'..k..'"' end + s = s .. '['..k..'] = ' .. dump(v) .. ',' + end + return s .. '} ' + else + return tostring(o) + end +end + diff --git a/mesecons_autotools_tmp/init.lua b/mesecons_autotools_tmp/init.lua new file mode 100644 index 0000000..a9bff3f --- /dev/null +++ b/mesecons_autotools_tmp/init.lua @@ -0,0 +1,353 @@ +dofile(minetest.get_modpath("mesecons_autotools").."/debug.lua"); + + +mesecons_autotools = {} +mesecons_autotools.users = {} +mesecons_autotools.actions = {} + + +-- Basic functions + +--[[ +mesecons_autotools = +{ + user_name = { + pos[1..2] = { x = number, y = number, z = number} + stack_direction = {x,y,z} + stack_counter = number + entities = + options = { + option1 = value1 + option2 = value2 + } + } + + user_name = ... +]]-- + +mesecons_autotools.set_pos = function(user,nr,pos) + if mesecons_autotools.users[user] == nil then + mesecons_autotools.users[user] = {} + end + if mesecons_autotools.users[user].pos == nil then + mesecons_autotools.users[user].pos = {} + end + if pos == nil then + mesecons_autotools.users[user].pos[nr] = nil + else + local p = vector.new(pos) + mesecons_autotools.users[user].pos[nr] = p + end +end + +mesecons_autotools.get_pos = function(user,nr) + if mesecons_autotools.users[user] == nil then + return nil + end + if mesecons_autotools.users[user].pos == nil then + return nil + end + if mesecons_autotools.users[user].pos[nr] == nil then + return nil + else + return vector.new(mesecons_autotools.users[user].pos[nr]) + end + + +end + +mesecons_autotools.get_stack_counter = function(user) + if mesecons_autotools.users[user] == nil then + mesecons_autotools.users[user] = {} + end + + if mesecons_autotools.users[user].stack_counter == nil then + mesecons_autotools.users[user].stack_counter = 0 + end + + return mesecons_autotools.users[user].stack_counter +end + +mesecons_autotools.inc_stack_counter = function(user) + -- get value and create structure if needed + local count = mesecons_autotools.get_stack_counter(user) + mesecons_autotools.users[user].stack_counter = count + 1 +end + +mesecons_autotools.dec_stack_counter = function(user) + -- get value and create structure if needed + local count = mesecons_autotools.get_stack_counter(user) + if count == 0 then return end + mesecons_autotools.users[user].stack_counter = count - 1 +end + +mesecons_autotools.zero_stack_counter = function(user) + -- get value and create structure if needed + local count = mesecons_autotools.get_stack_counter(user) + mesecons_autotools.users[user].stack_counter = 0 +end + +mesecons_autotools.zero_stack_direction = function(user) + if mesecons_autotools.users[user] == nil then + mesecons_autotools.users[user] = {} + end + mesecons_autotools.users[user].stack_direction = { x = 0, y = 0, z =0 } +end + +mesecons_autotools.set_stack_direction = function(user,direction) + -- get rid of nils + mesecons_autotools.zero_stack_direction(user) + mesecons_autotools.users[user].stack_direction = direction +end + +mesecons_autotools.get_stack_direction = function(user) + if mesecons_autotools.users[user] == nil then + mesecons_autotools.users[user] = {} + end + if mesecons_autotools.users[user].stack_direction == nil then + mesecons_autotools.users[user].stack_direction = { x = 0, y = 0, z =0 } + end + return mesecons_autotools.users[user].stack_direction +end + + +mesecons_autotools.set_option = function(user,field,value) + if mesecons_autotools.users[user] == nil then + mesecons_autotools.users[user] = {} + end + if mesecons_autotools.users[user].options == nil then + mesecons_autotools.users[user].options = {} + end + mesecons_autotools.users[user].options[field] = value +end + +mesecons_autotools.get_option = function(user,field) + if mesecons_autotools.users[user] == nil then + return nil + end + if mesecons_autotools.users[user].options == nil then + return nil + end + return mesecons_autotools.users[user].options[field] +end + +mesecons_autotools.is_full_selection = function(user) + if mesecons_autotools.get_pos(user,1) == nil then return false end + if mesecons_autotools.get_pos(user,2) == nil then return false end + return true +end + + +-- Actions/Callbacks ('user' clicked 'button' on 'pos' using 'tool') + +-- button = "left" | "right" +-- pos = { x = number, y = number, z = number } +-- tool = "black" | "red" | ... +-- type = "air" | "block" + +mesecons_autotools.execute_action = function(tool,button,type,user,pos,rad,under) +-- if user == nil then return end +-- if pos == nil then return end + if tool == nil then return end + if button == nil then return end + if type == nil then return end + if rad == nil then return end + -- under == nil can be nil + + if mesecons_autotools.actions[tool] == nil then return end + if mesecons_autotools.actions[tool][button] == nil then return end + if mesecons_autotools.actions[tool][button][type] == nil then return end + + + mesecons_autotools.actions[tool][button][type](user,pos,rad,under) + +end + + + +mesecons_autotools.register_action = function(tool,button,type,action) + if mesecons_autotools.actions[tool] == nil then + mesecons_autotools.actions[tool] = {} + end + if mesecons_autotools.actions[tool][button] == nil then + mesecons_autotools.actions[tool][button] = {} + end + if mesecons_autotools.actions[tool][button][type] == nil then + mesecons_autotools.actions[tool][button][type] = {} + end + mesecons_autotools.actions[tool][button][type] = action +end + + +function is_in_list(list,value) + + for _,v in ipairs(list) do + if v == value then return true end + + end + return false + +end + + + function ref_place(pos,node) + if minetest.get_item_group(node.name, "mesecon_needs_receiver") == 1 then + mesecon.receiver_place(pos) + end + end + + function ref_remove(pos,node) + if minetest.get_item_group(node.name, "mesecon_needs_receiver") == 1 then + mesecon.receiver_remove(pos) + end + end + + + + +mesecons_autotools.set_node = function(pos,node,why) + --[[ + if node.name == "air" then + local n = minetest.get_node(pos) + mesecon.on_dignode(pos,n) + ref_remove(pos,n) + minetest.set_node(pos,node) + -- ref_place ??? + else + local n = minetest.get_node(pos) + mesecon.on_dignode(pos,n) + ref_remove(pos,n) + minetest.set_node(pos,node) + mesecon.on_placenode(pos,node) + ref_place(pos,node) + end + + if true then return end + + local n = minetest.get_node(pos) + mesecon.on_dignode(pos,n) + ref_remove(pos,n) + + minetest.set_node(pos,node) + mesecon.on_placenode(pos,node) + ref_place(pos,node) + + + if true then return end + ]]-- + + + if why == nil then + minetest.set_node(pos,node) + else + + + if is_in_list({"start_node","middle_node"},why) then + minetest.set_node(pos,node) + mesecon.on_placenode(pos,node) + ref_place(pos,node) + end + + + + + + if is_in_list({"delete"},why) then + local n = minetest.get_node(pos) + mesecon.on_dignode(pos,n) + ref_remove(pos,n) + + minetest.set_node(pos,node) + mesecon.on_placenode(pos,node) + ref_place(pos,node) + + end + + + if is_in_list({"delete_crossover","delete_end"},why) then -- + local n = minetest.get_node(pos) + mesecon.on_dignode(pos,n) + ref_remove(pos,n) + + minetest.set_node(pos,node) + mesecon.on_placenode(pos,node) + ref_place(pos,node) + + + + end + + if is_in_list({"paste_circuit"},why) then + minetest.set_node(pos,node) + end + + if is_in_list({"add_wire"},why) then + minetest.set_node(pos,node) + end + + if is_in_list({"red"},why) then + local n = minetest.get_node(pos) + mesecon.on_dignode(pos,n) + ref_remove(pos,n) + + minetest.set_node(pos,node) + mesecon.on_placenode(pos,node) + ref_place(pos,node) + + end + + if is_in_list({"put_tail_wires"},why) then + minetest.set_node(pos,node) + end + + if is_in_list({"copy"},why) then + minetest.set_node(pos,node) + end + + if is_in_list({"paste_from_buffor"},why) then + minetest.set_node(pos,node) + end + + --[[ + if is_in_list({"delete_crossover"},why) then + minetest.set_node(pos,node) + mesecon.on_placenode(pos,node) + ref_remove(pos,node) + end + + if is_in_list({"delete_end"},why) then + minetest.set_node(pos,{name="air"}) + mesecon.on_dignode(pos,node) + ref_remove(pos,node) + --mesecon.on_dignode(pos,{name="air"}) + + --mesecon.receiver_remove(pos,node) + --minetest.set_node(pos,node) + --mesecon.on_placenode(pos,node) + end + ]]-- + + end + +end + + +-- Register Tools + +dofile(minetest.get_modpath("mesecons_autotools").."/tools.lua"); + + +-- Register Rendering + +dofile(minetest.get_modpath("mesecons_autotools").."/render.lua"); + +-- Regiser Circuit + +dofile(minetest.get_modpath("mesecons_autotools").."/book/circuit.lua"); +--dofile(minetest.get_modpath("mesecons_autotools").."/book/library.lua"); +dofile(minetest.get_modpath("mesecons_autotools").."/book/file.lua"); + +-- Register chatcommands + +dofile(minetest.get_modpath("mesecons_autotools").."/commands/all_commands.lua"); + diff --git a/mesecons_autotools_tmp/render.lua b/mesecons_autotools_tmp/render.lua new file mode 100644 index 0000000..56026dd --- /dev/null +++ b/mesecons_autotools_tmp/render.lua @@ -0,0 +1,156 @@ +-- Remove entities +local function clear_selection(user) + if mesecons_autotools.users[user] == nil then + mesecons_autotools.users[user] = {} + end + if mesecons_autotools.users[user].entities == nil then + mesecons_autotools.users[user].entities = {} + end + + + + for _,v in pairs(mesecons_autotools.users[user].entities) do + v:remove() + end + mesecons_autotools.users[user].entities = {} + + +end + + +-- Register entities +minetest.register_entity(":mesecons_autotools:pos1", { + initial_properties = { + visual = "cube", + visual_size = {x=1.11, y=1.11, }, + textures = {"pos1.png", "pos1.png", + "pos1.png", "pos1.png", + "pos1.png", "pos1.png"}, + collisionbox = {-0.55, -0.55, -0.55, 0.55, 0.55, 0.55}, + physical = false, + static_save = false, + }, + on_activate = function(self, staticdata, dtime_s) + end, + + on_punch = function(self,hitter) + end, + on_blast = function(self, damage) + return false, false, {} -- don't damage or knockback + end, +}) +minetest.register_entity(":mesecons_autotools:pos2", { + initial_properties = { + visual = "cube", + visual_size = {x=1.1, y=1.1}, + textures = {"pos2.png", "pos2.png", + "pos2.png", "pos2.png", + "pos2.png", "pos2.png"}, + collisionbox = {-0.55, -0.55, -0.55, 0.55, 0.55, 0.55}, + physical = false, + static_save = false, + }, + on_activate = function(self, staticdata, dtime_s) + end, + + on_punch = function(self,hitter) + end, + + on_blast = function(self, damage) + return false, false, {} -- don't damage or knockback + end, +}) +minetest.register_entity(":mesecons_autotools:wall", { + initial_properties = { + visual = "upright_sprite", + textures = {"wall.png"}, + visual_size = {x=10, y=10}, + physical = false, + static_save = false, + }, + on_activate = function(self, staticdata, dtime_s) + end, + + on_punch = function(self,hitter) + end, + + on_blast = function(self, damage) + return false, false, {} -- don't damage or knockback + end, +}) + +minetest.register_entity(":mesecons_autotools:pos", { + initial_properties = { + visual = "cube", + visual_size = {x=1.1, y=1.1}, + textures = {"pos.png", "pos.png", + "pos.png", "pos.png", + "pos.png", "pos.png"}, + collisionbox = {-0.55, -0.55, -0.55, 0.55, 0.55, 0.55}, + physical = false, + static_save = false, + }, + on_activate = function(self, staticdata, dtime_s) + end, + + on_punch = function(self,hitter) + end, + + on_blast = function(self, damage) + return false, false, {} -- don't damage or knockback + end, +}) + +--[[ not used: TODO remove +local function generate_corners(user) + local pos = {} + pos[1] = mesecons_autotools.get_pos(user,1) + pos[2] = mesecons_autotools.get_pos(user,2) + + if pos[1] == nil then return end + if pos[2] == nil then return end + + + local list = {} + for xi = 1,2 do + for yi = 1,2 do + for zi = 1,2 do + local p = { x = pos[xi].x , y = pos[yi].y , z = pos[zi].z } + if not vector.equals(p,pos[1]) then + table.insert(list,p) + end + end + end + end + return list +end +]]-- + + +local function show_selection(user) + local pos1 = mesecons_autotools.get_pos(user,1) + local pos2 = mesecons_autotools.get_pos(user,2) + + if pos1 ~= nil then + local e1 = minetest.add_entity(pos1,"mesecons_autotools:pos1") + table.insert(mesecons_autotools.users[user].entities, e1) + end + + if pos2 ~= nil then + local e2 = minetest.add_entity(pos2,"mesecons_autotools:pos2") + table.insert(mesecons_autotools.users[user].entities, e2) + end + + + +end + + + +mesecons_autotools.render = function(user) + clear_selection(user) + show_selection(user) +end + + + diff --git a/mesecons_autotools_tmp/textures/circuit_empty.png b/mesecons_autotools_tmp/textures/circuit_empty.png new file mode 100644 index 0000000000000000000000000000000000000000..1623d00bc851993132f5e8cab6218fb295d51f36 GIT binary patch literal 257 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPFv5AX?b1=7079a{MdM5cXInDPxm z&RH~N;fh%+*DqSXb;X$r$L~J4rSo*n51>-Uk|4ie28U-i(m=VFR~i5S literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/circuit_full.png b/mesecons_autotools_tmp/textures/circuit_full.png new file mode 100644 index 0000000000000000000000000000000000000000..dd737597993e95d206516e492a0fa88dd5bc3a9e GIT binary patch literal 315 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbL!Q-Dv1D?$k2refsp73&$^BymplOUHL4Lsu4$p3+fjCLt?k)@+tg;?J4rhT!WHAE+w=f7ZGR&GI0Tg5} z@$_|Nf5I-vDPy@-{UZxdsL0dBF+}2W>$!t`EebrYfv1|oRyWBW`~UxHqhPOI&)u&} zGS?OJ3p?$2ySO7Jb4ub40psgy1xo||=1gS?-rv9al{uI0&mZc=s?U1Z6ikxB?!~vH z^ad@k!WFYtu3xl%>xwfMj^BN7%X&x4KA?KWk|4ie28U-i(mCWzjJ$HAP zJF_m(5!frJwt!7|MGMyo|D=QjAtp`^2G?CJWvk5_uavD1IwQdFGVIpgB&8z>3q_d% ev_&L0Ffm;CCMQw7M1c)xD1)b~pUXO@geCyGHcpuU literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/formspec/empty.png b/mesecons_autotools_tmp/textures/formspec/empty.png new file mode 100644 index 0000000000000000000000000000000000000000..f0d00bc9df61d6ac7e5cdf2eed480642f0012fd4 GIT binary patch literal 123 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|oCO|{#S9GG!XV7ZFl&wkP>{XE z)7O>#3A+%lyzKg|jw(PQDNh&25RLQ6clM(P@ne5Z1 Q16472y85}Sb4q9e0E_M%i~s-t literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/formspec/gate/and0.png b/mesecons_autotools_tmp/textures/formspec/gate/and0.png new file mode 100644 index 0000000000000000000000000000000000000000..fa450f72cdc6478c017798beeff4017fb6a75b4f GIT binary patch literal 178 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!D3?x-;bCrM;TYyi9E0F&G|NqjP^X~##j3q&S z!3+-1Zlr-YN#5=*3>~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6TE+ojxDNtuR z4Jf4Q>Eal|aXmR9CxJofw>?i+y~LM)1~0BRT&y!-+WhrEkOOPNR0c;w-ihn>A6pO9 Oz~JfX=d#Wzp$P!L9xna> literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/formspec/gate/and1.png b/mesecons_autotools_tmp/textures/formspec/gate/and1.png new file mode 100644 index 0000000000000000000000000000000000000000..2f1139d49cc33abc82308c3831b56712015d2cb9 GIT binary patch literal 177 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!D3?x-;bCrM;TYyi9E0F&G|NqjP^X~##j3q&S z!3+-1Zlr-YN#5=*3>~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6TE+oh*{;H7U zD^N(q)5S4_<9c!e1M_ct9xff8U-1iG{H|`B|5@@)mcyfhBR3da80_Ejy~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6TE+oh*|72Ce zaiEZzr;B3<$MxidoCF4?-}XG;ba}q1@|49pywI0$yy4(D;fg%l1}}y>bpgS%hq)dA Pbuf6k`njxgN@xNA?rtrg literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/formspec/gate/and3.png b/mesecons_autotools_tmp/textures/formspec/gate/and3.png new file mode 100644 index 0000000000000000000000000000000000000000..4c7cadd3293b0b833296ac17117fa484dea7a176 GIT binary patch literal 176 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!D3?x-;bCrM;TYyi9E0F&G|NqjP^X~##j3q&S z!3+-1Zlr-YN#5=*3>~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6TE+ojR5hJd8 z0w|>H>Eal|aXmR9CxJofw>?Kn_~8%5c89-z=lK=Cz@w2>g^!J)t(fn~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6TE+ojII3e}1 zB2Y-f)5S4_<9c!e1M_cto@dn(J>Lyxyh}8=efYy&xt22rViqU_aIIkAVbHMW$?drL R;R8?)gQu&X%Q~loCIF3aF%JL$ literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/formspec/gate/diode1.png b/mesecons_autotools_tmp/textures/formspec/gate/diode1.png new file mode 100644 index 0000000000000000000000000000000000000000..eed69eb53443e556c48a85045564bd62118400de GIT binary patch literal 179 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!D3?x-;bCrM;TYyi9E0F&G|NqjP^X~##j3q&S z!3+-1Zlr-YN#5=*3>~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6TE+ojIU9f@6 z9w?;d>Eal|aXmR9CxJofx4puW1BVj+wH^G$*ZfwFZMT$wxDuaZ!c+!pW!^cqXEU>a PIv6}%{an^LB{Ts5&8jU7 literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/formspec/gate/diode2.png b/mesecons_autotools_tmp/textures/formspec/gate/diode2.png new file mode 100644 index 0000000000000000000000000000000000000000..6c052c360e15705508b6d1d63873cba5bc3fd8e0 GIT binary patch literal 181 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!D3?x-;bCrM;TYyi9E0F&G|NqjP^X~##j3q&S z!3+-1Zlr-YN#5=*3>~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6TE+oid@rBR( zAy7!e)5S4_<9c!e1M_cto^AOOIp+;-tV`T*Hu1-2xt0bVf$uyXTq_uO7(6HQUVUFz Ra1N-4!PC{xWt~$(699Q1FgySN literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/formspec/gate/diode3.png b/mesecons_autotools_tmp/textures/formspec/gate/diode3.png new file mode 100644 index 0000000000000000000000000000000000000000..69b3639f893306e81f99343ce9f0dff33cf97403 GIT binary patch literal 178 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!D3?x-;bCrM;TYyi9E0F&G|NqjP^X~##j3q&S z!3+-1Zlr-YN#5=*3>~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6TE+ojwrc;v6 z4HQ!Kba4#fxSpJllfa<#+n!^|fkO%5hZA~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6TE+oj!@$;8P zA5ci$)5S4_<9c!e1M_ctp00X{FaHc)TsL^}+u%h$qq4j}IKK{S2m>1f+b?eM>EgkG PKrIZOu6{1-oD!M~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6TE+oh;ICo-$ zA5ci$)5S4_<9c!e1M_ct9xff8U-1i0{NZhWD#Ny0itVmXagey_XO^wHH>UC QfLa(lUHx3vIVCg!0JG*Q*8l(j literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/formspec/gate/nand2.png b/mesecons_autotools_tmp/textures/formspec/gate/nand2.png new file mode 100644 index 0000000000000000000000000000000000000000..da3a2802fc3b7db0fcfa4f99ba974da70e4dd76e GIT binary patch literal 180 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!D3?x-;bCrM;TYyi9E0F&G|NqjP^X~##j3q&S z!3+-1Zlr-YN#5=*3>~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6TE+oh;UF(t= z02EU9ba4#fxSpKA!2H{u=bJ9iH&vdpc!{2U1}~ZfCon!?Vs#9vSKwk)S;-T+Ke+KI PPz!^ntDnm{r-UW|t~o2* literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/formspec/gate/nand3.png b/mesecons_autotools_tmp/textures/formspec/gate/nand3.png new file mode 100644 index 0000000000000000000000000000000000000000..cfc7f3e6c8eb8ca572656b4ad995ea5d4bf62267 GIT binary patch literal 179 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!D3?x-;bCrM;TYyi9E0F&G|NqjP^X~##j3q&S z!3+-1Zlr-YN#5=*3>~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6TE+ojUx<|F- zH&95;)5S4_<9c!e1M_cto-$LOZPgAOCpOGEoba#B@jthS=7t8521W*f``k${rwW7v Pbuf6k`njxgN@xNA<)~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6TE+ojKmX*7? z4Jf4U>Eal|aXmSKf%&&RPglLfnSTZ|t{X)BHi*b)RF)UG&ZEN`!obGBw}?Ak*SX~q PPz!^ntDnm{r-UW|)>JFB literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/formspec/gate/nor1.png b/mesecons_autotools_tmp/textures/formspec/gate/nor1.png new file mode 100644 index 0000000000000000000000000000000000000000..86aec63ee562190ee46c0e577b2abce478a8e3f1 GIT binary patch literal 183 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!D3?x-;bCrM;TYyi9E0F&G|NqjP^X~##j3q&S z!3+-1Zlr-YN#5=*3>~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6TE+oifRIok$ zH&95+)5S4_<9c!e1M_cto?r12Q~C{F%xI8!mM@|6+~CGlgB$M{6&09QFz_%4T;om( T(GYwB)WzWG>gTe~DWM4f&#f~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6TE+oifRhRSr zBv44*)5S4_<9c!e1M_cto^QH5-z<5`@+ErS8N6r`oWS^miPbTvUV)2I;wAUhE8X^N PKrIZOu6{1-oD!M<5uq)2 literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/formspec/gate/nor3.png b/mesecons_autotools_tmp/textures/formspec/gate/nor3.png new file mode 100644 index 0000000000000000000000000000000000000000..c7de74376b0094c79d00f8574b032ffb48b3be57 GIT binary patch literal 183 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!D3?x-;bCrM;TYyi9E0F&G|NqjP^X~##j3q&S z!3+-1Zlr-YN#5=*3>~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6TE+ojyvP|r- zGEhj%)5S4_<9c!e1M_cto-$LOZPgAOCpOGEoba#B@jrKSA7}F?K>_9!3_J|nGr5z5 TOs8Z5buoCl`njxgN@xNAWH2pl literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/formspec/gate/not0.png b/mesecons_autotools_tmp/textures/formspec/gate/not0.png new file mode 100644 index 0000000000000000000000000000000000000000..9ba61fec1446e8c1227ccd88135e1abc2b47d5e8 GIT binary patch literal 181 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!D3?x-;bCrM;TYyi9E0F&G|NqjP^X~##j3q&S z!3+-1Zlr-YN#5=*3>~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6TE+oh&`Ofx_ zB~VDi)5S4_<9c!e1M_cto@ezEJ^u}6{7W>LefWc|d`kmQ@CJndt`!VC41W21y!$I= R-v{bp@O1TaS?83{1ORCuFCYK_ literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/formspec/gate/not1.png b/mesecons_autotools_tmp/textures/formspec/gate/not1.png new file mode 100644 index 0000000000000000000000000000000000000000..7a259562a2caa9cc9afb3ec6d13d638adb4085c5 GIT binary patch literal 179 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!D3?x-;bCrM;TYyi9E0F&G|NqjP^X~##j3q&S z!3+-1Zlr-YN#5=*3>~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6TE+ojOc+B2q zIZ#N=)5S4_<9c#JP6C6{Z+nF$2M#6tYdiRhulcPU+iocV&P0clgIbIZ@x1GJRV*EV PIv6}%{an^LB{Ts5??^2y literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/formspec/gate/not2.png b/mesecons_autotools_tmp/textures/formspec/gate/not2.png new file mode 100644 index 0000000000000000000000000000000000000000..e2ae188d08224a2453b88cd4b1fe0c2477ec0d58 GIT binary patch literal 181 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!D3?x-;bCrM;TYyi9E0F&G|NqjP^X~##j3q&S z!3+-1Zlr-YN#5=*3>~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6TE+ojOt{?Mo z5>QCP)5S4_<9c!e1M_cto^SaQZ_XRsSf9AzOyZAkaxD!!3gRk1*p@KxFnFBjJ?muJ R!UWXA;OXk;vd$@?2>^3@FF61J literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/formspec/gate/not3.png b/mesecons_autotools_tmp/textures/formspec/gate/not3.png new file mode 100644 index 0000000000000000000000000000000000000000..6f65e955baea9c0438f7a8a6edc07dd5004ec521 GIT binary patch literal 178 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!D3?x-;bCrM;TYyi9E0F&G|NqjP^X~##j3q&S z!3+-1Zlr-YN#5=*3>~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6TE+ojO7uFDI z1{6~Dba4#fxSpJllfa<#+g>3h{BXi<_7(-6*Va7G@+Cwf7HmqG%HWa1yY3F_#uA_g N22WQ%mvv4FO#pYIEP4O{ literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/formspec/gate/or0.png b/mesecons_autotools_tmp/textures/formspec/gate/or0.png new file mode 100644 index 0000000000000000000000000000000000000000..87cd82797532ec226d9ec54a4decfbdb0874ed3a GIT binary patch literal 182 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!D3?x-;bCrM;TYyi9E0F&G|NqjP^X~##j3q&S z!3+-1Zlr-YN#5=*3>~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6TE+i;mHgWC0 z{Xij2PZ!4!j_b(@ISC9(zwLS0OnI(VORRZsaD(Y$wZSgtM@+1ZK@O}5QyIcp`6?F} SB+db9V(@hJb6Mw<&;$T|^DZX< literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/formspec/gate/or1.png b/mesecons_autotools_tmp/textures/formspec/gate/or1.png new file mode 100644 index 0000000000000000000000000000000000000000..c008c925e0284834c8ede3f29afd0a15dca3e96c GIT binary patch literal 182 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!D3?x-;bCrM;TYyi9E0F&G|NqjP^X~##j3q&S z!3+-1Zlr-YN#5=*3>~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6TE+i<(XuzHI z5h$eT>Eal|aXmSKf%&(+!jk{3jz2k?`#2B(ey@=7ukBzFUvn&P$h3`&9Spu&eAg|q SkMIIDF?hQAxvX~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6TE+i<(wfyGh zN}!OYr;B3<$MxidoCF4?-}XFZHay$PCDt@%@E~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6TE+i-@v}LQd zK2S*0)5S4_<9c#JP6C6{Z+nH5@WTm~?Fawx9{&AaVM+3#1vM>>|G7iNco<67@m-e` Slkx;=V(@hJb6Mw<&;$ULl`o_K literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/formspec/gate/xor0.png b/mesecons_autotools_tmp/textures/formspec/gate/xor0.png new file mode 100644 index 0000000000000000000000000000000000000000..3f783e9891f5fae62a4b454914a2a619413fa300 GIT binary patch literal 184 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!D3?x-;bCrM;TYyi9E0F&G|NqjP^X~##j3q&S z!3+-1Zlr-YN#5=*3>~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6TE+i;u{(s~D z44{y9T15X!`$#?6zu TCoB0HP#c4%tDnm{r-UW|xEd{i literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/formspec/gate/xor1.png b/mesecons_autotools_tmp/textures/formspec/gate/xor1.png new file mode 100644 index 0000000000000000000000000000000000000000..224e98b1dc257c32506f6b02567a299f842b9e55 GIT binary patch literal 186 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!D3?x-;bCrM;TYyi9E0F&G|NqjP^X~##j3q&S z!3+-1Zlr-YN#5=*3>~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6TE+i<#)TE!$ z0Tj~pba4#fxSpKA!2H{u=U2Q$&v}CzHyR}R`;GS)vKyYcZxC@Val>jx&4e5VB?j|Q W-W&YIzu15p89ZJ6T-G@yGywo8LNEdV literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/formspec/gate/xor2.png b/mesecons_autotools_tmp/textures/formspec/gate/xor2.png new file mode 100644 index 0000000000000000000000000000000000000000..b3e36c4444d9c0a8dd479bd3b4a69675de5500c5 GIT binary patch literal 183 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!D3?x-;bCrM;TYyi9E0F&G|NqjP^X~##j3q&S z!3+-1Zlr-YN#5=*3>~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6TE+i<#k@Tx^ z8c;~f)5S4_<9c#JP6C6{Z+jjyHJ)phJkKn7(#j?7H408(e8R-q805g3FqOeoiFdh# S-^o`%T@0SCelF{r5}E*24lNJ> literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/formspec/gate/xor3.png b/mesecons_autotools_tmp/textures/formspec/gate/xor3.png new file mode 100644 index 0000000000000000000000000000000000000000..44059d0344fffde5c145bd777f1d6771445a28e3 GIT binary patch literal 187 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!D3?x-;bCrM;TYyi9E0F&G|NqjP^X~##j3q&S z!3+-1Zlr-YN#5=*3>~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6TE+i<#*F95Z zF;Ga))5S4_<9c#JP6C6{Z+o6HQ=VzX5@+rkyr@sCNIv)BhebzX^5KLUwj&H$49pDC XQ+RJ2+|s`QsFT6d)z4*}Q$iB}iv%)Y literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/formspec/gate3/and3/jeija_gate3_and3r0.png b/mesecons_autotools_tmp/textures/formspec/gate3/and3/jeija_gate3_and3r0.png new file mode 100644 index 0000000000000000000000000000000000000000..d5027737b5c911e61c8c2e09862fe3c76056d0a5 GIT binary patch literal 183 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!D3?x-;bCrM;TYyi9E0F&G|NqjP^X~##j3q&S z!3+-1Zlr-YN#5=*3>~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6T$;8gBV10HQ zNS&6ai(?4K_2dK~$Vu4n|L}qz?T+vHo9lQvp1x;PmdKI;Vst0Inl03;+NC literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/formspec/gate3/and3/jeija_gate3_and3r1.png b/mesecons_autotools_tmp/textures/formspec/gate3/and3/jeija_gate3_and3r1.png new file mode 100644 index 0000000000000000000000000000000000000000..617150e39bd12f9ab7c5a4c8474745cbebe38855 GIT binary patch literal 179 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!D3?x-;bCrM;TYyi9E0F&G|NqjP^X~##j3q&S z!3+-1Zlr-YN#5=*3>~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6T$;8gfsy6v( zCs0Vu)5S4_<9c!e5ac9m_@PnF-ZUb literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/formspec/gate3/and3/jeija_gate3_and3r2.png b/mesecons_autotools_tmp/textures/formspec/gate3/and3/jeija_gate3_and3r2.png new file mode 100644 index 0000000000000000000000000000000000000000..665e1218cd994be3c290bd6e7f468422dd021f03 GIT binary patch literal 183 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!D3?x-;bCrM;TYyi9E0F&G|NqjP^X~##j3q&S z!3+-1Zlr-YN#5=*3>~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6T$;8ep;W~9? z08mKF)5S4_<9c!e5ac9m_~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6T$;8g9k?b?` z4^T+O)5S4_<9c!e1M_ctj+F4j0hav>|HwA~6W0hzVC*zDV-RIxaC*m^bF3z=5vZQQ M)78&qol`;+0A9%}wEzGB literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/formspec/gate3/nand3/jeija_gate3_nand3r0.png b/mesecons_autotools_tmp/textures/formspec/gate3/nand3/jeija_gate3_nand3r0.png new file mode 100644 index 0000000000000000000000000000000000000000..30e4c8a0bd2dcfb979ea25b37afc0461b120bdcb GIT binary patch literal 187 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!D3?x-;bCrM;TYyi9E0F&G|NqjP^X~##j3q&S z!3+-1Zlr-YN#5=*3>~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6T$;2fstGK^9 z8Yraa>Eal|aXmQ!2yzlO{6D~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6T$;2fs5YNZ{ z3@D`S>Eal|aXmQ!2yzlO{6DfP6c+z#^ SkNyK{WAJqKb6Mw<&;$T84l)7& literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/formspec/gate3/nand3/jeija_gate3_nand3r2.png b/mesecons_autotools_tmp/textures/formspec/gate3/nand3/jeija_gate3_nand3r2.png new file mode 100644 index 0000000000000000000000000000000000000000..3ac0fa6574d468ea9e5a6c275b760acdb61a90f5 GIT binary patch literal 187 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!D3?x-;bCrM;TYyi9E0F&G|NqjP^X~##j3q&S z!3+-1Zlr-YN#5=*3>~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6T$;2fss-N;X z6DXwT>Eal|aXmQ!2yzlO{6Cy<|4>5wp@i?P2VZbEzcUwLGHQrfpy2U}-$Rm_nZafU VZ}fft?(;yM44$rjF6*2UngHJ@GZ6p) literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/formspec/gate3/nand3/jeija_gate3_nand3r3.png b/mesecons_autotools_tmp/textures/formspec/gate3/nand3/jeija_gate3_nand3r3.png new file mode 100644 index 0000000000000000000000000000000000000000..77951be0058b3778abe655648d00c58f35cb0737 GIT binary patch literal 182 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!D3?x-;bCrM;TYyi9E0F&G|NqjP^X~##j3q&S z!3+-1Zlr-YN#5=*3>~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6T$;2hC{NP^N z2cVFqr;B3<$Mxg{2Ik-PJY}Xl+o~NnPOO-7Jm6oS<9}`u%?%AA24)PRObqf(Jn6<} Rq0vB144$rjF6*2UngDu7Em;5n literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/formspec/gate3/nor3/jeija_gate3_nor3r0.png b/mesecons_autotools_tmp/textures/formspec/gate3/nor3/jeija_gate3_nor3r0.png new file mode 100644 index 0000000000000000000000000000000000000000..a3a0c3a0b3dfd20753f84ed6be9c3065593dc2da GIT binary patch literal 187 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!D3?x-;bCrM;TYyi9E0F&G|NqjP^X~##j3q&S z!3+-1Zlr-YN#5=*3>~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6T$;72BXg{sH z8z`jb>Eal|aXmQ!2yzlO{6D~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6T$;72BEal|aXmQ!2yzlO{6D~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6T$;73s{N3>u zH&95=)5S4_<9c!e5ac9m_F WJhxLj&aD9IWbkzLb6Mw<&;$SrG&C*% literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/formspec/gate3/nor3/jeija_gate3_nor3r3.png b/mesecons_autotools_tmp/textures/formspec/gate3/nor3/jeija_gate3_nor3r3.png new file mode 100644 index 0000000000000000000000000000000000000000..9a9dac0e1eece0eb48ccec8a1a8570e913c997ba GIT binary patch literal 186 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!D3?x-;bCrM;TYyi9E0F&G|NqjP^X~##j3q&S z!3+-1Zlr-YN#5=*3>~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6T$;73slm74c zETE9Cr;B3<$Mxg{2Ik-PJY}Xl+o~NnPOO-7Jm6oS~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6T&d1Nf%Ckgo zAy7!q)5S4_<9c!e5ac9m_~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6T$;73g;k_@w z0Vt&J>Eal|aXmQ!2yzlO{6Cx!a5!Oa`@vs)&2MGfZka2vq%iDsa9kh~z!)IO%*^1; W&ik>u-RlZaD}$%2pUXO@geCyVmN94m literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/formspec/gate3/or3/jeija_gate3_or3r1.png b/mesecons_autotools_tmp/textures/formspec/gate3/or3/jeija_gate3_or3r1.png new file mode 100644 index 0000000000000000000000000000000000000000..8303af940836d13c067ba85fc6823af4017935c9 GIT binary patch literal 184 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!D3?x-;bCrM;TYyi9E0F&G|NqjP^X~##j3q&S z!3+-1Zlr-YN#5=*3>~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6T$;72#5OL{* z7*I&t)5S4_<9c!e5ac9m_|NS0D_&wszrl+c22bjl6+fHvOe>anleJ(|0t18l0^X3t TjLTO5wJ~_Q`njxgN@xNA7i}>( literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/formspec/gate3/or3/jeija_gate3_or3r2.png b/mesecons_autotools_tmp/textures/formspec/gate3/or3/jeija_gate3_or3r2.png new file mode 100644 index 0000000000000000000000000000000000000000..61974530d2e409aae503e6ffb3048b0a0c3a8e64 GIT binary patch literal 186 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!D3?x-;bCrM;TYyi9E0F&G|NqjP^X~##j3q&S z!3+-1Zlr-YN#5=*3>~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6T$;72#5yt7D z0u<8qba4#fxSpH<1UU&C{vS>_emJ4J{h(CGH-j1PnH3e7Pq1<^Ep6axI3*#$pzO=z US{itl6R45F)78&qol`;+03>-YcmMzZ literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/formspec/gate3/or3/jeija_gate3_or3r3.png b/mesecons_autotools_tmp/textures/formspec/gate3/or3/jeija_gate3_or3r3.png new file mode 100644 index 0000000000000000000000000000000000000000..c788f2a9e997f0fb0ffd6b93886ecac670ecaabf GIT binary patch literal 183 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!D3?x-;bCrM;TYyi9E0F&G|NqjP^X~##j3q&S z!3+-1Zlr-YN#5=*3>~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6T$;73|{<9<| z0w|>A>Eal|aXmSKf%&(+LQ44I1k3h=e|Vk$nG0MpOboC)wBSFh*6AAzAsh^bn!F*q T9Zjl%x)?lN{an^LB{Ts5qiQba literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/formspec/pink.png b/mesecons_autotools_tmp/textures/formspec/pink.png new file mode 100644 index 0000000000000000000000000000000000000000..e03b52b8b3c0b0b983e7e331dbe3d6b29df909c3 GIT binary patch literal 141 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|Y)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYmNj^kiEpy*OmPVhpZ5v{C(|&OF$thPZ!4!jq}NW^gnktiX1rNpd@kC fU{&Ia3~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6TE+i->-1E7& z4k)DW>Eal|aXmSKf%&&R50?(luXqWQeFhob1}W1FQ)U}xOgDHjy@91M$bq$o*P)f+ Y?j+8||2~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6TE+i->nWL7H z02DIzba4#fxSpH<1UU&C{vTd&;Lw8qt&Z+3j`l5z|GAvoIGgW@vHjIma9kh~z!)IO a%*^m9oh$GC*6-dx?F^o-elF{r5}E+1k2CN9 literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/formspec/regs/ff2.png b/mesecons_autotools_tmp/textures/formspec/regs/ff2.png new file mode 100644 index 0000000000000000000000000000000000000000..c5fb77491465b62b9eb80825e20e3bd3539993f5 GIT binary patch literal 188 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!D3?x-;bCrM;TYyi9E0F&G|NqjP^X~##j3q&S z!3+-1Zlr-YN#5=*3>~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6TE+iEal|aXmQ!2yzlO{6D~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6TE+iEal|aXmQ!2yzlO{6D~ ZhJU-cmN~r276)o(@O1TaS?83{1OR_CG;9C> literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/formspec/regs/latch0.png b/mesecons_autotools_tmp/textures/formspec/regs/latch0.png new file mode 100644 index 0000000000000000000000000000000000000000..089b64bab707f3918f1bc221643164052f80140c GIT binary patch literal 181 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!D3?x-;bCrM;TYyi9E0F&G|NqjP^X~##j3q&S z!3+-1Zlr-YN#5=*3>~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6TE+i)78&qol`;+0H|&$j{pDw literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/formspec/regs/latch1.png b/mesecons_autotools_tmp/textures/formspec/regs/latch1.png new file mode 100644 index 0000000000000000000000000000000000000000..f545b81cbbdf2a55436c730d5fb144811c730b57 GIT binary patch literal 184 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!D3?x-;bCrM;TYyi9E0F&G|NqjP^X~##j3q&S z!3+-1Zlr-YN#5=*3>~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6TE+i--8otcy zBv44()5S4_<9c!e5ac9m_Ka T?35M*wJ~_Q`njxgN@xNAHV81r literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/formspec/regs/latch2.png b/mesecons_autotools_tmp/textures/formspec/regs/latch2.png new file mode 100644 index 0000000000000000000000000000000000000000..f2ed048327a62ffb4210c16d179680efa45bc117 GIT binary patch literal 184 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!D3?x-;bCrM;TYyi9E0F&G|NqjP^X~##j3q&S z!3+-1Zlr-YN#5=*3>~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6TE+i--y+JPh z98gHx)5S4_<9c!e5ac9m_lngajfTd{%0n@WaRLI+k~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6TE+iEal|aXmQ!2yzlO{6D{XE z)7O>#3A+#hz(NA zi3wY0a<0zm2-@LSBlTcaf9%{spb{TjpNP=Mj6OdOvjp37>n+`pldO0tA!)A56y6U9 s6t8*yINa5#^8LZ(hSNfBL6glH{v~P8=&{v$3bd2K)78&qol`;+07GL!tN;K2 literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/formspec/wires/corner0.png b/mesecons_autotools_tmp/textures/formspec/wires/corner0.png new file mode 100644 index 0000000000000000000000000000000000000000..1272d0ce62487be28c42232e61185c02d294126a GIT binary patch literal 142 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|oCO|{#S9GG!XV7ZFl&wkP>{XE z)7O>#3A+$4KS#%^?el;_x}GkMAsXkC@9awzX4Y)zY;-YDGBwzAa@WI2w=Hbjxy&{s km>#n)K9yk;u!xc2|7-T>vo9r$fEpP*UHx3vIVCg!0Cg26YybcN literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/formspec/wires/corner1.png b/mesecons_autotools_tmp/textures/formspec/wires/corner1.png new file mode 100644 index 0000000000000000000000000000000000000000..d0e64d47f25d1e8ffc65be94fd3baa81ed2881c7 GIT binary patch literal 144 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|oCO|{#S9GG!XV7ZFl&wkP>{XE z)7O>#3A+$4zrtR5`4pg#zNd?0h{pNkJNr_Fnb|&^pL6KIfenRKe9J_HnL86)vJx6w m6nJwJjz|?Q{^+ofjbU0o$MVBFm{ovU89ZJ6T-G@yGywpNe{XE z)7O>#3A+$4zqZ!dV{d>$hMq2tAsXkC@9awzW@h_ve$Jr-2R0N|@huY(X6{UI$x1k= o%+49(m78!xs&Mf~hlOkm#n~LoZ$8Zu18QdQboFyt=akR{062gr>;M1& literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/formspec/wires/corner3.png b/mesecons_autotools_tmp/textures/formspec/wires/corner3.png new file mode 100644 index 0000000000000000000000000000000000000000..550e5c2c7f0337a6507dcd0dcf330ec907f5ab41 GIT binary patch literal 137 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|oCO|{#S9GG!XV7ZFl&wkP>{XE z)7O>#3A+$4znSOhRi;284Nn)x5RLQ6clM{XE z)7O>#3A+#<6Z`tVS<*ludrud~5RLQ6clMUnD7#yQ4F50elF{r5}E*x C6)h{XE z)7O>#3A+%lfJ(W>)yF^~T~8Os5RLQ6clM{XE z)7O>#3A+%lfI;pj#(6*?15X#n5RLQ6clM{XE z)7O>#3A+%lAk!YZ#CV{PzNd?0h{pNkJNr_Fnb|&^pL6KIfenRKe9J_HnL86)vJz4z lmoDDO8=;(MBByZ$XxLZwgNwsBE&#PMc)I$ztaD0e0sxTZC3OG* literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/formspec/wires/tjunction3.png b/mesecons_autotools_tmp/textures/formspec/wires/tjunction3.png new file mode 100644 index 0000000000000000000000000000000000000000..77ea41511b287accc534068bfba2c4204dcd27df GIT binary patch literal 143 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|oCO|{#S9GG!XV7ZFl&wkP>{XE z)7O>#3A+%lAotNnH-7_#^gLZ0Lp07O-`STc%*^)T{G3Av4s0l_;#(#n%-osal9g~! lnVmBx>Xw02VM;aw!`>4dj^awk?gDi(c)I$ztaD0e0sz;^CRqRg literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/formspec/wires/wireh.png b/mesecons_autotools_tmp/textures/formspec/wires/wireh.png new file mode 100644 index 0000000000000000000000000000000000000000..8a5d8956c55d5f2c50879f880bda301968318295 GIT binary patch literal 130 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|oCO|{#S9GG!XV7ZFl&wkP>{XE z)7O>#3A+$4w_wNGTTwtEMNb#U5RLQ6clME$TiF=2 Xma!b%5P!ZCsF=ai)z4*}Q$iB}w)Y|g literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/formspec/wires/wirev.png b/mesecons_autotools_tmp/textures/formspec/wires/wirev.png new file mode 100644 index 0000000000000000000000000000000000000000..c0fce22434aa066c8bae3039ebca37f67bf7c290 GIT binary patch literal 134 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|oCO|{#S9GG!XV7ZFl&wkP>{XE z)7O>#3A+%Vh-w<^JPn|bs;7%%h{pNkJNr_Fnb|&^pL6KIfenRKe9J_HnL86g4zFli bxR{ZlD}>ed^?`aupaup{S3j3^P6{XE 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 literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/pos.png b/mesecons_autotools_tmp/textures/pos.png new file mode 100644 index 0000000000000000000000000000000000000000..8dcf687a81796a6b8116781c249dd92e9a119ac9 GIT binary patch literal 150 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b z3=DjSK$uZf!>a)($X?><>&pIwLt03hY2D|ohk-)Mo-U3d7N?U_5)yu#cTik#q~X8M olv{RL2UajHW^-UrUV2lK;i@r<zopr04HxOWdHyG literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/selection/pos1.png b/mesecons_autotools_tmp/textures/selection/pos1.png new file mode 100644 index 0000000000000000000000000000000000000000..4c304aa88d80420e8f4f005d7f0030234210d5ed GIT binary patch literal 142 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#S9F5hd`K7RKu$QDCpqn z;uvCaIyogF;m3Ig#RW$i{`*Y1b{>hXen$d^p|;Y;hh*$!{-~4PTmomUKfL7wlOh$xHwzEPwaZS>4W|` zIniZ>PmgHv&-hsy+4o@a{3^#Y@7veSxxtia6LH9^Xvs~BSYh1>=S8+mNbHe1QNo`l ta8;>S!M8{GtCAUGmB8ot6~}in&bLnc`CM(;R-mgGJYD@<);T3K0RS0-S``2Q literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/tools/black.png b/mesecons_autotools_tmp/textures/tools/black.png new file mode 100644 index 0000000000000000000000000000000000000000..2f1ee62768a81f19e9eb35905e08cb16cd7df6c2 GIT binary patch literal 223 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYmNj^kiEpy*OmPVJC6{*@jTgC(LkXbPZ!4!i_=RdJ904?axh!}`+xqX zbL50gOD3K@+02)@WsUAyHP1Bxdk$YpV^H?^`fzg}V|~covh|H8xF+R%*5y8DUVl(# z$)vRB8}hc@t}?xKh?`O8$U4Ku2{L`$W>zZVI+HKUrcbbt{NF14iNPt;kIgA(#w4J< N44$rjF6*2UngDGaOEv%i literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/tools/blue.png b/mesecons_autotools_tmp/textures/tools/blue.png new file mode 100644 index 0000000000000000000000000000000000000000..6869edf50f4018b9a1efd8893d3350855e227bea GIT binary patch literal 249 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE({6`Qy9KYbGuvz6yYrJ zh%9Dc;1&j9Muu5)B!GhKC7!;n>`&Nv`An=CzZ_5i3blEgv{3KF_7HipNcjCM;!_^Izc{ rC3$1v7u9z?OI7AP+4297#&gye>XG4JeUHxtx`@Hk)z4*}Q$iB}ypL7! literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/tools/orange.png b/mesecons_autotools_tmp/textures/tools/orange.png new file mode 100644 index 0000000000000000000000000000000000000000..e0195bdf5e9444d82d4c94786ca0ca6dea4b93b9 GIT binary patch literal 257 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYmNj^kiEpy*OmPVhYY)^;BcOQQSV0g zI`=PjyOzXG6Ux#I64+=c!1$wgXVPX3C9BHMg$!js`xNSmFP=>Qx@FPEbxP}3UER28 zLa%82>GWlH+s%5e`gJp=Sih~5$yj|Sx%$DmBa_y;yexcVFm0Ro>fY4%yMrcrl!pua ylz+r?GGXzT?nwu)$*A}>sn4*eR5K9#$uLVYFrxIvB^{v47(8A5T-G@yGywn{pkMz0 literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/tools/orange_up.png b/mesecons_autotools_tmp/textures/tools/orange_up.png new file mode 100644 index 0000000000000000000000000000000000000000..56ff087f636440938c6f82f185eae7115ed0efca GIT binary patch literal 246 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYmNj^kiEpy*OmPVhqR!f0XOF~BcM>Tr;B5V#p$_|9EBPbc$kIjR`4HH zKi2$$WlhwX&cs`)zKRShoCT^a_7H4Um-Bz^Q~Fz9xro#S8jF+ z3Xt|(bP0l+XkKb_7n* literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/tools/refresh.png b/mesecons_autotools_tmp/textures/tools/refresh.png new file mode 100644 index 0000000000000000000000000000000000000000..ac12fa1fe27d8f28f2edb706b6ad723d0d9d93e3 GIT binary patch literal 263 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYmNj^kiEpy*OmPVhb%XT0GFkc6;No3r;B5V#p$V&yu}VEa4;L+`+x4` zq2)n;t~@%%CF>+|bwg6bk>b-C!e5la*(NBO?rog%qxg=sj;F#N)|%F*x$9hRc5GZ; zc4qGK{M%b^oSbQR$-C~`B9ryiP2cA-+&wULqN;k%;t(;#aJ5^-g`b~rY&f=OyTBvq z2#eks?+p%3ZzQ-||7MhyB1hrN7GiaY+e!M)HWo`C?0-*aCJYD@<);T3K F0RV`?VwV5_ literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/tools/white.png b/mesecons_autotools_tmp/textures/tools/white.png new file mode 100644 index 0000000000000000000000000000000000000000..e4bc23e0ac0bba6dac25888082dc07a899f097a3 GIT binary patch literal 279 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYmNj^kiEpy*OmPVhYY(J8(&|MI8bPbr;B5V#p$V&9K~7`c$_Eii{!8R z@61))c*f~2YFw1Nk0Cy$&ZWifWH@4`abbfuLYhwlMcvc$yTucYnChL zc$IytL0PHxX2ZAl-?-~39$B`yqP1!Ps@)QcT}LOq@?jv*GOr%pO3ctC-J=BG95eBS+XVnt8KhDtT{vDEbpJ(^}=RwmaJe9B& wxZEu4AJd&8d1Ij-tG4RD(0Lk`Oc4{ri;bf#5>vPG0o}#m>FVdQ&MBb@0Ni0xg#Z8m literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/tools/white_down.png b/mesecons_autotools_tmp/textures/tools/white_down.png new file mode 100644 index 0000000000000000000000000000000000000000..a1b1f6e90d9c7158ae01ed92e730e87ede27b898 GIT binary patch literal 271 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYmNj^kiEpy*OmPVhYY)}`M0#4+krxJJY5_^EKX0IbdmS40SBwRq(b3$ zd7}%garRQ~4}x4Ktho_nF`tpKA-K1|urKxk&&-qS3m-JuHs#n=-u)k^?!#ys-Wkt7 z<5u1JZ)rPbUZ2RL=4AA5&yiT}_5NNAKTaetKAIGKfJ-to(DSBOE(4Rp)dgAcrTbUu z`J7l;w%x2c?&dK*m9>tclSS`IEy-DmG$SKi)2t&g8MKb$#jW^%VGH29`em))lu_a48xeq)<{Rm-fx zK3mVFe(HJd>M=Q7_kZfdn)~Z=Ke1>o4@zx& zv9!^0Ny*9Yj`xonaqRn2&V23gRA~|3xl?%#$naG+pV`AYq4c1lS^BM--;hRjZxeBZ|z&3nqZ*^&nM52s9vWK81yB-W#KP|Zpn5d UDfY?pfX-#`boFyt=akR{03R}G2mk;8 literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/textures/wall.png b/mesecons_autotools_tmp/textures/wall.png new file mode 100644 index 0000000000000000000000000000000000000000..fde36a8782e7c44d2aea80a82ec486797e1a6497 GIT binary patch literal 147 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b z3=DjSK$uZf!>a)($X?><>&kwYM?y$VOscWW8z`jU>Eak-aXL96A>qe)2F53sL^A)K lH+a<)DBiOxVZsgu2LE^Ujruw}U4UvCJYD@<);T3K0RTS*DV6{L literal 0 HcmV?d00001 diff --git a/mesecons_autotools_tmp/tools.lua b/mesecons_autotools_tmp/tools.lua new file mode 100644 index 0000000..88de35a --- /dev/null +++ b/mesecons_autotools_tmp/tools.lua @@ -0,0 +1,133 @@ +-- Common functions +-- a bit of a weld (TODO: fix that) +function is_circuit_element(pos) + local node = minetest.get_node(pos) + local name = node.name + + local m = string.match(name,"^mesecons_") + if m ~= nil then + return true + end + + m = string.match(name,"^mesecons:") + if m ~= nil then + return true + end + + if name == "default:mese" then + return true + end + + + return false +end + + + + +-- Register all tools and callbacks + +local tool_list = { + {"black", "Auto Wire Tool"}, + {"blue", "Selection Tool"}, + {"white_up", "Selection Top Edge Tool"}, + {"white_down", "Selection Bottom Edge Tool"}, + {"white", "Selection Right Edge Tool"}, + {"orange", "Stack Right Tool"}, + {"orange_up", "Stack Up Tool"}, + {"red", "Delete Tool"}, + {"yellow", "Move Horizontal Tool"}, + {"yellow_updown", "Move Vertical Tool"}, + {"refresh", "Refresh Tool"} + } +for _,t in pairs(tool_list) do + local tool = t[1] + local description = t[2] + + minetest.register_tool("mesecons_autotools:" .. tool , { + description = description, + inventory_image = tool .. ".png", + stack_max = 1, + groups = { tool =1 }, + + on_use = function(itemstack, player, pointed_thing) + local pos = pointed_thing.under + local player_pos = vector.round(player:get_pos()) + local player_name = player:get_player_name() + local rad = player:get_look_horizontal() + + if pointed_thing.type == "node" then + if (is_circuit_element(pos)) then + pos = pointed_thing.under + mesecons_autotools.execute_action(tool,"left","block", player_name, pos, rad, pointed_thing.under); + else + pos = pointed_thing.above + mesecons_autotools.execute_action(tool,"left","block", player_name, pos, rad, pointed_thing.under); + end + + elseif pointed_thing.type == "nothing" then + if (is_circuit_element(player_pos)) then + pos = pointed_thing.under + mesecons_autotools.execute_action(tool,"left","air", player_name, player_pos, rad); + else + pos = pointed_thing.above + mesecons_autotools.execute_action(tool,"left","air", player_name, player_pos, rad); + end + end + + end, + + on_place = function(itemstack, player, pointed_thing) + local pos = pointed_thing.under + local player_pos = vector.round(player:get_pos()) + local player_name = player:get_player_name() + local rad = player:get_look_horizontal() + + if pointed_thing.type == "node" then + if (is_circuit_element(pos)) then + pos = pointed_thing.under + mesecons_autotools.execute_action(tool,"right","block", player_name, pos, rad, pointed_thing.under); + else + pos = pointed_thing.above + mesecons_autotools.execute_action(tool,"right","block", player_name, pos, rad, pointed_thing.under); + end + end + + + end, + on_secondary_use = function(itemstack, player, pointed_thing) + local pos = pointed_thing.under + local player_pos = vector.round(player:get_pos()) + local player_name = player:get_player_name() + local rad = player:get_look_horizontal() + + if pointed_thing.type == "nothing" then + if (is_circuit_element(player_pos)) then + pos = pointed_thing.under + mesecons_autotools.execute_action(tool,"right","air", player_name, player_pos, rad); + else + pos = pointed_thing.above + mesecons_autotools.execute_action(tool,"right","air", player_name, player_pos, rad); + end + + end + + end + + + }) + + + + -- Implementations + dofile(minetest.get_modpath("mesecons_autotools").."/tools/" .. tool .. "/".. tool .. ".lua"); + + +end + +dofile(minetest.get_modpath("mesecons_autotools").."/tools/selection.lua"); +dofile(minetest.get_modpath("mesecons_autotools").."/tools/direction.lua"); +dofile(minetest.get_modpath("mesecons_autotools").."/tools/wire.lua"); +dofile(minetest.get_modpath("mesecons_autotools").."/tools/bundle.lua"); + + diff --git a/mesecons_autotools_tmp/tools/black/black.lua b/mesecons_autotools_tmp/tools/black/black.lua new file mode 100644 index 0000000..a8fa1fa --- /dev/null +++ b/mesecons_autotools_tmp/tools/black/black.lua @@ -0,0 +1,63 @@ + + + + +mesecons_autotools.register_action("black","left","air", function(user,pos,rad) + -- Unselect pos + mesecons_autotools.set_pos(user,1,nil); + mesecons_autotools.set_pos(user,2,nil); + + -- Update + mesecons_autotools.render(user) + mesecons_autotools.zero_stack_counter(user) + mesecons_autotools.zero_stack_direction(user) + +end) +mesecons_autotools.register_action("black","left","block", function(user,pos,rad) + mesecons_autotools.set_pos(user,1,pos) + mesecons_autotools.set_pos(user,2,pos) + + -- Update + mesecons_autotools.render(user) + mesecons_autotools.zero_stack_counter(user) + mesecons_autotools.zero_stack_direction(user) +end) + +mesecons_autotools.register_action("black","right","block", function(user,pos,rad) + local pos1 = mesecons_autotools.get_pos(user,1) + local pos2 = mesecons_autotools.get_pos(user,2) + local sel = {} + sel.pos1 = pos1 + sel.pos2 = pos2 + + if not mesecons_autotools.is_full_selection(user) then return end + + local done = false + done = create_bundle_straight_wire(sel ,pos) + if done == true then + local direction = tunel_direction(sel,pos) + local distance = distance_to_selection(sel,pos,direction) -1 + + -- set new selection + local front_wall = tunel_front_wall(sel,pos) + mesecons_autotools.set_pos(user,1,front_wall.pos1) + mesecons_autotools.set_pos(user,2,front_wall.pos2) + shift_selection(user, vector.multiply(direction,distance)) + + -- Update + mesecons_autotools.render(user) + mesecons_autotools.zero_stack_counter(user) + mesecons_autotools.zero_stack_direction(user) + end + + + +end) + +mesecons_autotools.register_action("black","right","air", function(user,pos,rad) + +end) + + + + \ No newline at end of file diff --git a/mesecons_autotools_tmp/tools/blue/blue.lua b/mesecons_autotools_tmp/tools/blue/blue.lua new file mode 100644 index 0000000..5d093c4 --- /dev/null +++ b/mesecons_autotools_tmp/tools/blue/blue.lua @@ -0,0 +1,30 @@ + + +local function select_pos(user,pos,nr) + mesecons_autotools.set_pos(user,nr,pos); + + + -- Update + mesecons_autotools.render(user) + mesecons_autotools.zero_stack_counter(user) +end + + + + +mesecons_autotools.register_action("blue","left","air", function(user,pos,rad) + select_pos(user,pos,1) +end) +mesecons_autotools.register_action("blue","left","block", function(user,pos,rad) + select_pos(user,pos,1) +end) + +mesecons_autotools.register_action("blue","right","block", function(user,pos,rad) + select_pos(user,pos,2) +end) + +mesecons_autotools.register_action("blue","right","air", function(user,pos,rad) + select_pos(user,pos,2) +end) + + \ No newline at end of file diff --git a/mesecons_autotools_tmp/tools/bundle.lua b/mesecons_autotools_tmp/tools/bundle.lua new file mode 100644 index 0000000..3ff7f3f --- /dev/null +++ b/mesecons_autotools_tmp/tools/bundle.lua @@ -0,0 +1,599 @@ + +function is_in_selection(sel,p) + local pos = {} + pos[1] = sel.pos1 + pos[2] = sel.pos2 + + if pos[1] == nil then return false end + if pos[2] == nil then return false end + + local xmax = math.max(pos[1].x, pos[2].x) + local xmin = math.min(pos[1].x, pos[2].x) + + local ymax = math.max(pos[1].y, pos[2].y) + local ymin = math.min(pos[1].y, pos[2].y) + + local zmax = math.max(pos[1].z, pos[2].z) + local zmin = math.min(pos[1].z, pos[2].z) + + local x = p.x + local y = p.y + local z = p.z + + if (xmin<=p.x) and (p.x<=xmax) and + (ymin<=p.y) and (p.y<=ymax) and + (zmin<=p.z) and (p.z<=zmax) then + return true + end + return false +end + +function is_in_layer(sel,p) + local pos = {} + pos[1] = sel.pos1 + pos[2] = sel.pos2 + + local ymax = math.max(pos[1].y, pos[2].y) + local ymin = math.min(pos[1].y, pos[2].y) + + if (p.y > ymax) or (p.y< ymin) then return false end + return true + +end + +function is_in_tube(sel,p) + if is_in_selection(sel,p) then return false end + if not is_in_layer(sel,p) then return false end + local pos = {} + pos[1] = sel.pos1 + pos[2] = sel.pos2 + + local xmax = math.max(pos[1].x, pos[2].x) + local xmin = math.min(pos[1].x, pos[2].x) + + local ymax = math.max(pos[1].y, pos[2].y) + local ymin = math.min(pos[1].y, pos[2].y) + + local zmax = math.max(pos[1].z, pos[2].z) + local zmin = math.min(pos[1].z, pos[2].z) + + local x = p.x + local y = p.y + local z = p.z + + if (xmin <=x ) and (x<=xmax) then return true end + if (zmin <=z) and (z<=zmax) then return true end + return false + +end +--[[ +function is_in_wings(sel,p) + if is_in_selection(sel,p) then return false end + if not is_in_layer(sel,p) then return false end + if is_in_tube(sel,p) then return false end + return true +end +]]-- + + +function front_wall_tube(sel,p) + local pos = {} + pos[1] = sel.pos1 + pos[2] = sel.pos2 + + local xmax = math.max(pos[1].x, pos[2].x) + local xmin = math.min(pos[1].x, pos[2].x) + + local ymax = math.max(pos[1].y, pos[2].y) + local ymin = math.min(pos[1].y, pos[2].y) + + local zmax = math.max(pos[1].z, pos[2].z) + local zmin = math.min(pos[1].z, pos[2].z) + + local x = p.x + local y = p.y + local z = p.z + + local new_sel = {} + local new_pos1 = vector.new(pos[1]) + local new_pos2 = vector.new(pos[2]) + local direction = {} + + + if (xmin<=x) and (x<=xmax) then + if (z > zmax) then + direction.x = 0 + direction.y = 0 + direction.z = 1 + + new_pos1.z = zmax + new_pos2.z = zmax + else + direction.x = 0 + direction.y = 0 + direction.z = -1 + + new_pos1.z = zmin + new_pos2.z = zmin + end + end + if (zmin<=z) and (z<=zmax) then + if( x > xmax) then + direction.x = 1 + direction.y = 0 + direction.z = 0 + + new_pos1.x = xmax + new_pos2.x = xmax + else + direction.x = -1 + direction.y = 0 + direction.z = 0 + + new_pos1.x = xmin + new_pos2.x = xmin + + end + + end + + + new_sel.pos1 = new_pos1 + new_sel.pos2 = new_pos2 + + return new_sel,direction +end + +function tunel_direction(sel,pos) + local wall,dir = front_wall_tube(sel,pos) + return dir +end + +function tunel_front_wall(sel,pos) + local wall,dir = front_wall_tube(sel,pos) + return wall +end + + + + +function is_dir_vertical(direction) + if direction.z ~= 0 then return true end + return false +end + +function is_look_vertical(rad) + local dir = radians_to_direction_looking_forward(rad) + return is_dir_vertical(dir) +end + +--[[ +function is_dir_horizontal(direction) + if direction.x ~= then return true end + return false +end +]]-- + +function front_wall_by_direction(sel,direction) + local pos = {} + pos[1] = sel.pos1 + pos[2] = sel.pos2 + + local xmax = math.max(pos[1].x, pos[2].x) + local xmin = math.min(pos[1].x, pos[2].x) + + local ymax = math.max(pos[1].y, pos[2].y) + local ymin = math.min(pos[1].y, pos[2].y) + + local zmax = math.max(pos[1].z, pos[2].z) + local zmin = math.min(pos[1].z, pos[2].z) + + + local new_sel = {} + local new_pos1 = vector.new(pos[1]) + local new_pos2 = vector.new(pos[2]) + + if direction.x == 1 then + new_pos1.x = xmax + new_pos2.x = xmax + end + if direction.x == -1 then + new_pos1.x = xmin + new_pos2.x = xmin + end + if direction.z == 1 then + new_pos1.z = zmax + new_pos2.z = zmax + end + if direction.z == -1 then + new_pos1.z = zmin + new_pos2.z = zmin + end + if direction.y == 1 then + new_pos1.y = ymax + new_pos2.y = ymax + end + if direction.y == -1 then + new_pos1.y = ymin + new_pos2.y = ymin + end + + new_sel.pos1 = new_pos1 + new_sel.pos2 = new_pos2 + + return new_sel +end +--[[ +function get_wing_cords(sel,p) + local zero = {x =0,z=0} + local cord + if is_in_selection(sel,p) then return zero end + if not is_in_layer(sel,p) then return zero end + + local pos = {} + pos[1] = sel.pos1 + pos[2] = sel.pos2 + + local xmax = math.max(pos[1].x, pos[2].x) + local xmin = math.min(pos[1].x, pos[2].x) + + local ymax = math.max(pos[1].y, pos[2].y) + local ymin = math.min(pos[1].y, pos[2].y) + + local zmax = math.max(pos[1].z, pos[2].z) + local zmin = math.min(pos[1].z, pos[2].z) + + local x = p.x + local y = p.y + local z = p.z + + if (x>xmax) and (z>zmax) then + cord = { x = 1, z = 1} + end + if (xzmax) then + cord = {x = -1 , z = 1} + end + if (zxmax) then + cord = { x = 1 , z = -1 } + end + if (z < zmin) and (x < xmin) then + cord = { x -1 ,z = -1 } + end + + return cord +end +]]-- +--[[ +function front_wall_wing(sel,p,rad) + local cord = get_wing_cords(sel,p) + + local wall_dir + wall_dir.y = 0 + + if cord.x == 1 and cord.z == 1 then + if is_look_vertical(rad) then + wall_dir = {x=1,z=0} + else + wall_dir = {x=0,z=1} + end + end + + if cord.x == -1 and cord.z == 1 then + if is_look_vertical(rad) then + wall_dir = {x=-1,z=0} + else + wall_dir = {x=0,z=1} + end + end + + if cord.x == 1 and cord.z == -1 then + if is_look_vertical(rad) then + wall_dir = {x=1,z=0} + else + wall_dir = {x=0,z=-1} + end + end + + if cord.x == -1 and cord.z == -1 then + if is_look_vertical(rad) then + wall_dir = {x=-1,z=0} + else + wall_dir = {x=0,z=-1} + end + end + + local wall = front_wall_by_direction(wall_dir) + + return wall,wall_dir +end + +]]-- +function distance_to_selection(sel,p,direction) + local dist = 0 + local pos = {} + pos[1] = sel.pos1 + pos[2] = sel.pos2 + + if not is_in_layer(sel,p) then return dist end + + --local direction = tunel_direction(sel,p) + + + local xmax = math.max(pos[1].x, pos[2].x) + local xmin = math.min(pos[1].x, pos[2].x) + + local ymax = math.max(pos[1].y, pos[2].y) + local ymin = math.min(pos[1].y, pos[2].y) + + local zmax = math.max(pos[1].z, pos[2].z) + local zmin = math.min(pos[1].z, pos[2].z) + + if direction.x ~= 0 then + if direction.x == 1 then + dist = math.abs(p.x - xmax) + elseif direction.x == -1 then + dist = math.abs(xmin-p.x) + end + + elseif direction.z ~= 0 then + if direction.z == 1 then + dist = math.abs(p.z - zmax) + elseif direction.z == -1 then + dist = math.abs(zmin - p.z) + end + + end + + return dist + 1 + +end + +--[[ +function direction_to_pins(direction) + local pin = {0,0,0,0} + if direction.x == -1 then + pin[1] = 1 + end + if direction.x == 1 then + pin[3] = 1 + end + if direction.z == 1 then + pin[2] = 1 + end + if direction.z == -1 then + pin[4] == 1 + end + return pin +end +]]-- +function direction_to_pin(direction) + if direction.x == -1 then + return 1 + end + if direction.x == 1 then + return 3 + end + if direction.z == 1 then + return 2 + end + if direction.z == -1 then + return 4 + end +end + + +function pos_to_connect(wall,direction) + local list = {} + iterate_selection(wall.pos1,wall.pos2, function(pos) + local pins = get_pins_from_pos(pos) + local dpin = direction_to_pin(direction) + if pins[dpin] == 1 then + table.insert(list,pos) + end + end) + return list +end + +function _is_block_type(pos,direction) + local node = minetest.get_node(pos) + local name = node.name + + if name == "air" then + return "buildable" + end + + if name == "mesecons_insulated:insulated_off" or + name == "mesecons_insulated:insulated_on" then + + local param2 = node.param2 + local pin = direction_to_pin(direction) + + if (param2==0 or param2==2) and (pin==2 or pin==4) then + return "buildable" + end + if (param2==1 or param2==3) and (pin==1 or pin==3) then + return "buildable" + end + return "last" + end + + + local pos_pins = get_pins_from_pos(pos) + local dir_pin = flip_pin(direction_to_pin(direction)) + if pos_pins[dir_pin] ==1 then + return "last" + end + return "cancel" +end + + +function is_block_type(pos,direction) + local res = _is_block_type(pos,direction) + local node = minetest.get_node(pos) + local name = node.name + + + return res +end + + +function is_block_cancel(pos,direction) + if is_block_type(pos,direction) == "cancel" then + return true + else + return false + end +end + +function is_block_last(pos,direction) + if is_block_type(pos,direction) == "last" then + return true + else + return false + end +end + +function is_block_buildable(pos,direction) + if is_block_type(pos,direction) == "buildable" then + return true + else + return false + end +end + + + +function _can_build_wire(pos,direction,size) + local current = { x=pos.x , y =pos.y, z=pos.z} + + local flag = false + for i=1,size,1 do + + if is_block_cancel(current,direction) then + return false + end + if is_block_last(current,direction) then + return true + end + + current = vector.add(current,direction) + end + return flag +end + +function can_build_wire(pos,direction,size) + return _can_build_wire(pos,direction,size) +end + + +function add_wire(pos,direction) + local node = minetest.get_node(pos) + local name = node.name + + if name == "air" then + local pins = get_pins_from_pos(pos) + local dpin = direction_to_pin(direction) + + pins[dpin] = 1 + pins[flip_pin(dpin)] = 1 + + local nnode = get_node_from_pins(pins) + + --minetest.set_node(pos,nnode) + mesecons_autotools.set_node(pos,nnode,"add_wire") + else + local nnode = { name = "mesecons_extrawires:crossover_off" } + --minetest.set_node(pos, nnode) + mesecons_autotools.set_node(pos,nnode,"add_wire") + + end + + + +end +--[[ not used +function add_last_wire(pos,direction) + local pins = get_pins_from_pos(pos) + local dpin = direction_to_pin(direction) + + pins[flip_pin(dpin)] = 1 + + local node = get_node_from_pins(pins) + + minetest.set_node(pos,node) + +end +]]-- + +function build_wire_inside(pos,direction,size) + local current = { x=pos.x , y =pos.y, z=pos.z} + + if not can_build_wire(pos,direction,size) then return end + + for i=1,size,1 do + if is_block_cancel(current,direction) then + return + elseif is_block_buildable(current,direction) then + add_wire(current,direction) + elseif is_block_last(current,direction) then + break + end + current = vector.add(current,direction) + end +end + + + +function create_wires_inside_selection(sel,wall,direction) + local size = size_by_direction(sel.pos1,sel.pos2,direction) + local back_direction = vector.multiply(direction,-1) + + + iterate_selection(wall.pos1,wall.pos2,function(pos) + build_wire_inside(pos,back_direction,size) + end) + +end + + +function create_bundle_straight_wire(sel,pos) + local pos1 = sel.pos1 + local pos2 = sel.pos2 + + + if not is_in_tube(sel,pos) then return false end + + + local wall,direction = front_wall_tube(sel,pos) + + + local distance = distance_to_selection(sel,pos,direction) + + if is_one_block(pos1,pos2) or + is_empty_selection(pos1,pos2) or + is_tower_selection(pos1,pos2) then + + iterate_selection(sel.pos1, sel.pos2, function(pos) + create_straight_wire_n(pos,direction,distance) + end) + else + + + + create_wires_inside_selection(sel,wall,direction) + + + local wire_list = pos_to_connect(wall,direction) + iterate_list(wire_list,function(pos) + create_straight_wire_n(pos,direction,distance) + end) + + end + return true + +end + + + + + diff --git a/mesecons_autotools_tmp/tools/direction.lua b/mesecons_autotools_tmp/tools/direction.lua new file mode 100644 index 0000000..86e10a1 --- /dev/null +++ b/mesecons_autotools_tmp/tools/direction.lua @@ -0,0 +1,28 @@ +function radians_to_vectors(rad) + local pi = math.pi + if (rad>=0) and (rad<=pi/4) or (rad<=2*pi) and (rad>=(3/2+1/4)*pi) then + return {left = {x=-1,z=0,y=0},right = { x=1, z = 0,y=0 } } + elseif (rad >= 1/4*pi) and (rad <= (1/2+1/4)*pi) then + return { left = {x = 0 ,z=-1,y=0}, right = { x = 0, z = 1 ,y=0} } + elseif (rad >= (1-1/4)*pi ) and (rad <= (3/2-1/4)*pi ) then + return { left = { x = 1, z =0 ,y=0}, right = { x = -1, z = 0 ,y=0} } + else + return { left = { z =1, x = 0 ,y=0} , right = { z = -1 , x = 0,y=0 }} + end +end + + +function radians_to_direction_looking_forward(rad) + if rad == nil then return {x=1,z=0,y=0} end + local pi = math.pi + if (rad>=0) and (rad<=pi/4) or (rad<=2*pi) and (rad>=(3/2+1/4)*pi) then + return {x=0, z =1 ,y=0} + elseif (rad >= 1/4*pi) and (rad <= (1/2+1/4)*pi) then + return {x=-1,z=0,y=0} + elseif (rad >= (1-1/4)*pi ) and (rad <= (3/2-1/4)*pi ) then + return {x=0,z=-1,y=0} + else + return {x=1,z=0,y=0} + end +end + diff --git a/mesecons_autotools_tmp/tools/orange/orange.lua b/mesecons_autotools_tmp/tools/orange/orange.lua new file mode 100644 index 0000000..1c1f449 --- /dev/null +++ b/mesecons_autotools_tmp/tools/orange/orange.lua @@ -0,0 +1,106 @@ +local function stack_right(user,rad) + local dir = radians_to_vectors(rad) + local left = dir.left + local right = dir.right + + local pos = {} + pos[1] = mesecons_autotools.get_pos(user,1) + pos[2] = mesecons_autotools.get_pos(user,2) + + + if pos[1] == nil then return end + if pos[2] == nil then return end + + + -- compute shift vector + + local shift_vector = {} + if right.x ~= 0 then + shift_vector.x = right.x * (math.abs(pos[2].x - pos[1].x)+1) + shift_vector.z = 0 + shift_vector.y = 0 + elseif right.z ~= 0 then + shift_vector.x = 0 + shift_vector.y = 0 + shift_vector.z = right.z * (math.abs(pos[2].z - pos[1].z)+1) + end + + copy(pos[1],pos[2],shift_vector) + shift_selection(user,shift_vector) + + -- Update + mesecons_autotools.render(user) + + + local old_stack_direction = mesecons_autotools.get_stack_direction(user) + if not vector.equals(old_stack_direction,right) then + mesecons_autotools.set_stack_direction(user,right) + mesecons_autotools.zero_stack_counter(user) + end + mesecons_autotools.inc_stack_counter(user) + + +end + + +local function stack_remove(user,rad) + local dir = radians_to_vectors(rad) + local left = dir.left + local right = dir.right + + local pos = {} + pos[1] = mesecons_autotools.get_pos(user,1) + pos[2] = mesecons_autotools.get_pos(user,2) + + + if pos[1] == nil then return end + if pos[2] == nil then return end + + if not vector.equals(mesecons_autotools.get_stack_direction(user),right) then return end + if mesecons_autotools.get_stack_counter(user) == 0 then return end + + -- compute shift vector + local shift_vector = {} + if right.x ~= 0 then + shift_vector.x = - right.x * (math.abs(pos[2].x - pos[1].x)+1) + shift_vector.z = 0 + shift_vector.y = 0 + elseif right.z ~= 0 then + shift_vector.x = 0 + shift_vector.y = 0 + shift_vector.z = - right.z * (math.abs(pos[2].z - pos[1].z)+1) + end + + delete(pos[1],pos[2]) + shift_selection(user,shift_vector) + + mesecons_autotools.dec_stack_counter(user) + + + -- Update + mesecons_autotools.render(user) + + +end + + + + + +mesecons_autotools.register_action("orange","left","air", function(user,pos,rad) + stack_remove(user,rad) +end) +mesecons_autotools.register_action("orange","left","block", function(user,pos,rad) + stack_remove(user,rad) +end) + +mesecons_autotools.register_action("orange","right","block", function(user,pos,rad) + stack_right(user,rad) +end) + +mesecons_autotools.register_action("orange","right","air", function(user,pos,rad) + stack_right(user,rad) +end) + + + \ No newline at end of file diff --git a/mesecons_autotools_tmp/tools/orange_up/orange_up.lua b/mesecons_autotools_tmp/tools/orange_up/orange_up.lua new file mode 100644 index 0000000..8731e25 --- /dev/null +++ b/mesecons_autotools_tmp/tools/orange_up/orange_up.lua @@ -0,0 +1,92 @@ + + + + + +local function stack_up(user) + if not mesecons_autotools.is_full_selection(user) then return end + + + local pos = {} + pos[1] = mesecons_autotools.get_pos(user,1) + pos[2] = mesecons_autotools.get_pos(user,2) + + + + local ymax = math.max(pos[1].y,pos[2].y) + local ymin = math.min(pos[1].y,pos[2].y) + local shift_up = ymax - ymin + 1 + local shift_vector = { x= 0, y = shift_up , z= 0 } + copy(pos[1],pos[2],shift_vector) + shift_selection(user,shift_vector) + + + if not vector.equals(mesecons_autotools.get_stack_direction(user),{x=0,y=1,z=0}) then + mesecons_autotools.zero_stack_counter(user); + end + + + mesecons_autotools.inc_stack_counter(user) + mesecons_autotools.set_stack_direction(user, { x=0,y=1,z=0 } ) + + + -- Update + mesecons_autotools.render(user) + + + +end + + +local function stack_remove(user) + if not mesecons_autotools.is_full_selection(user) then return end + + + local pos = {} + pos[1] = mesecons_autotools.get_pos(user,1) + pos[2] = mesecons_autotools.get_pos(user,2) + + + + local ymax = math.max(pos[1].y,pos[2].y) + local ymin = math.min(pos[1].y,pos[2].y) + local shift_down = ymax - ymin + 1 + local shift_vector = { x= 0, y = -shift_down , z= 0 } + + if mesecons_autotools.get_stack_counter(user) == 0 then + return + end + + if not vector.equals(mesecons_autotools.get_stack_direction(user),{x=0,y=1,z=0}) then return end + + delete(pos[1],pos[2]) + shift_selection(user,shift_vector) + + mesecons_autotools.dec_stack_counter(user) + + + + -- Update + mesecons_autotools.render(user) +end + + + + +mesecons_autotools.register_action("orange_up","left","air", function(user,pos,rad) + stack_remove(user) +end) +mesecons_autotools.register_action("orange_up","left","block", function(user,pos,rad) + stack_remove(user) +end) + +mesecons_autotools.register_action("orange_up","right","block", function(user,pos,rad) + stack_up(user) +end) + +mesecons_autotools.register_action("orange_up","right","air", function(user,pos,rad) + stack_up(user) +end) + + + \ No newline at end of file diff --git a/mesecons_autotools_tmp/tools/red/red.lua b/mesecons_autotools_tmp/tools/red/red.lua new file mode 100644 index 0000000..d5bffbf --- /dev/null +++ b/mesecons_autotools_tmp/tools/red/red.lua @@ -0,0 +1,43 @@ + + + + +mesecons_autotools.register_action("red","left","air", function(user,pos,rad) + + +end) +mesecons_autotools.register_action("red","left","block", function(user,pos,rad,under) + --minetest.set_node(under,{name="air"}) + mesecons_autotools.set_node(under,{name="air"},"red") +end) + +mesecons_autotools.register_action("red","right","block", function(user,pos,rad,under) + local sel = {} + sel.pos1 = mesecons_autotools.get_pos(user,1) + sel.pos2 = mesecons_autotools.get_pos(user,2) + if is_in_selection(sel,under) then + iterate_selection(sel.pos1,sel.pos2,function(p) + delete_node(p) + end) + else + if is_circuit_element(under) then + delete_node(under) + end + + end + + +end) + +mesecons_autotools.register_action("red","right","air", function(user,pos,rad) + if not mesecons_autotools.is_full_selection(user) then return end + + local pos = {} + pos[1] = mesecons_autotools.get_pos(user,1) + pos[2] = mesecons_autotools.get_pos(user,2) + + delete(pos[1],pos[2]) +end) + + + \ No newline at end of file diff --git a/mesecons_autotools_tmp/tools/refresh/refresh.lua b/mesecons_autotools_tmp/tools/refresh/refresh.lua new file mode 100644 index 0000000..b0bef77 --- /dev/null +++ b/mesecons_autotools_tmp/tools/refresh/refresh.lua @@ -0,0 +1,105 @@ + + +function is_mese(node) + if node.name == "default:mese" or + node.name == "mesecons_extrawires:mese_powered" then + return true + else + return false + end + +end + +function mese_off(node) + local n = {} + if is_mese(node) then + n.name = "default:mese" + n.param2 = node.param2 + return n + else + return node + end +end + + + + +function wire_off(node) + local n = {} + local name = node.name + n.param2 = node.param2 + + if is_wire_node(node) then + if string.match(name, "^mesecons_extrawires:crossover_") ~= nil then + n.name = "mesecons_extrawires:crossover_off" + return n + else + local base,state = string.match(name, "^(.*)_([^_]+)$") + base = base or "" + state = state or "" + + local name_off = base .. "_" .. "off" + n.name = name_off + return n + end + + else + return node + end +end + + + +local function refresh_selection(pos1,pos2) + iterate_selection(pos1,pos2, function(pos) + -- mesecon.on_placenode(pos,minetest.get_node(pos)) + + local node = minetest.get_node(pos) + local new_node = wire_off(node) + + + + local cur_node = minetest.get_node(pos) + mesecon.on_dignode(pos,cur_node) + ref_remove(pos,cur_node) + + minetest.set_node(pos,new_node) + mesecon.on_placenode(pos,new_node) + ref_place(pos,new_node) + + end) + +end + + + +mesecons_autotools.register_action("refresh","left","air", function(user,pos,rad) + + +end) +mesecons_autotools.register_action("refresh","left","block", function(user,pos,rad) + --mesecon.on_placenode(pos, minetest.get_node(pos)) + refresh_selection(pos,pos) +end) + +mesecons_autotools.register_action("refresh","right","block", function(user,pos,rad) + if not mesecons_autotools.is_full_selection(user) then return end + + local pos1 = mesecons_autotools.get_pos(user,1) + local pos2 = mesecons_autotools.get_pos(user,2) + refresh_selection(pos1,pos2) + +end) + +mesecons_autotools.register_action("refresh","right","air", function(user,pos,rad) + if not mesecons_autotools.is_full_selection(user) then return end + + local pos1 = mesecons_autotools.get_pos(user,1) + local pos2 = mesecons_autotools.get_pos(user,2) + refresh_selection(pos1,pos2) +end) + + + + + \ No newline at end of file diff --git a/mesecons_autotools_tmp/tools/selection.lua b/mesecons_autotools_tmp/tools/selection.lua new file mode 100644 index 0000000..42271f8 --- /dev/null +++ b/mesecons_autotools_tmp/tools/selection.lua @@ -0,0 +1,135 @@ +function iterate_selection(pos1,pos2,action) + local xmin = math.min(pos1.x,pos2.x) + local ymin = math.min(pos1.y,pos2.y) + local zmin = math.min(pos1.z,pos2.z) + + local xmax = math.max(pos1.x,pos2.x) + local ymax = math.max(pos1.y,pos2.y) + local zmax = math.max(pos1.z,pos2.z) + + + for ix = xmin,xmax,1 do + for iy = ymin,ymax,1 do + for iz = zmin,zmax,1 do + action({x=ix,y=iy,z=iz}) + end + end + end + +end + +function iterate_list(list,action) + for _,v in ipairs(list) do + action(v) + end +end + + +-- not tested, not used +function copy_safe(pos1,pos2,shift_vector) + local buffor = {} + copy_to_buffor(pos1,pos2,buffor) + paste_from_buffor(shift_vector,buffor) +end + + +function copy(pos1,pos2, shift_vector) + iterate_selection(pos1,pos2, function(pos) + local node = minetest.get_node(pos) + local new_pos = vector.add(pos,shift_vector) + --minetest.set_node(new_pos, node) + mesecons_autotools.set_node(new_pos, node,"copy") + end) +end + +function copy_to_buffor(pos1,pos2,buffor) + iterate_selection(pos1,pos2, function(pos) + local node = minetest.get_node(pos) + table.insert(buffor, { pos = pos, node = node } ) + end) + +end + +function paste_from_buffor(shift_vector,buffor) + for _,v in pairs(buffor) do + local pos = v.pos + local node = v.node + + local new_pos = vector.add(pos,shift_vector) + + --minetest.set_node(new_pos,node) + mesecons_autotools.set_node(new_pos,node,"paste_from_buffor") + end + +end + + + +function delete(pos1,pos2) + iterate_selection(pos1,pos2, function(pos) + minetest.set_node(pos,{ name = "air" } ) + end) + +end + + + +function shift_selection(user,shift_vector) + if not mesecons_autotools.is_full_selection(user) then return end + + local pos = {} + pos[1] = mesecons_autotools.get_pos(user,1) + pos[2] = mesecons_autotools.get_pos(user,2) + + + mesecons_autotools.set_pos(user,1, vector.add(pos[1],shift_vector)) + mesecons_autotools.set_pos(user,2, vector.add(pos[2],shift_vector)) + + + +end + +function is_one_block(pos1,pos2) + if (pos1.x ~= pos2.x ) then return false end + if pos1.y ~= pos2.y then return false end + if pos1.z ~= pos2.z then return false end + return true +end + +function is_empty_selection(pos1,pos2) + local list = {} + iterate_selection(pos1,pos2, function(pos) + local node = minetest.get_node(pos) + local name = node.name + if name ~= "air" then + table.insert(list,1) + end + end) + for _,v in ipairs(list) do + if v == 1 then + return false + end + end + return true + +end + +function is_tower_selection(pos1,pos2) + if pos1.x == pos2.x and pos1.z == pos2.z then return true end + return false +end + + +function size_by_direction(pos1,pos2,direction) + local dx = math.abs(pos1.x - pos2.x) +1 + local dy = math.abs(pos1.y - pos2.y) +1 + local dz = math.abs(pos1.z - pos2.z) +1 + + if direction.x ~= 0 then return dx end + if direction.y ~= 0 then return dy end + if direction.z ~= 0 then return dz end + + return 0 +end + + diff --git a/mesecons_autotools_tmp/tools/test/test.lua b/mesecons_autotools_tmp/tools/test/test.lua new file mode 100644 index 0000000..8d2d9f9 --- /dev/null +++ b/mesecons_autotools_tmp/tools/test/test.lua @@ -0,0 +1,23 @@ + +mesecons_autotools.register_action("test","left","air", function(user,pos,rad) + +end) +mesecons_autotools.register_action("test","left","block", function(user,pos,rad) + local node = minetest.get_node(pos) + print ("rules[" .. dump(mesecon.get_any_rules(node)) .. "]" ) +end) + +mesecons_autotools.register_action("test","right","block", function(user,pos,rad) + +end) + +mesecons_autotools.register_action("test","right","air", function(user,pos,rad) + local pos1 = mesecons_autotools.get_pos(user,1) + local pos2 = mesecons_autotools.get_pos(user,2) + + print ("D=pos1="..dump(pos1) .. ", pos2="..dump(pos2)) +end) + + + + \ No newline at end of file diff --git a/mesecons_autotools_tmp/tools/white/white.lua b/mesecons_autotools_tmp/tools/white/white.lua new file mode 100644 index 0000000..2813b9a --- /dev/null +++ b/mesecons_autotools_tmp/tools/white/white.lua @@ -0,0 +1,151 @@ + +local function get_right_nr(user,rad) + local dir = radians_to_vectors(rad) + local left = dir.left + local right = dir.right + + local lpos = {} + lpos[1] = mesecons_autotools.get_pos(user,1) + lpos[2] = mesecons_autotools.get_pos(user,2) + local posrigth_number + + if lpos[1] == nil then return end + if lpos[2] == nil then return end + + + + + if right.x == 1 then + if lpos[1].x > lpos[2].x then + posrigth_number = 1 + else + posrigth_number = 2 + end + elseif right.x == -1 then + if lpos[1].x > lpos[2].x then + posrigth_number = 2 + else + posrigth_number = 1 + end + elseif right.z == 1 then + if lpos[1].z > lpos[2].z then + posrigth_number = 1 + else + posrigth_number =2 + end + elseif right.z == -1 then + if lpos[1].z > lpos[2].z then + posrigth_number = 2 + else + posrigth_number = 1 + end + + end + + return posrigth_number + +end + + +local function move_right(user,rad) + local dir = radians_to_vectors(rad) + local left = dir.left + local right = dir.right + + local right_nr = get_right_nr(user,rad) + local lpos = {} + lpos[1] = mesecons_autotools.get_pos(user,1) + lpos[2] = mesecons_autotools.get_pos(user,2) + + + if right == nil then return end + if right_nr == nil then return end + if lpos[1] == nil then return end + if lpos[2] == nil then return end + + + local new_pos = vector.add(lpos[right_nr], right) + mesecons_autotools.set_pos(user,right_nr, new_pos) + + -- Update + mesecons_autotools.render(user) + mesecons_autotools.zero_stack_counter(user) +end + +local function can_shrink(user,right) + local lpos = {} + lpos[1] = mesecons_autotools.get_pos(user,1) + lpos[2] = mesecons_autotools.get_pos(user,2) + + if right == nil then return end + if lpos[1] == nil then return end + if lpos[2] == nil then return end + + if right.x ~= 0 then + if lpos[1].x == lpos[2].x then + return false + else + return true + end + end + + if right.z ~= 0 then + if lpos[1].z == lpos[2].z then + return false + else + return true + end + end +end + + +local function move_left(user,rad) + local dir = radians_to_vectors(rad) + local left = dir.left + local right = dir.right + + + if can_shrink(user,right) == false then return end + + + local right_nr = get_right_nr(user,rad) + local lpos = {} + lpos[1] = mesecons_autotools.get_pos(user,1) + lpos[2] = mesecons_autotools.get_pos(user,2) + + + if left == nil then return end + if lpos[1] == nil then return end + if lpos[2] == nil then return end + + + + local new_pos = vector.add(lpos[right_nr], left) + mesecons_autotools.set_pos(user,right_nr, new_pos) + + -- Update + mesecons_autotools.render(user) + mesecons_autotools.zero_stack_counter(user) + +end + + +mesecons_autotools.register_action("white","left","air", function(user,pos,rad) + move_left(user,rad) + + +end) +mesecons_autotools.register_action("white","left","block", function(user,pos,rad) + move_left(user,rad) +end) + +mesecons_autotools.register_action("white","right","block", function(user,pos,rad) + move_right(user,rad) +end) + +mesecons_autotools.register_action("white","right","air", function(user,pos,rad) + move_right(user,rad) +end) + + + \ No newline at end of file diff --git a/mesecons_autotools_tmp/tools/white_down/white_down.lua b/mesecons_autotools_tmp/tools/white_down/white_down.lua new file mode 100644 index 0000000..9ee2f33 --- /dev/null +++ b/mesecons_autotools_tmp/tools/white_down/white_down.lua @@ -0,0 +1,72 @@ + +local function move_up(user) + local vector_up = vector.new(0,1,0) + + + local lpos = {} + lpos[1] = mesecons_autotools.get_pos(user,1) + lpos[2] = mesecons_autotools.get_pos(user,2) + local posdown_number + + if lpos[1] == nil then return end + if lpos[2] == nil then return end + + if lpos[1].y == lpos[2].y then return end + + if lpos[1].y < lpos[2].y then + posdown_number = 1 + else + posdown_number = 2 + end + + local new_pos = vector.add(lpos[posdown_number], vector_up) + mesecons_autotools.set_pos(user,posdown_number, new_pos) + + -- Update + mesecons_autotools.render(user) + mesecons_autotools.zero_stack_counter(user) + +end + +local function move_down(user) + local vector_up = vector.new(0,-1,0) + + + local lpos = {} + lpos[1] = mesecons_autotools.get_pos(user,1) + lpos[2] = mesecons_autotools.get_pos(user,2) + local posdown_number + + if lpos[1] == nil then return end + if lpos[2] == nil then return end + + + + if lpos[1].y < lpos[2].y then + posdown_number = 1 + else + posdown_number = 2 + end + + local new_pos = vector.add(lpos[posdown_number], vector_up) + mesecons_autotools.set_pos(user,posdown_number, new_pos) + + -- Update + mesecons_autotools.render(user) + mesecons_autotools.zero_stack_counter(user) +end + +mesecons_autotools.register_action("white_down","left","air", function(user,pos,rad) + move_down(user); +end) +mesecons_autotools.register_action("white_down","left","block", function(user,pos,rad) + move_down(user); +end) + +mesecons_autotools.register_action("white_down","right","block", function(user,pos,rad) + move_up(user); +end) + +mesecons_autotools.register_action("white_down","right","air", function(user,pos,rad) + move_up(user); +end) diff --git a/mesecons_autotools_tmp/tools/white_up/white_up.lua b/mesecons_autotools_tmp/tools/white_up/white_up.lua new file mode 100644 index 0000000..92cb15d --- /dev/null +++ b/mesecons_autotools_tmp/tools/white_up/white_up.lua @@ -0,0 +1,73 @@ + +local function move_up(user) + local vector_up = vector.new(0,1,0) + + + local lpos = {} + lpos[1] = mesecons_autotools.get_pos(user,1) + lpos[2] = mesecons_autotools.get_pos(user,2) + local posup_number + + + + + if lpos[1] == nil then return end + if lpos[2] == nil then return end + + if lpos[1].y > lpos[2].y then + posup_number = 1 + else + posup_number = 2 + end + + local new_pos = vector.add(lpos[posup_number], vector_up) + mesecons_autotools.set_pos(user,posup_number, new_pos) + + -- Update + mesecons_autotools.render(user) + mesecons_autotools.zero_stack_counter(user) + +end + +local function move_down(user) + local vector_up = vector.new(0,-1,0) + + + local lpos = {} + lpos[1] = mesecons_autotools.get_pos(user,1) + lpos[2] = mesecons_autotools.get_pos(user,2) + local posup_number + + if lpos[1] == nil then return end + if lpos[2] == nil then return end + + if lpos[1].y == lpos[2].y then return end + + if lpos[1].y > lpos[2].y then + posup_number = 1 + else + posup_number = 2 + end + + local new_pos = vector.add(lpos[posup_number], vector_up) + mesecons_autotools.set_pos(user,posup_number, new_pos) + + -- Update + mesecons_autotools.render(user) + mesecons_autotools.zero_stack_counter(user) +end + +mesecons_autotools.register_action("white_up","left","air", function(user,pos,rad) + move_down(user); +end) +mesecons_autotools.register_action("white_up","left","block", function(user,pos,rad) + move_down(user); +end) + +mesecons_autotools.register_action("white_up","right","block", function(user,pos,rad) + move_up(user); +end) + +mesecons_autotools.register_action("white_up","right","air", function(user,pos,rad) + move_up(user); +end) diff --git a/mesecons_autotools_tmp/tools/wire.lua b/mesecons_autotools_tmp/tools/wire.lua new file mode 100644 index 0000000..eec7a8e --- /dev/null +++ b/mesecons_autotools_tmp/tools/wire.lua @@ -0,0 +1,445 @@ + + +function get_node_from_pins(pins) + local t = "mesecons_extrawires:tjunction_off" + local c = "mesecons_extrawires:corner_off" + local w = "mesecons_insulated:insulated_off" + local a = "air" + local x = "mesecons_morewires:xjunction_off" + + -- {left,up,right,down node_name, rotation} + local list = { + -- empty + {0,0,0,0,a,0}, + + -- wire + {1,0,1,0,w,0}, + {0,1,0,1,w,1}, + + -- corner + {1,0,0,1,c,0}, + {1,1,0,0,c,1}, + {0,1,1,0,c,2}, + {0,0,1,1,c,3}, + + -- tjunction + {1,0,1,1,t,0}, + {1,1,0,1,t,1}, + {1,1,1,0,t,2}, + {0,1,1,1,t,3}, + + -- xjunction + {1,1,1,1,x,0}, + + -- starting wire + {1,0,0,0,w,0}, + {0,1,0,0,w,1}, + {0,0,1,0,w,0}, + {0,0,0,1,w,1}, + } + + local node_name = "air" + local rotate = 0 + for _,v in ipairs(list) do + if (pins[1] == v[1]) and + (pins[2] == v[2]) and + (pins[3] == v[3]) and + (pins[4] == v[4]) then + + node_name = v[5] + rotate = v[6] + + end + + end + + return { name = node_name, param2 = rotate } + + +end + +function get_pins_from_pos(pos,type) + local node = minetest.get_node(pos) + + local rs = {} + if type == "input" then + rs = mesecon.get_any_inputrules(node) + elseif type == "output" then + rs = mesecon.get_any_outputrules(node) + else + rs = mesecon.get_any_rules(node) + end + if rs == nil then + rs = {} + else + rs = mesecon.flattenrules (rs) + end + + + -- Filter only y=0 + local list = {} + for _,v in pairs(rs) do + if v.y == 0 then + if v.x ~= 0 and v.z == 0 then + table.insert(list,v) + end + if v.z ~= 0 and v.x == 0 then + table.insert(list,v) + end + + end + end + + -- constructiong pin structure + + local pins = {0,0,0,0} + for _,v in pairs(list) do + if v.x == 1 then pins[3] = 1 end + if v.x == -1 then pins[1] = 1 end + if v.z == 1 then pins[2] = 1 end + if v.z == -1 then pins[4] = 1 end + end + return pins +end + + + +local function dir_to_inx(d) + if d.x == 1 then return 3 end + if d.x == -1 then return 1 end + if d.z == 1 then return 2 end + if d.z == -1 then return 4 end + return 1 +end + +function get_pin_from_direction(direction) + return dir_to_inx(direction) +end + + + +local function neighbours_pins(pos) + local npins = {0,0,0,0} + for _,ix in ipairs({1,-1}) do + + local shift = { x=ix,y=0,z=0 } + local neigh = vector.add(pos,shift) + + local pins = get_pins_from_pos(neigh) + npins[ dir_to_inx( shift) ] = pins [ dir_to_inx( vector.multiply(shift,-1) ) ] + end + for _,iz in ipairs({1,-1}) do + + local shift = { x=0,y=0,z=iz } + local neigh = vector.add(pos,shift) + + local pins = get_pins_from_pos(neigh) + npins[ dir_to_inx( shift) ] = pins [ dir_to_inx( vector.multiply(shift,-1) ) ] + end + return npins +end + + +local function pins_and(pins1,pins2) + local pout = {} + for i=1,4,1 do + pout[i] = pins1[i] * pins2[i] + end + return pout + +end + + +local function start_node(pos,direction) + + local node = minetest.get_node(pos) + local name = node.name + + -- Only wires changed + local list = { + "mesecons_insulated:insulated_off","mesecons_insulated:insulated_on", + "mesecons_extrawires:corner_off","mesecons_extrawires:corner_on", + "mesecons_extrawires:tjunction_off", "mesecons_extrawires:tjunction_on", + "air" + } + + if not is_in_list(list,name) then return end + + + local npins = neighbours_pins(pos) + local mypins = get_pins_from_pos(pos) + local compins = pins_and(npins,mypins) + + -- adding wire + + if direction.x == 1 then + compins[3] = 1 + end + if direction.x == -1 then + compins[1] = 1 + end + + if direction.z == 1 then + compins[2] = 1 + end + if direction.z == -1 then + compins[4] = 1 + end + + --merge_wire(pos,direction) + local new_node = get_node_from_pins(compins) + + --minetest.set_node(pos,new_node) + mesecons_autotools.set_node(pos,new_node,"start_node") +end + +local function end_node(pos,direction) + --merge_wire(pos, vector.multiply(direction, -1)) + start_node(pos, vector.multiply(direction,-1)) +end + + +local function middle_node(pos, direction) + local node = minetest.get_node(pos) + local name = node.name + local param2 = node.param2 + + --minetest.set_node(pos,{name = "default:dirt"}) + --if true then return end + + if name ~= "mesecons_insulated:insulated_off" and + name ~= "mesecons_insulated:insulated_on" and + name ~= "air" then + return + end + + -- do crossing + if name == "air" then + local prm2 = 0 + if direction.z ~= 0 then + prm2 = 1 + end + if direction.x ~= 0 then + prm2 = 0 + end + --minetest.set_node(pos, { name ="mesecons_insulated:insulated_off", param2= 1 } ) + mesecons_autotools.set_node(pos, + {name ="mesecons_insulated:insulated_off", param2= prm2 }, + "middle_node") + + else + -- if nothing to do + if (direction.x ~= 0 ) and + ( param2 == 0 or param2 == 2 ) then + return + end + if (direction.z ~= 0 ) and + (param2 == 1 or param2 == 3 ) then + return + end + + --minetest.set_node(pos,{ name ="mesecons_extrawires:crossover_off" } ) + mesecons_autotools.set_node(pos, + { name ="mesecons_extrawires:crossover_off" }, + "middle_node") + + end +end + + +function create_straight_wire_n(pos,direction,size) + local current = pos + + -- first + start_node(current,direction) + current = vector.add(current,direction) + + -- middle + for i = 2, size-1, 1 do + middle_node(current,direction) + current = vector.add(current,direction) + + end + + -- last + end_node(current,direction) +end + +local function distance_taxi_metric(pos1,pos2) + local x1 = pos1.x + local x2 = pos2.x + + local dx = math.abs(x2-x1) + + local z1 = pos1.z + local z2 = pos2.z + + local dz = math.abs(z2-z1) + + return dz+dx+1 +end + + +function create_straight_wire(pos1,pos2) + + -- Check if straight line + if pos1.y ~= pos2.y then return end + if (pos1.x ~= pos2.x ) and (pos1.z ~= pos2.z) then return end + + + + -- Compute direction + local direction = { x =0,y=0,z=0} + if pos1.x == pos2.x then + if pos1.z < pos2.z then + direction.z = 1 + else + direction.z = -1 + end + end + if pos1.z == pos2.z then + if pos1.x < pos2.x then + direction.x = 1 + else + direction.x = -1 + end + end + + + -- Compute size + local size = distance_taxi_metric(pos1,pos2) + + + create_straight_wire_n(pos1,direction,size) + return true +end + +function hop_pos(pos,pin) + local new_pos = { x = pos.x, y = pos.y, z = pos.z } + + if pin == 1 then + new_pos.x = pos.x - 1 + end + if pin == 2 then + new_pos.z = pos.z + 1 + end + if pin == 3 then + new_pos.x = pos.x + 1 + end + if pin == 4 then + new_pos.z = pos.z -1 + end + + return new_pos +end + +function flip_pin(pin) + if pin == 1 then return 3 end + if pin == 2 then return 4 end + if pin == 3 then return 1 end + if pin == 4 then return 2 end +end + +-- TODO: refactor +function hop_pin(pin) + if pin == 1 then return 3 end + if pin == 2 then return 4 end + if pin == 3 then return 1 end + if pin == 4 then return 2 end +end + + + +local function delete(p,pin) + local node = minetest.get_node(p) + local name = node.name + + if name == "mesecons_insulated:insulated_off" or + name == "mesecons_insulated:insulated_on" or + name == "mesecons_extrawires:corner_off" or + name == "mesecons_extrawires:corner_on" + then + + -- continue deleting + local node_pins = get_pins_from_pos(p) + + -- not connected to anything + if node_pins[pin] == 0 then return end + + node_pins[pin] = 0 + for i=1,4,1 do + if node_pins[i] == 1 then + --minetest.set_node(p,{name="air"}) + mesecons_autotools.set_node(p,{name="air"},"delete") + delete(hop_pos(p,i),hop_pin(i)) + end + end + + + + elseif name == "mesecons_extrawires:crossover_off" or + name == "mesecons_extrawires:crossover_on" or + name == "mesecons_extrawires:crossover_10" or + name == "mesecons_extrawires:crossover_01" then + + -- continue deleting + + local node_pins = get_pins_from_pos(p) + node_pins[pin] = 0 + node_pins[hop_pin(pin)] = 0 + + local new_node = get_node_from_pins(node_pins) + -- minetest.set_node(p,new_node) + mesecons_autotools.set_node(p,new_node,"delete_crossover") + delete(hop_pos(p,hop_pin(pin)),pin) + + + + elseif name == "mesecons_extrawires:tjunction_off" or + name == "mesecons_extrawires:tjunction_on" or + name == "mesecons_morewires:xjunction_off" or + name == "mesecons_morewires:xjunction_on" then + + -- end of wire + + local node_pins = get_pins_from_pos(p) + + -- not connected to anything + if node_pins[pin] == 0 then return end + + node_pins[pin] = 0 + local new_node = get_node_from_pins(node_pins) + --minetest.set_node(p,new_node) + mesecons_autotools.set_node(p,new_node,"delete_end") + + + + else + -- do nothing (other blocks) + end +end + + +function delete_node(pos) + local node = minetest.get_node(pos) + + local pins = get_pins_from_pos(pos) + + --minetest.set_node(pos,{name="air"}) + mesecons_autotools.set_node(pos,{name="air"},"delete") + + for i=1,4,1 do + if pins[i] == 1 then + delete(hop_pos(pos,i),hop_pin(i)) + end + end + + +end + + + + + + + diff --git a/mesecons_autotools_tmp/tools/yellow/yellow.lua b/mesecons_autotools_tmp/tools/yellow/yellow.lua new file mode 100644 index 0000000..5b16542 --- /dev/null +++ b/mesecons_autotools_tmp/tools/yellow/yellow.lua @@ -0,0 +1,218 @@ + +function can_move_into(sel,direction) + local front_wall = front_wall_by_direction(sel,direction) + + local pos1 = vector.new(front_wall.pos1) + local pos2 = vector.new(front_wall.pos2) + + pos1 = vector.add(pos1,direction) + pos2 = vector.add(pos2,direction) + + local shifted ={pos1=pos1,pos2=pos2} + + local result = {} + iterate_selection(pos1,pos2, function(pos) + local node = minetest.get_node(pos) + local name = node.name + + if name == "air" then + return + end + if + name == "mesecons_insulated:insulated_off" or + name == "mesecons_insulated:insulated_on" then + + local pins = get_pins_from_pos(pos) + local dpin = get_pin_from_direction(direction) + if pins[dpin] == 1 then + return + else + table.insert(result,false) + return + end + + + end + return table.insert(result,false) + end) + + for _,v in pairs(result) do + if v == false then + return false + end + end + + return true +end + + +function is_pos_connected(pos,direction) + local node = minetest.get_node(pos) + + local pins = get_pins_from_pos(pos) + local dpin = get_pin_from_direction(direction) + + -- no sticking out + if pins[dpin] == 0 then return false end + + + local neigh_pos + local neigh_pins + local connect_pin + + -- checking pos[out] <-> neigh[in] + + pins = get_pins_from_pos(pos,"output") + dpin = get_pin_from_direction(direction) + neigh_pos = hop_pos(pos,dpin) + neigh_pins = get_pins_from_pos(neigh_pos,"input") + connect_pin = neigh_pins[ hop_pin(dpin) ] + + if connect_pin == 1 then + return true + end + + -- checking pos[in] <-> neidth[out] + + pins = get_pins_from_pos(pos,"input") + dpin = get_pin_from_direction(direction) + neigh_pos = hop_pos(pos,dpin) + neigh_pins = get_pins_from_pos(neigh_pos,"output") + connect_pin = neigh_pins[ hop_pin(dpin) ] + + if connect_pin == 1 then + return true + end + + + + return false + + + +--[[ + local neigh_pos = hop_pos(pos,dpin) + local neigh_pins = get_pins_from_pos(neigh_pos) + local connect_pin = neigh_pins[ hop_pin(dpin) ] + + if connect_pin == 1 then + return true + else + return false + end +]]-- +end + + +function generate_tail_wires(back_wall,direction) + local pos1 = back_wall.pos1 + local pos2 = back_wall.pos2 + + local back_direction = vector.multiply(direction,-1) + local bd_pin = get_pin_from_direction(back_direction) + + + local list_pos = {} + iterate_selection(pos1,pos2, function(pos) + if is_pos_connected(pos,back_direction) then + table.insert(list_pos,pos) + end + end) + return list_pos +end + +function put_tail_wires(list,direction) + local node = {} + node.name = "mesecons_insulated:insulated_off" + node.param2 = 0 + for _,pos in ipairs(list) do + if direction.x ~= 0 then + node.param2 = 0 + else + node.param2 = 1 + end + --minetest.set_node(pos,node) + mesecons_autotools.set_node(pos,node,"put_tail_wires") + + end + +end + + +function get_back_wall(sel,direction) + return front_wall_by_direction(sel, vector.multiply(direction,-1)) +end + + + + +local function move_selection(user,rad,click) + local dir = radians_to_vectors(rad) + local left = dir.left + local right = dir.right + + local pos = {} + pos[1] = mesecons_autotools.get_pos(user,1) + pos[2] = mesecons_autotools.get_pos(user,2) + + + if pos[1] == nil then return end + if pos[2] == nil then return end + + + -- compute shift vector + + local direction = {} + if click == "left" then + direction = left + else + direction = right + end + + local buffor = {} + local tail = {} + local sel = { pos1=pos[1], pos2=pos[2]} + local back_wall = get_back_wall(sel,direction) + + if not can_move_into(sel,direction) then return end + + copy_to_buffor(pos[1],pos[2],buffor) + tail = generate_tail_wires(back_wall,direction) + + + delete(pos[1],pos[2]) + paste_from_buffor(direction,buffor) + put_tail_wires(tail,direction) + + shift_selection(user,direction) + + + -- Update + mesecons_autotools.render(user) + mesecons_autotools.zero_stack_counter(user) + mesecons_autotools.zero_stack_direction(user) +end + + + + + + +mesecons_autotools.register_action("yellow","left","air", function(user,pos,rad) + move_selection(user,rad,"left") +end) +mesecons_autotools.register_action("yellow","left","block", function(user,pos,rad) + move_selection(user,rad,"left") +end) + +mesecons_autotools.register_action("yellow","right","block", function(user,pos,rad) + move_selection(user,rad,"right") +end) + +mesecons_autotools.register_action("yellow","right","air", function(user,pos,rad) + move_selection(user,rad,"right") +end) + + + + \ No newline at end of file diff --git a/mesecons_autotools_tmp/tools/yellow_updown/yellow_updown.lua b/mesecons_autotools_tmp/tools/yellow_updown/yellow_updown.lua new file mode 100644 index 0000000..6765274 --- /dev/null +++ b/mesecons_autotools_tmp/tools/yellow_updown/yellow_updown.lua @@ -0,0 +1,73 @@ + + + + +local function move_selection(user,rad,click) + local pos = {} + pos[1] = mesecons_autotools.get_pos(user,1) + pos[2] = mesecons_autotools.get_pos(user,2) + + + if pos[1] == nil then return end + if pos[2] == nil then return end + + + -- compute shift vector + + local shift_vector = {} + if click == "up" then + shift_vector = {x=0,y=1,z=0} + else + shift_vector = {x=0,y=-1,z=0} + end + + local new_pos1 = vector.add(pos[1],shift_vector) + local new_pos2 = vector.add(pos[2],shift_vector) + + + --[[ + if not is_empty_selection(new_pos1,new_pos2) then + return + end + ]]-- + local sel = { pos1=pos[1], pos2=pos[2]} + if not can_move_into(sel,shift_vector) then return end + + + local buffor = {} + copy_to_buffor(pos[1],pos[2],buffor) + delete(pos[1],pos[2]) + paste_from_buffor(shift_vector,buffor) + + shift_selection(user,shift_vector) + + + -- Update + mesecons_autotools.render(user) + mesecons_autotools.zero_stack_counter(user) + mesecons_autotools.zero_stack_direction(user) + + +end + + + + + + +mesecons_autotools.register_action("yellow_updown","left","air", function(user,pos,rad) + move_selection(user,rad,"down") +end) +mesecons_autotools.register_action("yellow_updown","left","block", function(user,pos,rad) + move_selection(user,rad,"down") +end) + +mesecons_autotools.register_action("yellow_updown","right","block", function(user,pos,rad) + move_selection(user,rad,"up") +end) + +mesecons_autotools.register_action("yellow_updown","right","air", function(user,pos,rad) + move_selection(user,rad,"up") +end) + + \ No newline at end of file