1
0
Fork 0
MineClone2_For_PRs/mods/ITEMS/mcl_fireworks/register.lua

29 lines
862 B
Lua
Raw Normal View History

2021-04-13 22:33:34 +02:00
local S = minetest.get_translator("mcl_fireworks")
2021-04-17 19:34:23 +02:00
local tt_help = S("Flight Duration:")
2021-04-13 22:33:34 +02:00
local description = S("Firework Rocket")
2021-04-17 19:34:23 +02:00
local function register_rocket(n, duration, force)
minetest.register_craftitem("mcl_fireworks:rocket_" .. n, {
description = description,
_tt_help = tt_help .. " " .. duration,
inventory_image = "mcl_fireworks_rocket.png",
stack_max = 64,
on_use = function(itemstack, user, pointed_thing)
local elytra = mcl_playerplus.elytra[user]
if elytra.active and elytra.rocketing <= 0 then
elytra.rocketing = duration
if not minetest.is_creative_enabled(user:get_player_name()) then
itemstack:take_item()
end
2021-04-17 19:34:23 +02:00
minetest.sound_play("mcl_fireworks_rocket", {pos = user:get_pos()})
end
return itemstack
end,
})
end
2021-04-13 22:33:34 +02:00
2021-04-17 19:34:23 +02:00
register_rocket(1, 2.2, 10)
register_rocket(2, 4.5, 20)
register_rocket(3, 6, 30)