mirror of
https://codeberg.org/tenplus1/mobs_redo.git
synced 2025-01-25 16:40:23 +01:00
fix weapon sound selection
This commit is contained in:
parent
8012250258
commit
49325c9c8d
13
api.lua
13
api.lua
@ -8,7 +8,7 @@ local use_cmi = minetest.global_exists("cmi")
|
|||||||
|
|
||||||
mobs = {
|
mobs = {
|
||||||
mod = "redo",
|
mod = "redo",
|
||||||
version = "20210515",
|
version = "20210527",
|
||||||
intllib = S,
|
intllib = S,
|
||||||
invis = minetest.global_exists("invisibility") and invisibility or {}
|
invis = minetest.global_exists("invisibility") and invisibility or {}
|
||||||
}
|
}
|
||||||
@ -2917,14 +2917,9 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir, damage)
|
|||||||
-- only play hit sound and show blood effects if damage is 1 or over
|
-- only play hit sound and show blood effects if damage is 1 or over
|
||||||
if damage >= 1 then
|
if damage >= 1 then
|
||||||
|
|
||||||
local snd
|
-- select tool use sound if found, or fallback to default
|
||||||
|
local snd = weapon_def.sound and weapon_def.sound.use
|
||||||
-- weapon sounds
|
or "default_punch"
|
||||||
if weapon_def.sounds then
|
|
||||||
snd = weapon_def.sounds[random(#weapon_def.sounds)]
|
|
||||||
else
|
|
||||||
snd = "default_punch"
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.sound_play(snd, {object = self.object, max_hear_distance = 8}, true)
|
minetest.sound_play(snd, {object = self.object, max_hear_distance = 8}, true)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user