From f83ccdb2ed5974486a030196f9b31d0490dcdff3 Mon Sep 17 00:00:00 2001 From: jordan4ibanez Date: Sun, 25 Apr 2021 01:22:43 -0400 Subject: [PATCH 1/2] Add in breeding and feeding baby mob sounds --- .../ENTITIES/mcl_mobs/api/mob_functions/breeding.lua | 3 +++ .../mcl_mobs/api/mob_functions/sound_handling.lua | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/mods/ENTITIES/mcl_mobs/api/mob_functions/breeding.lua b/mods/ENTITIES/mcl_mobs/api/mob_functions/breeding.lua index 0f7470ac9b..5dc0b8884a 100644 --- a/mods/ENTITIES/mcl_mobs/api/mob_functions/breeding.lua +++ b/mods/ENTITIES/mcl_mobs/api/mob_functions/breeding.lua @@ -72,6 +72,7 @@ mobs.enter_breed_state = function(self,clicker) end self.breed_lookout_timer = self.breed_lookout_timer_goal self.bred = true + mobs.play_sound_specific(self,"mobs_mc_animal_eat_generic") return(true) end @@ -173,6 +174,8 @@ mobs.make_baby_grow_faster = function(self,clicker) clicker:set_wielded_item(stack) end + mobs.play_sound_specific(self,"mobs_mc_animal_eat_generic") + return(true) end end diff --git a/mods/ENTITIES/mcl_mobs/api/mob_functions/sound_handling.lua b/mods/ENTITIES/mcl_mobs/api/mob_functions/sound_handling.lua index 182b762e2b..98d2644e80 100644 --- a/mods/ENTITIES/mcl_mobs/api/mob_functions/sound_handling.lua +++ b/mods/ENTITIES/mcl_mobs/api/mob_functions/sound_handling.lua @@ -43,5 +43,17 @@ mobs.random_sound_handling = function(self,dtime) mobs.play_sound(self,"random") self.random_sound_timer = math_random(self.random_sound_timer_min,self.random_sound_timer_max) 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 \ No newline at end of file From 38c22f277db652226ce9911e8bffbb8e8b8bc398 Mon Sep 17 00:00:00 2001 From: jordan4ibanez Date: Sun, 25 Apr 2021 01:24:19 -0400 Subject: [PATCH 2/2] Add pop sound when baby mob is born --- mods/ENTITIES/mcl_mobs/api/mob_functions/ai.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mods/ENTITIES/mcl_mobs/api/mob_functions/ai.lua b/mods/ENTITIES/mcl_mobs/api/mob_functions/ai.lua index 957b44ea01..da15e8bb8a 100644 --- a/mods/ENTITIES/mcl_mobs/api/mob_functions/ai.lua +++ b/mods/ENTITIES/mcl_mobs/api/mob_functions/ai.lua @@ -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_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.breed_lookout_timer = 0 self.breed_timer = self.breed_timer_cooloff