Fix elytra crash when flying over unknown node

This commit is contained in:
ancientmarinerdev 2023-06-19 17:51:02 +01:00
parent 7d51519f4d
commit 8b9b4b00e5
1 changed files with 2 additions and 1 deletions

View File

@ -239,10 +239,11 @@ minetest.register_globalstep(function(dtime)
elytra.speed = 1 - (direction.y/2 + 0.5) elytra.speed = 1 - (direction.y/2 + 0.5)
end end
local fly_node_walkable = minetest.registered_nodes[fly_node] and minetest.registered_nodes[fly_node].walkable
elytra.active = minetest.get_item_group(player:get_inventory():get_stack("armor", 3):get_name(), "elytra") ~= 0 elytra.active = minetest.get_item_group(player:get_inventory():get_stack("armor", 3):get_name(), "elytra") ~= 0
and not parent and not parent
and (elytra.active or (is_just_jumped and player_velocity.y < -0)) and (elytra.active or (is_just_jumped and player_velocity.y < -0))
and ((not minetest.registered_nodes[fly_node].walkable) or fly_node == "ignore") and ((not fly_node_walkable) or fly_node == "ignore")
if elytra.active then if elytra.active then
if is_just_jumped then -- move the player up when they start flying to give some clearance if is_just_jumped then -- move the player up when they start flying to give some clearance