mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-12-23 08:29:34 +01:00
count only mobs for cramming
This commit is contained in:
parent
af7dc0fb8f
commit
47fa43825c
1 changed files with 6 additions and 2 deletions
|
@ -2975,10 +2975,14 @@ end
|
||||||
local function check_entity_cramming(self)
|
local function check_entity_cramming(self)
|
||||||
local p = self.object:get_pos()
|
local p = self.object:get_pos()
|
||||||
local oo = minetest.get_objects_inside_radius(p,1)
|
local oo = minetest.get_objects_inside_radius(p,1)
|
||||||
local clear = #oo < ENTITY_CRAMMING_MAX
|
local mobs = {}
|
||||||
local ncram = {}
|
|
||||||
for _,o in pairs(oo) do
|
for _,o in pairs(oo) do
|
||||||
local l = o:get_luaentity()
|
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 l then
|
||||||
if clear then
|
if clear then
|
||||||
l.cram = nil
|
l.cram = nil
|
||||||
|
|
Loading…
Reference in a new issue