1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
local blocks = {
{"floor","Floor"},
{"dash","Dash"},
{"side","Side"},
{"corner","Corner"},
}
for i in ipairs(blocks) do
local itm = blocks[i][1]
local des = blocks[i][2]
minetest.register_node("pong:"..itm,{
description = des,
tiles = {
"pong_"..itm..".png",
"pong_floor.png",
"pong_floor.png",
"pong_floor.png",
"pong_side.png",
"pong_floor.png",
},
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 3},
})
end
minetest.register_node("pong:doora", {
description = "Pong Door",
tiles = {
"pong_floor.png",
"pong_floor.png",
"pong_floor.png",
"pong_floor.png",
"pong_door.png",
"pong_door.png",
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 3},
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.4375, 0.5, 0.5, -0.3125}
}
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.4375, 0.5, 1.5, -0.3125}
}
},
after_place_node = function(pos, placer, itemstack, pointed_thing)
local node = minetest.get_node(pos)
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name="pong:doorb",param2=node.param2})
end,
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
local timer = minetest.get_node_timer(pos)
local par2 = node.param2 + 1
if par2 == 4 then
par2 = 0
end
minetest.set_node(pos,{name="pong:doora",param2 = par2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name="pong:doorb",param2 = par2})
timer:start(3)
end,
on_timer = function(pos, elapsed)
local node = minetest.get_node(pos)
local par2 = node.param2
if par2 == 0 then
par2 = 3
else par2 = node.param2 -1
end
minetest.set_node(pos,{name="pong:doora",param2 = par2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name="pong:doorb",param2 = par2})
end,
})
minetest.register_node("pong:doorb", {
--description = "Pong Door",
tiles = {
"pong_floor.png",
"pong_floor.png",
"pong_floor.png",
"pong_floor.png",
"pong_door.png",
"pong_door.png",
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 3},
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.4375, 0.5, 0.5, -0.3125}
}
},
selection_box = {
type = "fixed",
fixed = {
{0, 0, 0, 0, 0, 0}
}
},
})
minetest.register_node("pong:block",{
description = "Pong",
--inventory_image = "pong_inv.png",
tiles = {
"pong_floor.png",
"pong_floor.png",
"pong_floor.png",
"pong_floor.png",
"pong_floor.png",
"pong_dash.png",
},
drawtype = "normal",
paramtype = "light",
paramtype2 = "facedir",
light_source = 8,
groups = {cracky = 1},
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
local schem = minetest.get_modpath("pong").."/schems/pong.mts"
minetest.place_schematic({x=pos.x,y=pos.y-1,z=pos.z},schem,0, "air", true)
end,
})
|