Don't re-damage object with arrow if already dead

This commit is contained in:
Wuzzy 2019-03-08 22:31:26 +01:00
parent 049c632276
commit 636ff60c68
1 changed files with 19 additions and 17 deletions

View File

@ -184,6 +184,7 @@ ARROW_ENTITY.on_step = function(self, dtime)
local is_player = obj:is_player() local is_player = obj:is_player()
local lua = obj:get_luaentity() local lua = obj:get_luaentity()
if obj ~= self._shooter and (is_player or (lua and lua._cmi_is_mob)) then if obj ~= self._shooter and (is_player or (lua and lua._cmi_is_mob)) then
if obj:get_hp() > 0 then
obj:punch(self.object, 1.0, { obj:punch(self.object, 1.0, {
full_punch_interval=1.0, full_punch_interval=1.0,
damage_groups={fleshy=self._damage}, damage_groups={fleshy=self._damage},
@ -207,6 +208,7 @@ ARROW_ENTITY.on_step = function(self, dtime)
end end
end end
end end
end
self.object:remove() self.object:remove()
return return
end end