From a5b20b1bf0c4bc1e58a0d90771945894ed5e831d Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sat, 9 Mar 2019 00:44:24 +0100 Subject: [PATCH] Modify pitch of small slimes and magma cubes --- mods/ENTITIES/mcl_mobs/api.lua | 10 +++++++--- mods/ENTITIES/mcl_mobs/api.txt | 4 ++++ mods/ENTITIES/mobs_mc/slime+magma_cube.lua | 3 +++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 003ca49587..ab35de4729 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -107,11 +107,15 @@ local mob_sound = function(self, sound, is_opinion, fixed_pitch) end local pitch if not fixed_pitch then + local base_pitch = self.sounds.base_pitch + if not base_pitch then + base_pitch = 1 + end if self.child then - -- Children have high pitch - pitch = 1.5 + -- Children have higher pitch + pitch = base_pitch * 1.5 else - pitch = 1.0 + pitch = base_pitch end -- randomize the pitch a bit pitch = pitch + math.random(-10, 10) * 0.005 diff --git a/mods/ENTITIES/mcl_mobs/api.txt b/mods/ENTITIES/mcl_mobs/api.txt index 10b2141275..f38d8ef165 100644 --- a/mods/ENTITIES/mcl_mobs/api.txt +++ b/mods/ENTITIES/mcl_mobs/api.txt @@ -131,6 +131,7 @@ functions needed for the mob to work properly which contains the following: 'makes_footstep_sound' when true you can hear mobs walking. 'sounds' this is a table with sounds of the mob 'distance' maximum distance sounds can be heard, default is 10. + 'base_pitch' base pitch to use adult mobs, default is 1.0 (MCL2 extension) 'random' played randomly from time to time. also played for overfeeding animal. 'war_cry' what you hear when mob starts to attack player. (currently disabled) @@ -142,6 +143,9 @@ functions needed for the mob to work properly which contains the following: 'fuse' sound played when mob explode timer starts. 'explode' sound played when mob explodes. + Note: For all sounds except fuse and explode, the pitch is slightly randomized from the base pitch + The pitch of children is 50% higher. + 'drops' table of items that are dropped when mob is killed, fields are: 'name' name of item to drop. 'chance' chance of drop, 1 for always, 2 for 1-in-2 chance etc. diff --git a/mods/ENTITIES/mobs_mc/slime+magma_cube.lua b/mods/ENTITIES/mobs_mc/slime+magma_cube.lua index da52d3bcf6..63a15932ad 100644 --- a/mods/ENTITIES/mobs_mc/slime+magma_cube.lua +++ b/mods/ENTITIES/mobs_mc/slime+magma_cube.lua @@ -114,6 +114,7 @@ local slime_big = { mobs:register_mob("mobs_mc:slime_big", slime_big) local slime_small = table.copy(slime_big) +slime_small.sounds.base_pitch = 1.15 slime_small.hp_min = 4 slime_small.hp_max = 4 slime_small.collisionbox = {-0.51, -0.01, -0.51, 0.51, 1.00, 0.51} @@ -128,6 +129,7 @@ slime_small.on_die = spawn_children_on_die("mobs_mc:slime_tiny", 4, 0.6, 1.0) mobs:register_mob("mobs_mc:slime_small", slime_small) local slime_tiny = table.copy(slime_big) +slime_tiny.sounds.base_pitch = 1.3 slime_tiny.hp_min = 1 slime_tiny.hp_max = 1 slime_tiny.collisionbox = {-0.2505, -0.01, -0.2505, 0.2505, 0.50, 0.2505} @@ -239,6 +241,7 @@ mobs:register_mob("mobs_mc:magma_cube_small", magma_cube_small) local magma_cube_tiny = table.copy(magma_cube_big) magma_cube_tiny.sounds.jump = "mobs_mc_magma_cube_small" magma_cube_tiny.sounds.death = "mobs_mc_magma_cube_small" +magma_cube_tiny.sounds.base_pitch = 1.25 magma_cube_tiny.hp_min = 1 magma_cube_tiny.hp_max = 1 magma_cube_tiny.collisionbox = {-0.2505, -0.01, -0.2505, 0.2505, 0.50, 0.2505}