mirror of
https://github.com/mt-mods/homedecor_modpack.git
synced 2025-07-20 06:10:23 +02:00
Version MFF.
This commit is contained in:
23
computer/tetris.lua
Normal file → Executable file
23
computer/tetris.lua
Normal file → Executable file
@ -1,6 +1,3 @@
|
||||
|
||||
local S = homedecor_i18n.gettext
|
||||
|
||||
local shapes = {
|
||||
{ { x = {0, 1, 0, 1}, y = {0, 0, 1, 1} } },
|
||||
|
||||
@ -38,7 +35,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;"..minetest.formspec_escape(S("New Game")).."]"
|
||||
.."button[3.5,3;2,2;new;New Game]"
|
||||
|
||||
local formsize = "size[5.9,5.7]"
|
||||
local boardx, boardy = 0, 0
|
||||
@ -74,7 +71,7 @@ local function step(pos, fields)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local t = minetest.deserialize(meta:get_string("tetris"))
|
||||
|
||||
local function new_game(p)
|
||||
local function new_game(pos)
|
||||
local nex = math.random(7)
|
||||
|
||||
t = {
|
||||
@ -87,7 +84,7 @@ local function step(pos, fields)
|
||||
x=4, y=0, rot=1
|
||||
}
|
||||
|
||||
local timer = minetest.get_node_timer(p)
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
timer:set(0.3, 0)
|
||||
end
|
||||
|
||||
@ -244,7 +241,7 @@ local function step(pos, fields)
|
||||
end
|
||||
|
||||
minetest.register_node("computer:tetris_arcade", {
|
||||
description=S("Tetris Arcade"),
|
||||
description="Tetris Arcade",
|
||||
drawtype = "mesh",
|
||||
mesh = "tetris_arcade.obj",
|
||||
tiles = {"tetris_arcade.png"},
|
||||
@ -262,8 +259,7 @@ 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;"..minetest.formspec_escape(S("New Game")).."]"
|
||||
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)
|
||||
@ -274,14 +270,9 @@ minetest.register_node("computer:tetris_arcade", {
|
||||
end,
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local pos = pointed_thing.above
|
||||
if minetest.is_protected(pos, placer:get_player_name()) or
|
||||
minetest.is_protected({x=pos.x, y=pos.y+1, z=pos.z}, placer:get_player_name()) then
|
||||
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(), S("No room for place the Arcade!"))
|
||||
return itemstack
|
||||
end
|
||||
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)
|
||||
|
Reference in New Issue
Block a user