Fix mob punch sound not always played

This commit is contained in:
Wuzzy 2019-09-21 17:22:41 +02:00
parent 55f5a54c29
commit 66485f09e5
1 changed files with 5 additions and 13 deletions

View File

@ -1340,19 +1340,11 @@ function mobs:register_mob(name, def)
hitter:set_wielded_item(weapon)
end
-- weapon sounds
if weapon:get_definition().sounds ~= nil then
local s = math.random(0, #weapon:get_definition().sounds)
minetest.sound_play(weapon:get_definition().sounds[s], {
object=hitter,
max_hear_distance = 8
})
else
minetest.sound_play("default_punch", {
object = hitter,
max_hear_distance = 5
})
end
-- punch sounds
minetest.sound_play("default_punch", {
object = hitter,
max_hear_distance = 5
})
-- exit here if dead
if check_for_death(self, hitter) then