From 39f5cba27eef35877c91291f518974f34130fcb6 Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Tue, 31 Jan 2017 19:39:31 -0500 Subject: Huge update - lots of mods: areas, biome_lib, blox, bobblocks, boost_cart, homedecor, mobs, coloredwood, ilights, inbox, item_tweaks, moreblocks, moreores, pipeworks, plasticbox, signs_lib, stainedglass, roads, unifieddyes, vines, worldedit, xban2, maybe some others I didn't think about ;-) --- computer/tetris.lua | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) (limited to 'computer/tetris.lua') diff --git a/computer/tetris.lua b/computer/tetris.lua index 5f0b71c..1683dcc 100644 --- a/computer/tetris.lua +++ b/computer/tetris.lua @@ -1,6 +1,9 @@ + +local S = homedecor_i18n.gettext + 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} } }, @@ -35,7 +38,7 @@ local buttons = "button[3,4.5;0.6,0.6;left;<]" .."button[4.2,5.3;0.6,0.6;drop;V]" .."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]" + .."button[3.5,3;2,2;new;"..minetest.formspec_escape(S("New Game")).."]" local formsize = "size[5.9,5.7]" local boardx, boardy = 0, 0 @@ -70,8 +73,8 @@ 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 function new_game(p) local nex = math.random(7) t = { @@ -81,10 +84,10 @@ local function step(pos, fields) score = 0, cur = math.random(7), nex = nex, - x=4, y=0, rot=1 + x=4, y=0, rot=1 } - local timer = minetest.get_node_timer(pos) + local timer = minetest.get_node_timer(p) timer:set(0.3, 0) end @@ -99,7 +102,7 @@ local function step(pos, fields) i*sizey+boardy, semi, size, comma, size, semi, colors[tile[2]], close } - + ins = ins + 1 scr[ins] = concat(tmp) end @@ -138,9 +141,9 @@ local function step(pos, fields) 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 + return false end for _, tile in pairs(t.board[ cy ] or {}) do @@ -157,7 +160,7 @@ local function step(pos, fields) end local function tick() - if stuck() then + if stuck() then if t.y <= 0 then return false end add() @@ -170,7 +173,7 @@ local function step(pos, fields) t.y = t.y + 1 end return true - end + end local function move(dx, dy) local newx, newy = t.x+dx, t.y+dy @@ -225,10 +228,10 @@ local function step(pos, fields) end if t then - local scr = { formsize, background, + 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: ", + "label[3.8,0.1;Next...]label[3.8,2.7;Score: ", t.score, close, buttons } @@ -241,7 +244,7 @@ local function step(pos, fields) end minetest.register_node("computer:tetris_arcade", { - description="Tetris Arcade", + description=S("Tetris Arcade"), drawtype = "mesh", mesh = "tetris_arcade.obj", tiles = {"tetris_arcade.png"}, @@ -259,7 +262,8 @@ minetest.register_node("computer:tetris_arcade", { }, on_construct = function(pos) local meta = minetest.get_meta(pos) - meta:set_string("formspec", formsize.."button[2,2.5;2,2;new;New Game]" + meta:set_string("formspec", formsize + .."button[2,2.5;2,2;new;"..minetest.formspec_escape(S("New Game")).."]" ..default.gui_bg..default.gui_bg_img..default.gui_slots) end, on_timer = function(pos) @@ -275,7 +279,7 @@ minetest.register_node("computer:tetris_arcade", { return itemstack end 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!") + minetest.chat_send_player(placer:get_player_name(), S("No room for place the Arcade!")) return itemstack end local dir = placer:get_look_dir() -- cgit v1.2.3