1
0
Fork 0

Fixed pitch for fuse sound

objects
Wuzzy 2019-03-08 23:17:42 +01:00
parent b8d3e7473b
commit a58b6fd3fb
1 changed files with 13 additions and 42 deletions

View File

@ -99,13 +99,14 @@ local mod_mobspawners = minetest.get_modpath("mcl_mobspawners") ~= nil
local mod_hunger = minetest.get_modpath("mcl_hunger") ~= nil
-- play sound
local mob_sound = function(self, sound, is_opinion)
local mob_sound = function(self, sound, is_opinion, fixed_pitch)
if sound then
if is_opinion and self.opinion_sound_cooloff > 0 then
return
end
local pitch
if not fixed_pitch then
if self.child then
-- Children have high pitch
pitch = 1.5
@ -113,7 +114,8 @@ local mob_sound = function(self, sound, is_opinion)
pitch = 1.0
end
-- randomize the pitch a bit
local pitch = pitch + math.random(-10, 10) * 0.005
pitch = pitch + math.random(-10, 10) * 0.005
end
minetest.sound_play(sound, {
object = self.object,
gain = 1.0,
@ -1943,7 +1945,7 @@ local do_states = function(self, dtime)
self.v_start = true
self.timer = 0
self.blinktimer = 0
mob_sound(self, self.sounds.fuse)
mob_sound(self, self.sounds.fuse, nil, false)
-- stop timer if out of reach or direct line of sight
elseif self.allow_fuse_reset
@ -3655,42 +3657,11 @@ function mobs:capture_mob(self, clicker, chance_hand, chance_net, chance_lasso,
end
-- protect tamed mob with rune item
-- No-op in MCL2 (protecting mobs is not possible).
function mobs:protect(self, clicker)
local name = clicker:get_player_name()
local tool = clicker:get_wielded_item()
if tool:get_name() ~= "mobs:protector" then
return false
end
if self.tamed == false then
minetest.chat_send_player(name, S("Not tamed!"))
return true -- false
end
if self.protected == true then
minetest.chat_send_player(name, S("Already protected!"))
return true -- false
end
if not mobs.is_creative(clicker:get_player_name()) then
tool:take_item() -- take 1 protection rune
clicker:set_wielded_item(tool)
end
self.protected = true
local pos = self.object:get_pos()
pos.y = pos.y + self.collisionbox[2] + 0.5
effect(self.object:get_pos(), 25, "mobs_protect_particle.png", 0.5, 4, 2, 15)
mob_sound(self, "mobs_spell")
return true
end
local mob_obj = {}
local mob_sta = {}