Closed mightyjoe781 closed 2 years ago
I tried this fix, please review if you feel this is correct then i can open up a PR :) in file mobs/fire_dragon.lua and ice_dragon.lua. NOTE : this fix preserves dragon in world even though player logs out.
if self.shoulder_mounted then
local player = minetest.get_player_by_name(self.owner)
if not player then
self.object:set_detach()
self.shoulder_mounted = mobkit.remember(self, "shoulder_mounted", false)
self.object:set_properties({
physical = true,
collide_with_objects = true
})
end
if player and player:get_player_control().sneak == true
or self.age > 4 then
self.object:set_detach()
self.shoulder_mounted = mobkit.remember(self, "shoulder_mounted", false)
self.object:set_properties({
physical = true,
collide_with_objects = true
})
end
end
This logic checks if the dragon is attached to a player but player is nil (cause he logged out) then we detach the dragon and place it in world.
Been fixed in latest commit for 2.0 releases
Server stack traceback
Issue can be replicated by hatching a baby dragon and putting it on your shoulder and then leaving the server, global step runs and tries to get the player which is null because he left.
Note : I tried adding null check to error lines and that fixes the crash but issue is that dragon disappears when the player rejoins.