1
0
Fork 0

Modify pitch of small slimes and magma cubes

This commit is contained in:
Wuzzy 2019-03-09 00:44:24 +01:00
parent 8b44e6fb7a
commit a5b20b1bf0
3 changed files with 14 additions and 3 deletions

View File

@ -107,11 +107,15 @@ local mob_sound = function(self, sound, is_opinion, fixed_pitch)
end end
local pitch local pitch
if not fixed_pitch then 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 if self.child then
-- Children have high pitch -- Children have higher pitch
pitch = 1.5 pitch = base_pitch * 1.5
else else
pitch = 1.0 pitch = base_pitch
end end
-- randomize the pitch a bit -- randomize the pitch a bit
pitch = pitch + math.random(-10, 10) * 0.005 pitch = pitch + math.random(-10, 10) * 0.005

View File

@ -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. 'makes_footstep_sound' when true you can hear mobs walking.
'sounds' this is a table with sounds of the mob 'sounds' this is a table with sounds of the mob
'distance' maximum distance sounds can be heard, default is 10. '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. 'random' played randomly from time to time.
also played for overfeeding animal. also played for overfeeding animal.
'war_cry' what you hear when mob starts to attack player. (currently disabled) '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. 'fuse' sound played when mob explode timer starts.
'explode' sound played when mob explodes. '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: 'drops' table of items that are dropped when mob is killed, fields are:
'name' name of item to drop. 'name' name of item to drop.
'chance' chance of drop, 1 for always, 2 for 1-in-2 chance etc. 'chance' chance of drop, 1 for always, 2 for 1-in-2 chance etc.

View File

@ -114,6 +114,7 @@ local slime_big = {
mobs:register_mob("mobs_mc:slime_big", slime_big) mobs:register_mob("mobs_mc:slime_big", slime_big)
local slime_small = table.copy(slime_big) local slime_small = table.copy(slime_big)
slime_small.sounds.base_pitch = 1.15
slime_small.hp_min = 4 slime_small.hp_min = 4
slime_small.hp_max = 4 slime_small.hp_max = 4
slime_small.collisionbox = {-0.51, -0.01, -0.51, 0.51, 1.00, 0.51} 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) mobs:register_mob("mobs_mc:slime_small", slime_small)
local slime_tiny = table.copy(slime_big) local slime_tiny = table.copy(slime_big)
slime_tiny.sounds.base_pitch = 1.3
slime_tiny.hp_min = 1 slime_tiny.hp_min = 1
slime_tiny.hp_max = 1 slime_tiny.hp_max = 1
slime_tiny.collisionbox = {-0.2505, -0.01, -0.2505, 0.2505, 0.50, 0.2505} 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) local magma_cube_tiny = table.copy(magma_cube_big)
magma_cube_tiny.sounds.jump = "mobs_mc_magma_cube_small" magma_cube_tiny.sounds.jump = "mobs_mc_magma_cube_small"
magma_cube_tiny.sounds.death = "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_min = 1
magma_cube_tiny.hp_max = 1 magma_cube_tiny.hp_max = 1
magma_cube_tiny.collisionbox = {-0.2505, -0.01, -0.2505, 0.2505, 0.50, 0.2505} magma_cube_tiny.collisionbox = {-0.2505, -0.01, -0.2505, 0.2505, 0.50, 0.2505}