diff --git a/computer/init.lua b/computer/init.lua index 58b2589c..faa42a92 100644 --- a/computer/init.lua +++ b/computer/init.lua @@ -1,100 +1,100 @@ -computer = { }; +computer = { } -computer.register = function ( name, def ) - local nodename = name; - if (name:sub(1, 1) == ":") then name = name:sub(2); end - local modname, basename = name:match("^([^:]+):(.*)"); - local TEXPFX = modname.."_"..basename.."_"; - local ONSTATE = modname..":"..basename; - local OFFSTATE = modname..":"..basename.."_off"; - local def = def; +computer.register = function (name, def) + local nodename = name + if (name:sub(1, 1) == ":") then name = name:sub(2) end + local modname, basename = name:match("^([^:]+):(.*)") + local TEXPFX = modname.."_"..basename.."_" + local ONSTATE = modname..":"..basename + local OFFSTATE = modname..":"..basename.."_off" + local def = def minetest.register_node(ONSTATE, { - drawtype = "nodebox"; - paramtype = "light"; - paramtype2 = "facedir"; - description = def.description; - groups = { snappy=2, choppy=2, oddly_breakable_by_hand=2 }; + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + description = def.description, + groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2}, tiles = { TEXPFX.."tp.png", TEXPFX.."bt.png", TEXPFX.."rt.png", TEXPFX.."lt.png", TEXPFX.."bk.png", - TEXPFX.."ft.png", - }; - node_box = def.node_box; - selection_box = def.node_box; - on_rightclick = function ( pos, node, clicker, itemstack) + TEXPFX.."ft.png" + }, + node_box = def.node_box, + selection_box = def.node_box, + on_rightclick = function (pos, node, clicker, itemstack) if (def.on_turn_off) then - if (def.on_turn_off(pos, node, clicker, itemstack)) then return; end + if (def.on_turn_off(pos, node, clicker, itemstack)) then return end end - node.name = OFFSTATE; - minetest.set_node(pos, node); - end; - }); + node.name = OFFSTATE + minetest.set_node(pos, node) + end + }) minetest.register_node(OFFSTATE, { - drawtype = "nodebox"; - paramtype = "light"; - paramtype2 = "facedir"; - groups = { snappy=2, choppy=2, oddly_breakable_by_hand=2, - not_in_creative_inventory=1 }; + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1}, tiles = { (TEXPFX.."tp"..(def.tiles_off.top and "_off" or "")..".png"), (TEXPFX.."bt"..(def.tiles_off.bottom and "_off" or "")..".png"), (TEXPFX.."rt"..(def.tiles_off.right and "_off" or "")..".png"), (TEXPFX.."lt"..(def.tiles_off.left and "_off" or "")..".png"), (TEXPFX.."bk"..(def.tiles_off.back and "_off" or "")..".png"), - (TEXPFX.."ft"..(def.tiles_off.front and "_off" or "")..".png"), - }; - node_box = def.node_box_off or def.node_box; - selection_box = def.node_box_off or def.node_box; - on_rightclick = function ( pos, node, clicker, itemstack) + (TEXPFX.."ft"..(def.tiles_off.front and "_off" or "")..".png") + }, + node_box = def.node_box_off or def.node_box, + selection_box = def.node_box_off or def.node_box, + on_rightclick = function (pos, node, clicker, itemstack) if (def.on_turn_on) then - if (def.on_turn_on(pos, node, clicker, itemstack)) then return; end + if (def.on_turn_on(pos, node, clicker, itemstack)) then return end end - node.name = ONSTATE; - minetest.set_node(pos, node); - end; - drop = ONSTATE; - }); + node.name = ONSTATE + minetest.set_node(pos, node) + end, + drop = ONSTATE + }) end -computer.register_handheld = function ( name, def ) - local nodename = name; - if (name:sub(1, 1) == ":") then name = name:sub(2); end - local modname, basename = name:match("^([^:]+):(.*)"); - local TEXPFX = modname.."_"..basename.."_inv"; - local ONSTATE = modname..":"..basename; - local OFFSTATE = modname..":"..basename.."_off"; - local on_use = def.on_use; +computer.register_handheld = function (name, def) + local nodename = name + if (name:sub(1, 1) == ":") then name = name:sub(2) end + local modname, basename = name:match("^([^:]+):(.*)") + local TEXPFX = modname.."_"..basename.."_inv" + local ONSTATE = modname..":"..basename + local OFFSTATE = modname..":"..basename.."_off" + local on_use = def.on_use minetest.register_craftitem(ONSTATE, { - description = def.description; - inventory_image = TEXPFX..".png"; - wield_image = TEXPFX..".png"; - }); + description = def.description, + inventory_image = TEXPFX..".png", + wield_image = TEXPFX..".png" + }) end -computer.pixelnodebox = function ( size, boxes ) - local fixed = { }; - local i, box; +computer.pixelnodebox = function (size, boxes) + local fixed = { } + local i, box for i, box in ipairs(boxes) do - local x, y, z, w, h, l = unpack(box); + local x, y, z, w, h, l = unpack(box) fixed[#fixed + 1] = { (x / size) - 0.5, (y / size) - 0.5, (z / size) - 0.5, ((x + w) / size) - 0.5, ((y + h) / size) - 0.5, - ((z + l) / size) - 0.5, - }; + ((z + l) / size) - 0.5 + } end return { - type = "fixed"; - fixed = fixed; - }; + type = "fixed", + fixed = fixed + } end -local MODPATH = minetest.get_modpath("computer"); -dofile(MODPATH.."/computers.lua"); -dofile(MODPATH.."/miscitems.lua"); -dofile(MODPATH.."/recipes.lua"); +local MODPATH = minetest.get_modpath("computer") +dofile(MODPATH.."/computers.lua") +dofile(MODPATH.."/miscitems.lua") +dofile(MODPATH.."/recipes.lua") +dofile(MODPATH.."/tetris.lua") diff --git a/computer/models/tetris_arcade.obj b/computer/models/tetris_arcade.obj new file mode 100644 index 00000000..66d651f6 --- /dev/null +++ b/computer/models/tetris_arcade.obj @@ -0,0 +1,34 @@ +# Blender v2.72 (sub 0) OBJ File: '' +# www.blender.org +mtllib vending_machine.mtl +o Cube +v 0.499998 -0.499998 -0.499998 +v 0.499998 -0.499998 0.499998 +v -0.499998 -0.499998 0.499998 +v -0.499998 -0.499998 -0.499998 +v 0.499998 1.499994 -0.499998 +v 0.499998 1.499994 0.499998 +v -0.499998 1.499994 0.499998 +v -0.499998 1.499994 -0.499998 +vt 0.250050 0.250050 +vt 0.000100 0.250050 +vt 0.000100 0.000100 +vt 0.250050 0.000100 +vt 0.250050 0.749950 +vt 0.250050 0.999900 +vt 0.000100 0.999900 +vt 0.000100 0.749950 +vt 0.999900 0.250049 +vt 0.999900 0.749949 +vt 0.749950 0.749950 +vt 0.749950 0.250050 +vt 0.500000 0.749950 +vt 0.500000 0.250050 +usemtl Material +s off +f 1/1 2/2 3/3 4/4 +f 5/5 8/6 7/7 6/8 +f 1/1 5/5 6/8 2/2 +f 2/9 6/10 7/11 3/12 +f 3/12 7/11 8/13 4/14 +f 5/5 1/1 4/14 8/13 diff --git a/computer/recipes.lua b/computer/recipes.lua index e4335a1c..243292af 100644 --- a/computer/recipes.lua +++ b/computer/recipes.lua @@ -3,132 +3,141 @@ -- License is WTFPL (see README.txt). minetest.register_craft({ - output = "computer:shefriendSOO"; + output = "computer:shefriendSOO", recipe = { - { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", }, - { "homedecor:plastic_sheeting", "default:glass", "homedecor:plastic_sheeting", }, - { "homedecor:plastic_sheeting", "default:wood", "homedecor:plastic_sheeting", }, - }; -}); + { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }, + { "homedecor:plastic_sheeting", "default:glass", "homedecor:plastic_sheeting" }, + { "homedecor:plastic_sheeting", "default:wood", "homedecor:plastic_sheeting" } + } +}) minetest.register_craft({ - output = "computer:slaystation"; + output = "computer:slaystation", recipe = { - { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", }, - { "homedecor:plastic_sheeting", "default:wood", "homedecor:plastic_sheeting", }, - }; -}); + { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }, + { "homedecor:plastic_sheeting", "default:wood", "homedecor:plastic_sheeting" } + } +}) minetest.register_craft({ - output = "computer:vanio"; + output = "computer:vanio", recipe = { - { "homedecor:plastic_sheeting", "", "", }, + { "homedecor:plastic_sheeting", "", "" }, { "default:glass", "", "" }, - { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", }, - }; -}); + { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" } + } +}) minetest.register_craft({ - output = "computer:specter"; + output = "computer:specter", recipe = { - { "", "", "homedecor:plastic_sheeting", }, - { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", }, - { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", }, - }; -}); + { "", "", "homedecor:plastic_sheeting" }, + { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }, + { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" } + } +}) minetest.register_craft({ - output = "computer:slaystation2"; + output = "computer:slaystation2", recipe = { - { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", }, - { "homedecor:plastic_sheeting", "default:steel_ingot", "homedecor:plastic_sheeting", }, - }; -}); + { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }, + { "homedecor:plastic_sheeting", "default:steel_ingot", "homedecor:plastic_sheeting" } + } +}) minetest.register_craft({ - output = "computer:admiral64"; + output = "computer:admiral64", recipe = { - { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", }, - { "default:wood", "default:wood", "default:wood", }, - }; -}); + { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }, + { "default:wood", "default:wood", "default:wood" } + } +}) minetest.register_craft({ - output = "computer:admiral128"; + output = "computer:admiral128", recipe = { - { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", }, - { "default:steel_ingot", "default:steel_ingot", "default:steel_ingot", }, - }; -}); + { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }, + { "default:steel_ingot", "default:steel_ingot", "default:steel_ingot" } + } +}) minetest.register_craft({ - output = "computer:wee"; + output = "computer:wee", recipe = { - { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", }, - { "homedecor:plastic_sheeting", "default:copper_ingot", "homedecor:plastic_sheeting", }, - }; -}); + { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }, + { "homedecor:plastic_sheeting", "default:copper_ingot", "homedecor:plastic_sheeting" } + } +}) minetest.register_craft({ - output = "computer:piepad"; + output = "computer:piepad", recipe = { - { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", }, - { "homedecor:plastic_sheeting", "default:glass", "homedecor:plastic_sheeting", }, - }; -}); + { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }, + { "homedecor:plastic_sheeting", "default:glass", "homedecor:plastic_sheeting" } + } +}) --new stuff minetest.register_craft({ - output = "computer:monitor"; + output = "computer:monitor", recipe = { - { "homedecor:plastic_sheeting", "default:glass","", }, - { "homedecor:plastic_sheeting", "default:glass","", }, - { "homedecor:plastic_sheeting", "default:mese_crystal_fragment", "homedecor:plastic_sheeting", }, - }; -}); + { "homedecor:plastic_sheeting", "default:glass","" }, + { "homedecor:plastic_sheeting", "default:glass","" }, + { "homedecor:plastic_sheeting", "default:mese_crystal_fragment", "homedecor:plastic_sheeting" } + } +}) minetest.register_craft({ - output = "computer:router"; + output = "computer:router", recipe = { - { "default:steel_ingot","","", }, - { "default:steel_ingot" ,"homedecor:plastic_sheeting", "homedecor:plastic_sheeting", }, - { "default:mese_crystal_fragment","homedecor:plastic_sheeting", "homedecor:plastic_sheeting", }, - }; -}); + { "default:steel_ingot","","" }, + { "default:steel_ingot" ,"homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }, + { "default:mese_crystal_fragment","homedecor:plastic_sheeting", "homedecor:plastic_sheeting" } + } +}) minetest.register_craft({ - output = "computer:tower"; + output = "computer:tower", recipe = { - { "homedecor:plastic_sheeting", "default:steel_ingot", "homedecor:plastic_sheeting", }, - { "homedecor:plastic_sheeting", "default:mese_crystal", "homedecor:plastic_sheeting", }, - { "homedecor:plastic_sheeting", "default:steel_ingot", "homedecor:plastic_sheeting", }, - }; -}); + { "homedecor:plastic_sheeting", "default:steel_ingot", "homedecor:plastic_sheeting" }, + { "homedecor:plastic_sheeting", "default:mese_crystal", "homedecor:plastic_sheeting" }, + { "homedecor:plastic_sheeting", "default:steel_ingot", "homedecor:plastic_sheeting" } + } +}) minetest.register_craft({ - output = "computer:printer"; + output = "computer:printer", recipe = { - { "homedecor:plastic_sheeting", "default:steel_ingot","", }, - { "homedecor:plastic_sheeting", "default:mese_crystal", "homedecor:plastic_sheeting", }, - { "homedecor:plastic_sheeting", "default:coal_lump", "homedecor:plastic_sheeting", }, - }; -}); + { "homedecor:plastic_sheeting", "default:steel_ingot","" }, + { "homedecor:plastic_sheeting", "default:mese_crystal", "homedecor:plastic_sheeting" }, + { "homedecor:plastic_sheeting", "default:coal_lump", "homedecor:plastic_sheeting" } + } +}) minetest.register_craft({ - output = "computer:printer"; + output = "computer:printer", recipe = { - { "homedecor:plastic_sheeting", "default:steel_ingot","", }, - { "homedecor:plastic_sheeting", "default:mese_crystal", "homedecor:plastic_sheeting", }, - { "homedecor:plastic_sheeting", "dye:black", "homedecor:plastic_sheeting", }, - }; -}); + { "homedecor:plastic_sheeting", "default:steel_ingot","" }, + { "homedecor:plastic_sheeting", "default:mese_crystal", "homedecor:plastic_sheeting" }, + { "homedecor:plastic_sheeting", "dye:black", "homedecor:plastic_sheeting", } + } +}) minetest.register_craft({ - output = "computer:server"; + output = "computer:server", recipe = { { "computer:tower", "computer:tower", "computer:tower", }, - { "computer:tower", "computer:tower", "computer:tower", }, - { "computer:tower", "computer:tower", "computer:tower", }, - }; -}); + { "computer:tower", "computer:tower", "computer:tower" }, + { "computer:tower", "computer:tower", "computer:tower" } + } +}) + +minetest.register_craft({ + output = "computer:tetris_arcade", + recipe = { + { "homedecor:plastic_sheeting", "homedecor:power_crystal", "homedecor:plastic_sheeting", }, + { "dye:black", "default:glass", "dye:black" }, + { "homedecor:plastic_sheeting", "homedecor:power_crystal", "homedecor:plastic_sheeting" } + } +}) diff --git a/computer/tetris.lua b/computer/tetris.lua new file mode 100644 index 00000000..ecfb7186 --- /dev/null +++ b/computer/tetris.lua @@ -0,0 +1,282 @@ +local shapes = { + { { x = {0, 1, 0, 1}, y = {0, 0, 1, 1} } }, + + { { x = {1, 1, 1, 1}, y = {0, 1, 2, 3} }, + { x = {0, 1, 2, 3}, y = {1, 1, 1, 1} } }, + + { { x = {0, 0, 1, 1}, y = {0, 1, 1, 2} }, + { x = {1, 2, 0, 1}, y = {0, 0, 1, 1} } }, + + { { x = {1, 0, 1, 0}, y = {0, 1, 1, 2} }, + { x = {0, 1, 1, 2}, y = {0, 0, 1, 1} } }, + + { { x = {1, 2, 1, 1}, y = {0, 0, 1, 2} }, + { x = {0, 1, 2, 2}, y = {1, 1, 1, 2} }, + { x = {1, 1, 0, 1}, y = {0, 1, 2, 2} }, + { x = {0, 0, 1, 2}, y = {0, 1, 1, 1} } }, + + { { x = {1, 1, 1, 2}, y = {0, 1, 2, 2} }, + { x = {0, 1, 2, 0}, y = {1, 1, 1, 2} }, + { x = {0, 1, 1, 1}, y = {0, 0, 1, 2} }, + { x = {0, 1, 2, 2}, y = {1, 1, 1, 0} } }, + + { { x = {1, 0, 1, 2}, y = {0, 1, 1, 1} }, + { x = {1, 1, 1, 2}, y = {0, 1, 2, 1} }, + { x = {0, 1, 2, 1}, y = {1, 1, 1, 2} }, + { x = {0, 1, 1, 1}, y = {1, 0, 1, 2} } } } + +local colors = { "computer_cyan.png", "computer_magenta.png", "computer_red.png", + "computer_blue.png", "computer_green.png", "computer_orange.png", "computer_yellow.png" } + +local background = "image[0,0;3.55,6.66;computer_black.png]" +local buttons = "button[3,4.5;0.6,0.6;left;◄]" + .."button[3.6,4.5;0.6,0.6;rotateleft;L]" + .."button[4.2,4.5;0.6,0.6;down;V]" + .."button[4.2,5.3;0.6,0.6;drop;▼]" + .."button[4.8,4.5;0.6,0.6;rotateright;R]" + .."button[5.4,4.5;0.6,0.6;right;►]" + .."button[3.5,3;2,2;new;New Game]" + +local formsize = "size[5.9,5.7]" +local boardx, boardy = 0, 0 +local sizex, sizey, size = 0.29, 0.29, 0.31 + +local comma = "," +local semi = ";" +local close = "]" + +local concat = table.concat +local insert = table.insert + +local draw_shape = function(id, x, y, rot, posx, posy) + local d = shapes[id][rot] + local scr = {} + local ins = #scr + + for i=1,4 do + local tmp = { "image[", + (d.x[i]+x)*sizex+posx, comma, + (d.y[i]+y)*sizey+posy, semi, + size, comma, size, semi, + colors[id], close } + + ins = ins + 1 + scr[ins] = concat(tmp) + end + + return concat(scr) +end + +local function step(pos, fields) + local meta = minetest.get_meta(pos) + local t = minetest.deserialize(meta:get_string("tetris")) + + local function new_game(pos) + local nex = math.random(7) + + t = { + board = {}, + boardstring = "", + previewstring = draw_shape(nex, 0, 0, 1, 4, 1), + score = 0, + cur = math.random(7), + nex = nex, + x=4, y=0, rot=1 + } + + local timer = minetest.get_node_timer(pos) + timer:set(0.3, 0) + end + + local function update_boardstring() + local scr = {} + local ins = #scr + + for i, line in pairs(t.board) do + for _, tile in pairs(line) do + local tmp = { "image[", + tile[1]*sizex+boardx, comma, + i*sizey+boardy, semi, + size, comma, size, semi, + colors[tile[2]], close } + + ins = ins + 1 + scr[ins] = concat(tmp) + end + end + + t.boardstring = concat(scr) + end + + local function add() + local d = shapes[t.cur][t.rot] + + for i=1,4 do + local l = d.y[i] + t.y + if not t.board[l] then t.board[l] = {} end + insert(t.board[l], {d.x[i] + t.x, t.cur}) + end + end + + local function scroll(l) + for i=l, 1, -1 do + t.board[i] = t.board[i-1] or {} + end + end + + local function check_lines() + for i, line in pairs(t.board) do + if #line >= 10 then + scroll(i) + t.score = t.score + 20 + end + end + end + + local function check_position(x, y, rot) + local d = shapes[t.cur][rot] + + for i=1,4 do + local cx, cy = d.x[i]+x, d.y[i]+y + + if cx < 0 or cx > 9 or cy < 0 or cy > 19 then + return false + end + + for _, tile in pairs(t.board[ cy ] or {}) do + if tile[1] == cx then return false end + end + end + + return true + end + + local function stuck() + if check_position(t.x, t.y+1, t.rot) then return false end + return true + end + + local function tick() + if stuck() then + if t.y <= 0 then + return false end + add() + check_lines() + update_boardstring() + t.cur, t.nex = t.nex, math.random(7) + t.x, t.y, t.rot = 4, 0, 1 + t.previewstring = draw_shape(t.nex, 0, 0, 1, 4.1, 0.6) + else + t.y = t.y + 1 + end + return true + end + + local function move(dx, dy) + local newx, newy = t.x+dx, t.y+dy + if not check_position(newx, newy, t.rot) then return end + t.x, t.y = newx, newy + end + + local function rotate(dr) + local no = #(shapes[t.cur]) + local newrot = (t.rot+dr) % no + + if newrot<1 then newrot = newrot+no end + if not check_position(t.x, t.y, newrot) then return end + t.rot = newrot + end + + local function key() + if fields.left then + move(-1, 0) + end + if fields.rotateleft then + rotate(-1) + end + if fields.down then + t.score = t.score + 1 + move(0, 1) + end + if fields.drop then + while not stuck() do + t.score = t.score + 2 + move(0, 1) + end + end + if fields.rotateright then + rotate(1) + end + if fields.right then + move(1, 0) + end + end + + local run = true + + if fields then + if fields.new then + new_game(pos) + else + key(fields) + end + else + run = tick() + end + + if t ~= nil then + local scr = { formsize, background, + t.boardstring, t.previewstring, + draw_shape(t.cur, t.x, t.y, t.rot, boardx, boardy), + "label[3.8,0.1;Next...]label[3.8,2.7;Score: ", + t.score, close, buttons } + + + meta:set_string("formspec", concat(scr) + ..default.gui_bg..default.gui_bg_img..default.gui_slots) + meta:set_string("tetris", minetest.serialize(t)) + end + + return run +end + +local arcade = { + description="Tetris Arcade", + drawtype = "mesh", + mesh = "tetris_arcade.obj", + tiles = {"tetris_arcade.png"}, + paramtype = "light", + paramtype2 = "facedir", + groups = {snappy=3}, + selection_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, 1.5, 0.5} + }, + collision_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, 1.5, 0.5} + }, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", formsize.."button[2,2.5;2,2;new;New Game]" + ..default.gui_bg..default.gui_bg_img..default.gui_slots) + end, + on_timer = function(pos) + return step(pos, nil) + end, + on_receive_fields = function(pos, formanme, fields, sender) + step(pos, fields) + end, + on_place = function(itemstack, placer, pointed_thing) + local pos = pointed_thing.above + if minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "air" then + minetest.chat_send_player(placer:get_player_name(), "No room for place the Arcade!") + return end + local dir = placer:get_look_dir() + local node = {name="computer:tetris_arcade", param1=0, param2 = minetest.dir_to_facedir(dir)} + minetest.set_node(pos, node) + itemstack:take_item() + end +} + +minetest.register_node("computer:tetris_arcade", arcade) diff --git a/computer/textures/computer_black.png b/computer/textures/computer_black.png new file mode 100644 index 00000000..e4e017f4 Binary files /dev/null and b/computer/textures/computer_black.png differ diff --git a/computer/textures/computer_blue.png b/computer/textures/computer_blue.png new file mode 100644 index 00000000..a5a59772 Binary files /dev/null and b/computer/textures/computer_blue.png differ diff --git a/computer/textures/computer_cyan.png b/computer/textures/computer_cyan.png new file mode 100644 index 00000000..b2c037ea Binary files /dev/null and b/computer/textures/computer_cyan.png differ diff --git a/computer/textures/computer_green.png b/computer/textures/computer_green.png new file mode 100644 index 00000000..444cce54 Binary files /dev/null and b/computer/textures/computer_green.png differ diff --git a/computer/textures/computer_magenta.png b/computer/textures/computer_magenta.png new file mode 100644 index 00000000..e5b9d044 Binary files /dev/null and b/computer/textures/computer_magenta.png differ diff --git a/computer/textures/computer_orange.png b/computer/textures/computer_orange.png new file mode 100644 index 00000000..27792f7c Binary files /dev/null and b/computer/textures/computer_orange.png differ diff --git a/computer/textures/computer_red.png b/computer/textures/computer_red.png new file mode 100644 index 00000000..adcd6272 Binary files /dev/null and b/computer/textures/computer_red.png differ diff --git a/computer/textures/computer_yellow.png b/computer/textures/computer_yellow.png new file mode 100644 index 00000000..29537acc Binary files /dev/null and b/computer/textures/computer_yellow.png differ diff --git a/computer/textures/tetris_arcade.png b/computer/textures/tetris_arcade.png new file mode 100644 index 00000000..dfd176df Binary files /dev/null and b/computer/textures/tetris_arcade.png differ