Merge pull request 'Add sound effects to breeding' (#1647) from jordan4ibanez/MineClone2:mineclone5 into mineclone5

Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/1647
This commit is contained in:
jordan4ibanez 2021-04-25 05:24:50 +00:00
commit 96b65f688a
3 changed files with 17 additions and 0 deletions

View file

@ -347,6 +347,8 @@ local land_state_execution = function(self,dtime)
local baby_pos = vector.divide(vector.add(self.object:get_pos(), mate:get_pos()), 2) local baby_pos = vector.divide(vector.add(self.object:get_pos(), mate:get_pos()), 2)
local baby_mob = minetest.add_entity(pos, self.name, minetest.serialize({baby = true, grow_up_timer = self.grow_up_goal, bred = true})) local baby_mob = minetest.add_entity(pos, self.name, minetest.serialize({baby = true, grow_up_timer = self.grow_up_goal, bred = true}))
mobs.play_sound_specific(self,"item_drop_pickup")
self.special_breed_timer = 0 self.special_breed_timer = 0
self.breed_lookout_timer = 0 self.breed_lookout_timer = 0
self.breed_timer = self.breed_timer_cooloff self.breed_timer = self.breed_timer_cooloff

View file

@ -72,6 +72,7 @@ mobs.enter_breed_state = function(self,clicker)
end end
self.breed_lookout_timer = self.breed_lookout_timer_goal self.breed_lookout_timer = self.breed_lookout_timer_goal
self.bred = true self.bred = true
mobs.play_sound_specific(self,"mobs_mc_animal_eat_generic")
return(true) return(true)
end end
@ -173,6 +174,8 @@ mobs.make_baby_grow_faster = function(self,clicker)
clicker:set_wielded_item(stack) clicker:set_wielded_item(stack)
end end
mobs.play_sound_specific(self,"mobs_mc_animal_eat_generic")
return(true) return(true)
end end
end end

View file

@ -43,5 +43,17 @@ mobs.random_sound_handling = function(self,dtime)
mobs.play_sound(self,"random") mobs.play_sound(self,"random")
self.random_sound_timer = math_random(self.random_sound_timer_min,self.random_sound_timer_max) self.random_sound_timer = math_random(self.random_sound_timer_min,self.random_sound_timer_max)
end end
end
--used for playing a non-mob internal sound at random pitches
mobs.play_sound_specific = function(self,soundname)
local pitch = (100 + math_random(-15,15) + math_random()) / 100
local distance = self.sounds.distance or 16
minetest.sound_play(soundname, {
object = self.object,
gain = 1.0,
max_hear_distance = distance,
pitch = pitch,
}, true)
end end