mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2025-01-10 18:47:31 +01:00
Merge pull request 'Don't do knockback effect for mobs when hurt by a rider' (#1629) from jordan4ibanez/MineClone2:mineclone5 into mineclone5
Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/1629
This commit is contained in:
commit
f7ed71bcdc
@ -194,6 +194,17 @@ mobs.mob_punch = function(self, hitter, tflp, tool_capabilities, dir)
|
|||||||
-- do damage
|
-- do damage
|
||||||
self.health = self.health - damage
|
self.health = self.health - damage
|
||||||
|
|
||||||
|
|
||||||
|
--0.4 seconds until you can hurt the mob again
|
||||||
|
self.pause_timer = 0.4
|
||||||
|
|
||||||
|
--don't do knockback from a rider
|
||||||
|
for _,obj in pairs(self.object:get_children()) do
|
||||||
|
if obj == hitter then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- knock back effect
|
-- knock back effect
|
||||||
local velocity = self.object:get_velocity()
|
local velocity = self.object:get_velocity()
|
||||||
|
|
||||||
@ -235,8 +246,6 @@ mobs.mob_punch = function(self, hitter, tflp, tool_capabilities, dir)
|
|||||||
--add the velocity
|
--add the velocity
|
||||||
self.object:add_velocity(dir)
|
self.object:add_velocity(dir)
|
||||||
|
|
||||||
--0.4 seconds until you can hurt the mob again
|
|
||||||
self.pause_timer = 0.4
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user