summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTenPlus1 <kinsellaja@yahoo.com>2016-10-30 21:06:33 +0000
committerTenPlus1 <kinsellaja@yahoo.com>2016-10-30 21:06:33 +0000
commit9d554fc31fb4edebb05b64ab4396aeac738d349c (patch)
tree6bfd21a2248b8c708371730a8cc57279b775d873
parentb1048cc892e71cb120a80cc6e7b5ac524134aed4 (diff)
only play damage sound and show blood if mob damage is >=1
-rw-r--r--api.lua29
1 files changed, 17 insertions, 12 deletions
diff --git a/api.lua b/api.lua
index db95700..d6fa261 100644
--- a/api.lua
+++ b/api.lua
@@ -1,5 +1,5 @@
--- Mobs Api (26th October 2016)
+-- Mobs Api (30th October 2016)
mobs = {}
mobs.mod = "redo"
@@ -1900,6 +1900,9 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir)
hitter:set_wielded_item(weapon)
end
+-- only play hit sound and show blood effects if damage is 1 or over
+if damage >= 1 then
+
-- weapon sounds
if weapon:get_definition().sounds ~= nil then
@@ -1916,6 +1919,19 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir)
})
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
self.health = self.health - floor(damage)
@@ -1933,17 +1949,6 @@ 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
-
-- knock back effect (only on full punch)
if self.knock_back > 0
and tflp > punch_interval then