mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-08-26 19:57:24 +02:00
Merge pull request 'Implement mob cramming' (#1652) from jordan4ibanez/MineClone2:mineclone5 into mineclone5
Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/1652
This commit is contained in:
commit
36e81d18d9
@ -39,13 +39,15 @@ mobs.collision = function(self)
|
|||||||
end
|
end
|
||||||
|
|
||||||
for _,object in ipairs(minetest_get_objects_inside_radius(pos, radius*1.25)) do
|
for _,object in ipairs(minetest_get_objects_inside_radius(pos, radius*1.25)) do
|
||||||
if object and object ~= self.object and (object:is_player() or (object:get_luaentity() and object:get_luaentity()._cmi_is_mob == true)) and
|
if object and object ~= self.object and (object:is_player() or (object:get_luaentity() and object:get_luaentity()._cmi_is_mob == true and object:get_luaentity().health > 0)) and
|
||||||
--don't collide with rider, rider don't collide with thing
|
--don't collide with rider, rider don't collide with thing
|
||||||
(not object:get_attach() or (object:get_attach() and object:get_attach() ~= self.object)) and
|
(not object:get_attach() or (object:get_attach() and object:get_attach() ~= self.object)) and
|
||||||
(not self.object:get_attach() or (self.object:get_attach() and self.object:get_attach() ~= object)) then
|
(not self.object:get_attach() or (self.object:get_attach() and self.object:get_attach() ~= object)) then
|
||||||
--stop infinite loop
|
--stop infinite loop
|
||||||
collision_count = collision_count + 1
|
collision_count = collision_count + 1
|
||||||
if collision_count > 100 then
|
--mob cramming
|
||||||
|
if collision_count > 30 then
|
||||||
|
self.health = -20
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user