Merge (latest playerplus)

This commit is contained in:
kay27 2021-04-26 00:31:26 +00:00
commit 36bd151398

View file

@ -1,69 +1,28 @@
local S = minetest.get_translator("mcl_fireworks") local S = minetest.get_translator("mcl_fireworks")
player_rocketing = {} local player_rocketing = {}
local help = S("Flight Duration:") local tt_help = S("Flight Duration:")
local description = S("Firework Rocket") local description = S("Firework Rocket")
local rocket_sound = function()
minetest.sound_play("mcl_fireworks_rocket")
end
minetest.register_craftitem("mcl_fireworks:rocket_1", { local function register_rocket(n, duration, force)
minetest.register_craftitem("mcl_fireworks:rocket_" .. n, {
description = description, description = description,
_tt_help = help.." 1", _tt_help = tt_help .. " " .. duration,
inventory_image = "mcl_fireworks_rocket.png", inventory_image = "mcl_fireworks_rocket.png",
stack_max = 64, stack_max = 64,
on_use = function(itemstack, user, pointed_thing) on_use = function(itemstack, user, pointed_thing)
local torso = user:get_inventory():get_stack("armor", 3) local elytra = mcl_playerplus.elytra[user]
if torso and torso:get_name() == "mcl_armor:elytra" and player_rocketing[user] ~= true then if elytra.active and elytra.rocketing <= 0 then
player_rocketing[user] = true elytra.rocketing = duration
minetest.after(2.2, function()
player_rocketing[user] = false
end)
itemstack:take_item() itemstack:take_item()
--user:add_player_velocity(vector.multiply(user:get_look_dir(), 20)) minetest.sound_play("mcl_fireworks_rocket", {pos = user:get_pos()})
rocket_sound()
end end
return itemstack return itemstack
end, end,
}) })
minetest.register_craftitem("mcl_fireworks:rocket_2", {
description = description,
_tt_help = help.." 2",
inventory_image = "mcl_fireworks_rocket.png",
stack_max = 64,
on_use = function(itemstack, user, pointed_thing)
local torso = user:get_inventory():get_stack("armor", 3)
if torso and torso:get_name() == "mcl_armor:elytra" and player_rocketing[user] ~= true then
player_rocketing[user] = true
minetest.after(4.5, function()
player_rocketing[user] = false
end)
itemstack:take_item()
--user:add_player_velocity(vector.multiply(user:get_look_dir(), 20))
rocket_sound()
end end
return itemstack
end,
})
minetest.register_craftitem("mcl_fireworks:rocket_3", { register_rocket(1, 2.2, 10)
description = description, register_rocket(2, 4.5, 20)
_tt_help = help.." 3", register_rocket(3, 6, 30)
inventory_image = "mcl_fireworks_rocket.png",
stack_max = 64,
on_use = function(itemstack, user, pointed_thing)
local torso = user:get_inventory():get_stack("armor", 3)
if torso and torso:get_name() == "mcl_armor:elytra" and player_rocketing[user] ~= true then
player_rocketing[user] = true
minetest.after(6, function()
player_rocketing[user] = false
end)
itemstack:take_item()
--user:add_player_velocity(vector.multiply(user:get_look_dir(), 20))
rocket_sound()
end
return itemstack
end,
})