mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-30 06:21:05 +01:00
Mob sfx: Random pitch, higher pitch for children
This commit is contained in:
parent
086b29f08c
commit
b8d3e7473b
1 changed files with 11 additions and 1 deletions
|
@ -105,10 +105,20 @@ local mob_sound = function(self, sound, is_opinion)
|
||||||
if is_opinion and self.opinion_sound_cooloff > 0 then
|
if is_opinion and self.opinion_sound_cooloff > 0 then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
local pitch
|
||||||
|
if self.child then
|
||||||
|
-- Children have high pitch
|
||||||
|
pitch = 1.5
|
||||||
|
else
|
||||||
|
pitch = 1.0
|
||||||
|
end
|
||||||
|
-- randomize the pitch a bit
|
||||||
|
local pitch = pitch + math.random(-10, 10) * 0.005
|
||||||
minetest.sound_play(sound, {
|
minetest.sound_play(sound, {
|
||||||
object = self.object,
|
object = self.object,
|
||||||
gain = 1.0,
|
gain = 1.0,
|
||||||
max_hear_distance = self.sounds.distance
|
max_hear_distance = self.sounds.distance,
|
||||||
|
pitch = pitch,
|
||||||
})
|
})
|
||||||
self.opinion_sound_cooloff = 1
|
self.opinion_sound_cooloff = 1
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue