mirror of
https://github.com/minetest-mods/jumping.git
synced 2024-11-22 23:23:44 +01:00
increade by punch, decrease by rightclick
This commit is contained in:
parent
ea83c64fee
commit
c7223539f6
13
init.lua
13
init.lua
@ -19,11 +19,21 @@ local cushionbox = {
|
|||||||
|
|
||||||
local trampoline_punch = function(pos, node)
|
local trampoline_punch = function(pos, node)
|
||||||
local id = string.sub(node.name, #node.name)
|
local id = string.sub(node.name, #node.name)
|
||||||
|
if id < "6" then
|
||||||
id = id + 1
|
id = id + 1
|
||||||
if id == 7 then id = 1 end
|
|
||||||
minetest.add_node(pos, {name = string.sub(node.name, 1, #node.name - 1)..id})
|
minetest.add_node(pos, {name = string.sub(node.name, 1, #node.name - 1)..id})
|
||||||
minetest.get_meta(pos):set_string("infotext", "Bouncy Level: "..id)
|
minetest.get_meta(pos):set_string("infotext", "Bouncy Level: "..id)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local power_decrease = function(pos, node)
|
||||||
|
local id = string.sub(node.name, #node.name)
|
||||||
|
if id > "1" then
|
||||||
|
id = id - 1
|
||||||
|
minetest.add_node(pos, {name = string.sub(node.name, 1, #node.name - 1)..id})
|
||||||
|
minetest.get_meta(pos):set_string("infotext", "Bouncy Level: "..id)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
for i = 1, 6 do
|
for i = 1, 6 do
|
||||||
minetest.register_node("jumping:trampoline"..i, {
|
minetest.register_node("jumping:trampoline"..i, {
|
||||||
@ -36,6 +46,7 @@ for i = 1, 6 do
|
|||||||
minetest.get_meta(pos):set_string("infotext", "Bouncy Level: "..i)
|
minetest.get_meta(pos):set_string("infotext", "Bouncy Level: "..i)
|
||||||
end,
|
end,
|
||||||
on_punch = trampoline_punch,
|
on_punch = trampoline_punch,
|
||||||
|
on_rightclick = power_decrease,
|
||||||
tiles = {
|
tiles = {
|
||||||
"jumping_trampoline_top.png",
|
"jumping_trampoline_top.png",
|
||||||
"jumping_trampoline_bottom.png",
|
"jumping_trampoline_bottom.png",
|
||||||
|
Loading…
Reference in New Issue
Block a user