summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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