mob egg sanity checks

This commit is contained in:
TenPlus1 2020-04-07 08:41:41 +01:00
parent 4634288124
commit 92c899e6a4
1 changed files with 4 additions and 0 deletions

View File

@ -3846,6 +3846,8 @@ function mobs:register_egg(mob, desc, background, addegg, no_creative)
local mob = minetest.add_entity(pos, mob, data)
local ent = mob:get_luaentity()
if not ent then return end -- sanity check
-- set owner if not a monster
if ent.type ~= "monster" then
ent.owner = placer:get_player_name()
@ -3891,6 +3893,8 @@ function mobs:register_egg(mob, desc, background, addegg, no_creative)
local mob = minetest.add_entity(pos, mob)
local ent = mob:get_luaentity()
if not ent then return end -- sanity check
-- don't set owner if monster or sneak pressed
if ent.type ~= "monster"
and not placer:get_player_control().sneak then