diff --git a/mods/ITEMS/mcl_bows/arrow.lua b/mods/ITEMS/mcl_bows/arrow.lua index 9561fea0d..0b41a282e 100644 --- a/mods/ITEMS/mcl_bows/arrow.lua +++ b/mods/ITEMS/mcl_bows/arrow.lua @@ -184,26 +184,28 @@ ARROW_ENTITY.on_step = function(self, dtime) local is_player = obj:is_player() local lua = obj:get_luaentity() if obj ~= self._shooter and (is_player or (lua and lua._cmi_is_mob)) then - obj:punch(self.object, 1.0, { - full_punch_interval=1.0, - damage_groups={fleshy=self._damage}, - }, nil) + if obj:get_hp() > 0 then + obj:punch(self.object, 1.0, { + full_punch_interval=1.0, + damage_groups={fleshy=self._damage}, + }, nil) - if is_player then - if self._shooter and self._shooter:is_player() then - -- “Ding” sound for hitting another player - minetest.sound_play({name="mcl_bows_hit_player", gain=0.1}, {to_player=self._shooter}) + if is_player then + if self._shooter and self._shooter:is_player() then + -- “Ding” sound for hitting another player + minetest.sound_play({name="mcl_bows_hit_player", gain=0.1}, {to_player=self._shooter}) + end end - end - if lua then - local entity_name = lua.name - -- Achievement for hitting skeleton, wither skeleton or stray (TODO) with an arrow at least 50 meters away - -- NOTE: Range has been reduced because mobs unload much earlier than that ... >_> - -- TODO: This achievement should be given for the kill, not just a hit - if self._shooter and self._shooter:is_player() and vector.distance(pos, self._startpos) >= 20 then - if mod_awards and (entity_name == "mobs_mc:skeleton" or entity_name == "mobs_mc:stray" or entity_name == "mobs_mc:witherskeleton") then - awards.unlock(self._shooter:get_player_name(), "mcl:snipeSkeleton") + if lua then + local entity_name = lua.name + -- Achievement for hitting skeleton, wither skeleton or stray (TODO) with an arrow at least 50 meters away + -- NOTE: Range has been reduced because mobs unload much earlier than that ... >_> + -- TODO: This achievement should be given for the kill, not just a hit + if self._shooter and self._shooter:is_player() and vector.distance(pos, self._startpos) >= 20 then + if mod_awards and (entity_name == "mobs_mc:skeleton" or entity_name == "mobs_mc:stray" or entity_name == "mobs_mc:witherskeleton") then + awards.unlock(self._shooter:get_player_name(), "mcl:snipeSkeleton") + end end end end