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
|
local trampolinebox = {
type = "fixed",
fixed = {
{-0.5, -0.2, -0.5, 0.5, 0, 0.5},
{-0.5, -0.5, -0.5, -0.4, -0.2, -0.4},
{ 0.4, -0.5, -0.5, 0.5, -0.2, -0.4},
{ 0.4, -0.5, 0.4, 0.5, -0.2, 0.5},
{-0.5, -0.5, 0.4, -0.4, -0.2, 0.5},
}
}
local cushionbox = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.3, 0.5},
}
}
local trampoline_punch = function(pos, node)
local id = string.sub(node.name, #node.name)
id = id + 1
if id == 7 then id = 1 end
minetest.add_node(pos, {name = string.sub(node.name, 1, #node.name - 1)..id})
end
for i = 1, 6 do
minetest.register_node("jumping:trampoline"..i, {
description = "Trampoline",
drawtype = "nodebox",
node_box = trampolinebox,
selection_box = trampolinebox,
paramtype = "light",
on_punch = trampoline_punch,
tiles = {
"jumping_trampoline_top.png",
"jumping_trampoline_bottom.png",
"jumping_trampoline_sides.png^jumping_trampoline_sides_overlay"..i..".png"
},
groups = {dig_immediate=2, bouncy=20+i*20, fall_damage_add_percent=-70},
})
end
minetest.register_node("jumping:cushion", {
description = "Cushion",
drawtype = "nodebox",
node_box = cushionbox,
selection_box = cushionbox,
paramtype = "light",
tiles = {
"jumping_cushion_tb.png",
"jumping_cushion_tb.png",
"jumping_cushion_sides.png"
},
groups = {dig_immediate=2, disable_jump=1, fall_damage_add_percent=-100},
})
minetest.register_craft({
output = "jumping:trampoline1",
recipe = {
{"default:wood", "default:wood", "default:wood"},
{"default:leaves", "default:leaves", "default:leaves"},
{"default:stick", "default:stick", "default:stick"}
}
})
minetest.register_craft({
output = "jumping:cushion",
recipe = {
{"default:leaves", "default:leaves", "default:leaves"},
{"default:leaves", "default:leaves", "default:leaves"},
{"default:stick", "default:stick", "default:stick"}
}
})
|