forked from mtcontrib/mobs_redo
only play damage sound and show blood if mob damage is >=1
This commit is contained in:
parent
b1048cc892
commit
9d554fc31f
29
api.lua
29
api.lua
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
-- Mobs Api (26th October 2016)
|
-- Mobs Api (30th October 2016)
|
||||||
|
|
||||||
mobs = {}
|
mobs = {}
|
||||||
mobs.mod = "redo"
|
mobs.mod = "redo"
|
||||||
@ -1900,6 +1900,9 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir)
|
|||||||
hitter:set_wielded_item(weapon)
|
hitter:set_wielded_item(weapon)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- only play hit sound and show blood effects if damage is 1 or over
|
||||||
|
if damage >= 1 then
|
||||||
|
|
||||||
-- weapon sounds
|
-- weapon sounds
|
||||||
if weapon:get_definition().sounds ~= nil then
|
if weapon:get_definition().sounds ~= nil then
|
||||||
|
|
||||||
@ -1916,6 +1919,19 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir)
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- blood_particles
|
||||||
|
if self.blood_amount > 0
|
||||||
|
and not disable_blood then
|
||||||
|
|
||||||
|
local pos = self.object:getpos()
|
||||||
|
|
||||||
|
pos.y = pos.y + (-self.collisionbox[2] + self.collisionbox[5]) * .5
|
||||||
|
|
||||||
|
effect(pos, self.blood_amount, self.blood_texture)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
-- do damage
|
-- do damage
|
||||||
self.health = self.health - floor(damage)
|
self.health = self.health - floor(damage)
|
||||||
|
|
||||||
@ -1933,17 +1949,6 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir)
|
|||||||
end)
|
end)
|
||||||
end) ]]
|
end) ]]
|
||||||
|
|
||||||
-- blood_particles
|
|
||||||
if self.blood_amount > 0
|
|
||||||
and not disable_blood then
|
|
||||||
|
|
||||||
local pos = self.object:getpos()
|
|
||||||
|
|
||||||
pos.y = pos.y + (-self.collisionbox[2] + self.collisionbox[5]) * .5
|
|
||||||
|
|
||||||
effect(pos, self.blood_amount, self.blood_texture)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- knock back effect (only on full punch)
|
-- knock back effect (only on full punch)
|
||||||
if self.knock_back > 0
|
if self.knock_back > 0
|
||||||
and tflp > punch_interval then
|
and tflp > punch_interval then
|
||||||
|
Loading…
Reference in New Issue
Block a user