Merge pull request 'Fix 2 Enderman crashes' (#2610) from fix_endertp_crash into master

Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/2610
This commit is contained in:
cora 2022-09-02 22:13:58 +00:00
commit d81d7febbf

View File

@ -345,7 +345,8 @@ mcl_mobs:register_mob("mobs_mc:enderman", {
end
end
else --if not attacking try to tp to the dark
if minetest.get_node_light(enderpos) > minetest.LIGHT_MAX then
local light = minetest.get_node_light(enderpos)
if light and light > minetest.LIGHT_MAX then
self:teleport(nil)
end
end
@ -617,6 +618,7 @@ mcl_mobs:register_mob("mobs_mc:enderman", {
})
minetest.register_on_leaveplayer(function(player)
if not spawners[player] then return end
for _,s in pairs(spawners[player]) do
minetest.delete_particlespawner(s)
end