#198 Fix a crash, step 5

This commit is contained in:
kay27 2022-02-14 01:41:26 +00:00
parent 8b441a8156
commit e9e3479fb3
3 changed files with 8 additions and 8 deletions

View File

@ -10,7 +10,8 @@ local function register_rocket(n, duration, force)
inventory_image = "mcl_fireworks_rocket.png",
stack_max = 64,
on_use = function(itemstack, user, pointed_thing)
local elytra = mcl_playerplus.elytra[user]
if not user:is_player then return end
local elytra = mcl_playerplus.elytra[user:get_player_name()]
if elytra.active and elytra.rocketing <= 0 then
elytra.rocketing = duration
if not minetest.is_creative_enabled(user:get_player_name()) then

View File

@ -39,7 +39,7 @@ local function update_player(player_object)
local feet_y, head_y = floor(pos.y-0.1), floor(pos.y + 1.49)
if mcl_playerplus.elytra then
local elytra = mcl_playerplus.elytra[player_object]
local elytra = mcl_playerplus.elytra[name]
if elytra and elytra.active then
return
end

View File

@ -275,7 +275,7 @@ minetest.register_globalstep(function(dtime)
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 elytra = mcl_playerplus.elytra[player]
local elytra = mcl_playerplus.elytra[name]
elytra.active = player:get_inventory():get_stack("armor", 3):get_name() == "mcl_armor:elytra"
and not player:get_attach()
@ -625,15 +625,14 @@ minetest.register_globalstep(function(dtime)
end)
-- set to blank on join (for 3rd party mods)
minetest.register_on_joinplayer(function(player)
local name = player:get_player_name()
minetest.register_on_authplayer(function(name, ip, is_success)
if not is_success then return end
mcl_playerplus_internal[name] = {
lastPos = nil,
swimDistance = 0,
jump_cooldown = -1, -- Cooldown timer for jumping, we need this to prevent the jump exhaustion to increase rapidly
}
mcl_playerplus.elytra[player] = {active = false, rocketing = 0}
mcl_playerplus.elytra[name] = {active = false, rocketing = 0}
end)
-- clear when player leaves
@ -641,7 +640,7 @@ minetest.register_on_leaveplayer(function(player)
local name = player:get_player_name()
mcl_playerplus_internal[name] = nil
mcl_playerplus.elytra[player] = nil
mcl_playerplus.elytra[name] = nil
end)
-- Don't change HP if the player falls in the water or through End Portal: