mirror of
https://codeberg.org/tenplus1/mobs_redo.git
synced 2025-01-11 10:20:21 +01:00
mob egg sanity checks
This commit is contained in:
parent
4634288124
commit
92c899e6a4
4
api.lua
4
api.lua
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user