From 47fa43825cafb6b0829c6a3f0f504be9c98c6a67 Mon Sep 17 00:00:00 2001 From: cora Date: Wed, 25 May 2022 16:57:16 +0200 Subject: [PATCH] count only mobs for cramming --- mods/ENTITIES/mcl_mobs/api.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 645eea86e0..6b2cff0e37 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -2975,10 +2975,14 @@ end local function check_entity_cramming(self) local p = self.object:get_pos() local oo = minetest.get_objects_inside_radius(p,1) - local clear = #oo < ENTITY_CRAMMING_MAX - local ncram = {} + local mobs = {} for _,o in pairs(oo) do local l = o:get_luaentity() + if l and l.is_mob and l.health > 0 then table.insert(mobs,l) end + end + local clear = #mobs < ENTITY_CRAMMING_MAX + local ncram = {} + for _,l in pairs(mobs) do if l then if clear then l.cram = nil