Merge remote-tracking branch 'mcl2/master' into testing

This commit is contained in:
kay27 2021-12-10 03:47:25 +04:00
commit 06b482b309
2 changed files with 8 additions and 6 deletions

View File

@ -31,12 +31,14 @@ local spawn_children_on_die = function(child_mob, children_count, spawn_distance
speed_penalty = 0.5
end
local mob = minetest.add_entity(newpos, child_mob)
if (not mother_stuck) then
mob:set_velocity(vector.multiply(dir, eject_speed * speed_penalty))
if mob then
if (not mother_stuck) then
mob:set_velocity(vector.multiply(dir, eject_speed * speed_penalty))
end
mob:set_yaw(angle - math.pi/2)
table.insert(children, mob)
angle = angle + (math.pi*2)/children_count
end
mob:set_yaw(angle - math.pi/2)
table.insert(children, mob)
angle = angle + (math.pi*2)/children_count
end
-- If mother was murdered, children attack the killer after 1 second
if self.state == "attack" then

View File

@ -350,7 +350,7 @@ minetest.register_abm({
local inv = meta:get_inventory()
for _,object in pairs(minetest.get_objects_inside_radius(pos, 2)) do
if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" then
if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" and not object:get_luaentity()._removed then
if inv and inv:room_for_item("main", ItemStack(object:get_luaentity().itemstring)) then
-- Item must get sucked in when the item just TOUCHES the block above the hopper
-- This is the reason for the Y calculation.