on_punch tweaks

This commit is contained in:
TenPlus1 2016-10-31 21:37:38 +00:00
parent 9d554fc31f
commit c16c083d31

12
api.lua
View File

@ -1,5 +1,5 @@
-- Mobs Api (30th October 2016) -- Mobs Api (31st October 2016)
mobs = {} mobs = {}
mobs.mod = "redo" mobs.mod = "redo"
@ -1886,6 +1886,12 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir)
end end
end end
-- healing
if damage <= -1 then
self.health = self.health - floor(damage)
return
end
-- print ("Mob Damage is", damage) -- print ("Mob Damage is", damage)
-- add weapon wear -- add weapon wear
@ -1930,8 +1936,6 @@ if damage >= 1 then
effect(pos, self.blood_amount, self.blood_texture) effect(pos, self.blood_amount, self.blood_texture)
end end
end
-- do damage -- do damage
self.health = self.health - floor(damage) self.health = self.health - floor(damage)
@ -1976,6 +1980,8 @@ end
self.pause_timer = r self.pause_timer = r
end end
end -- END if damage
-- if skittish then run away -- if skittish then run away
if self.runaway == true then if self.runaway == true then