mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-22 18:41:09 +01:00
Performance improvement
This commit is contained in:
parent
8825fb9860
commit
5093f31f28
1 changed files with 10 additions and 8 deletions
|
@ -447,14 +447,16 @@ mcl_mobs.register_mob("mobs_mc:enderman", {
|
|||
|
||||
-- ATTACK ENDERMITE
|
||||
local enderpos = self.object:get_pos()
|
||||
local mobsnear = minetest.get_objects_inside_radius(enderpos, 64)
|
||||
for n=1, #mobsnear do
|
||||
local mob = mobsnear[n]
|
||||
if mob then
|
||||
local entity = mob:get_luaentity()
|
||||
if entity and entity.name == "mobs_mc:endermite" then
|
||||
self.state = 'attack'
|
||||
self.attack = mob
|
||||
if math.random(1,20) == 1 then
|
||||
local mobsnear = minetest.get_objects_inside_radius(enderpos, 64)
|
||||
for n=1, #mobsnear do
|
||||
local mob = mobsnear[n]
|
||||
if mob then
|
||||
local entity = mob:get_luaentity()
|
||||
if entity and entity.name == "mobs_mc:endermite" then
|
||||
self.state = 'attack'
|
||||
self.attack = mob
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue