Merge pull request 'fixed-elytra' (#343) from FlamingRCCars/MineClone5-FlamingRCCars:fixed-elytra into master

Reviewed-on: MineClone5/MineClone5#343
This commit is contained in:
PrairieWind 2022-06-17 21:42:16 +00:00
commit d33aba9355
2 changed files with 17 additions and 8 deletions

View File

@ -209,11 +209,12 @@ minetest.register_tool("mcl_armor:elytra", {
_doc_items_longdesc = mcl_armor.longdesc, _doc_items_longdesc = mcl_armor.longdesc,
_doc_items_usagehelp = mcl_armor.usage, _doc_items_usagehelp = mcl_armor.usage,
inventory_image = "mcl_armor_inv_elytra.png", inventory_image = "mcl_armor_inv_elytra.png",
groups = {armor = 1, non_combat_armor = 1, armor_torso = 1, non_combat_torso = 1, mcl_armor_uses = 10, enchantability = 1}, groups = {armor = 1, non_combat_torso = 1, armor_torso = 1, mcl_armor_uses = 10, enchantability = 1},
sounds = { sounds = {
_mcl_armor_equip = "mcl_armor_equip_leather", _mcl_armor_equip = "mcl_armor_equip_leather",
_mcl_armor_unequip = "mcl_armor_unequip_leather", _mcl_armor_unequip = "mcl_armor_unequip_leather",
}, },
_repair_material = "mcl_mobitems:leather",
on_place = mcl_armor.equip_on_use, on_place = mcl_armor.equip_on_use,
on_secondary_use = mcl_armor.equip_on_use, on_secondary_use = mcl_armor.equip_on_use,
_mcl_armor_element = "torso", _mcl_armor_element = "torso",

View File

@ -229,7 +229,6 @@ local function set_bone_position_conditional(player,b,p,r) --bone,position,rotat
end end
player:set_bone_position(b,p,r) player:set_bone_position(b,p,r)
end end
minetest.register_globalstep(function(dtime) minetest.register_globalstep(function(dtime)
time = time + dtime time = time + dtime
@ -255,7 +254,7 @@ minetest.register_globalstep(function(dtime)
local wielded_def = wielded:get_definition() local wielded_def = wielded:get_definition()
local c_x, c_y = unpack(player_collision(player)) local c_x, c_y = unpack(player_collision(player))
--[[ --[[
if player_velocity.x + player_velocity.y < .5 and c_x + c_y > 0 then if player_velocity.x + player_velocity.y < .5 and c_x + c_y > 0 then
local add_velocity = player.add_player_velocity or player.add_velocity local add_velocity = player.add_player_velocity or player.add_velocity
@ -278,11 +277,20 @@ minetest.register_globalstep(function(dtime)
local fly_pos = player:get_pos() local fly_pos = player:get_pos()
local fly_node = minetest.get_node({x = fly_pos.x, y = fly_pos.y - 0.5, z = fly_pos.z}).name local fly_node = minetest.get_node({x = fly_pos.x, y = fly_pos.y - 0.5, z = fly_pos.z}).name
local elytra = mcl_playerplus.elytra[name] local elytra = mcl_playerplus.elytra[name]
elytra.inv = player:get_inventory():get_stack("armor", 3):get_name() == "mcl_armor:elytra"
elytra.active = player:get_inventory():get_stack("armor", 3):get_name() == "mcl_armor:elytra" elytra.enchanted = player:get_inventory():get_stack("armor", 3):get_name() == "mcl_armor:elytra_enchanted"
and not player:get_attach() if not elytra.active then
and (elytra.active or control.jump and player_velocity.y < -6) elytra.active = player:get_inventory():get_stack("armor", 3):get_name() == "mcl_armor:elytra_enchanted" and not player:get_attach() and (elytra.active or control.jump and player_velocity.y < -6) and (fly_node == "air" or fly_node == "ignore")
and (fly_node == "air" or fly_node == "ignore") if not elytra.active then
elytra.active = player:get_inventory():get_stack("armor", 3):get_name() == "mcl_armor:elytra" and not player:get_attach() and (elytra.active or control.jump and player_velocity.y < -6) and (fly_node == "air" or fly_node == "ignore")
end
end
if not (fly_node == "air" or fly_node == "ignore") then
elytra.active = false
end
if (not elytra.inv and not elytra.enchanted) then
elytra.active = false
end
if elytra.active then if elytra.active then
mcl_player.player_set_animation(player, "fly") mcl_player.player_set_animation(player, "fly")