mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-19 09:31:07 +01:00
entity cramming: clean up check logic
This commit is contained in:
parent
fb4f21cba0
commit
87f50d6423
1 changed files with 10 additions and 9 deletions
|
@ -2975,20 +2975,21 @@ local cramming_damage = 3
|
|||
local function check_entity_cramming(self)
|
||||
local p = self.object:get_pos()
|
||||
local oo = minetest.get_objects_inside_radius(p,1)
|
||||
local clear = false
|
||||
if #oo < entity_cramming_max then clear = true end
|
||||
local clear = #oo < entity_cramming_max
|
||||
local ncram = {}
|
||||
for _,o in pairs(oo) do
|
||||
local l = o:get_luaentity()
|
||||
if l and clear then
|
||||
if l then
|
||||
if clear then
|
||||
l.cram = nil
|
||||
elseif l and l.cram == nil and not self.child then
|
||||
elseif l.cram == nil and not self.child then
|
||||
table.insert(ncram,l)
|
||||
elseif not clear and l and l.cram then
|
||||
elseif l.cram then
|
||||
damage_mob(l,"cramming",cramming_damage)
|
||||
end
|
||||
end
|
||||
for i,l in ipairs(ncram) do
|
||||
end
|
||||
for i,l in pairs(ncram) do
|
||||
if i > entity_cramming_max then
|
||||
l.cram = true
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue