Merge (latest playerplus)
commit
51ebe823b0
|
@ -1,5 +1,7 @@
|
||||||
local S = minetest.get_translator("mcl_fireworks")
|
local S = minetest.get_translator("mcl_fireworks")
|
||||||
|
|
||||||
|
player_rocketing = {}
|
||||||
|
|
||||||
local help = S("Flight Duration:")
|
local help = S("Flight Duration:")
|
||||||
local description = S("Firework Rocket")
|
local description = S("Firework Rocket")
|
||||||
local rocket_sound = function()
|
local rocket_sound = function()
|
||||||
|
@ -12,10 +14,14 @@ minetest.register_craftitem("mcl_fireworks:rocket_1", {
|
||||||
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)
|
||||||
itemstack:take_item()
|
|
||||||
local torso = user:get_inventory():get_stack("armor", 3)
|
local torso = user:get_inventory():get_stack("armor", 3)
|
||||||
if torso and torso:get_name() == "mcl_armor:elytra" then
|
if torso and torso:get_name() == "mcl_armor:elytra" and player_rocketing[user] ~= true then
|
||||||
user:add_player_velocity(vector.multiply(user:get_look_dir(), 20))
|
player_rocketing[user] = true
|
||||||
|
minetest.after(2.2, function()
|
||||||
|
player_rocketing[user] = false
|
||||||
|
end)
|
||||||
|
itemstack:take_item()
|
||||||
|
--user:add_player_velocity(vector.multiply(user:get_look_dir(), 20))
|
||||||
rocket_sound()
|
rocket_sound()
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
|
@ -28,10 +34,14 @@ minetest.register_craftitem("mcl_fireworks:rocket_2", {
|
||||||
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)
|
||||||
itemstack:take_item()
|
|
||||||
local torso = user:get_inventory():get_stack("armor", 3)
|
local torso = user:get_inventory():get_stack("armor", 3)
|
||||||
if torso and torso:get_name() == "mcl_armor:elytra" then
|
if torso and torso:get_name() == "mcl_armor:elytra" and player_rocketing[user] ~= true then
|
||||||
user:add_player_velocity(vector.multiply(user:get_look_dir(), 30))
|
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()
|
rocket_sound()
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
|
@ -43,11 +53,15 @@ minetest.register_craftitem("mcl_fireworks:rocket_3", {
|
||||||
_tt_help = help.." 3",
|
_tt_help = help.." 3",
|
||||||
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, player)
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
itemstack:take_item()
|
|
||||||
local torso = user:get_inventory():get_stack("armor", 3)
|
local torso = user:get_inventory():get_stack("armor", 3)
|
||||||
if torso and torso:get_name() == "mcl_armor:elytra" then
|
if torso and torso:get_name() == "mcl_armor:elytra" and player_rocketing[user] ~= true then
|
||||||
user:add_player_velocity(vector.multiply(user:get_look_dir(), 40))
|
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()
|
rocket_sound()
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
|
|
Loading…
Reference in New Issue