forked from VoxeLibre/VoxeLibre
Don't re-damage object with arrow if already dead
This commit is contained in:
parent
049c632276
commit
636ff60c68
|
@ -184,26 +184,28 @@ 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
|
||||||
obj:punch(self.object, 1.0, {
|
if obj:get_hp() > 0 then
|
||||||
full_punch_interval=1.0,
|
obj:punch(self.object, 1.0, {
|
||||||
damage_groups={fleshy=self._damage},
|
full_punch_interval=1.0,
|
||||||
}, nil)
|
damage_groups={fleshy=self._damage},
|
||||||
|
}, nil)
|
||||||
|
|
||||||
if is_player then
|
if is_player then
|
||||||
if self._shooter and self._shooter:is_player() then
|
if self._shooter and self._shooter:is_player() then
|
||||||
-- “Ding” sound for hitting another player
|
-- “Ding” sound for hitting another player
|
||||||
minetest.sound_play({name="mcl_bows_hit_player", gain=0.1}, {to_player=self._shooter})
|
minetest.sound_play({name="mcl_bows_hit_player", gain=0.1}, {to_player=self._shooter})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
if lua then
|
if lua then
|
||||||
local entity_name = lua.name
|
local entity_name = lua.name
|
||||||
-- Achievement for hitting skeleton, wither skeleton or stray (TODO) with an arrow at least 50 meters away
|
-- 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 ... >_>
|
-- 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
|
-- 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 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
|
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")
|
awards.unlock(self._shooter:get_player_name(), "mcl:snipeSkeleton")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue