1
0
Fork 0

Use ephemeral sounds

objects
Wuzzy 2020-04-07 00:55:45 +02:00
parent b2c75acd68
commit c5e4ec5e27
61 changed files with 123 additions and 122 deletions

View File

@ -164,5 +164,5 @@ end
-- Player death sound -- Player death sound
minetest.register_on_dieplayer(function(player) minetest.register_on_dieplayer(function(player)
-- TODO: Add separate death sound -- TODO: Add separate death sound
minetest.sound_play({name="player_damage", gain = 1.0}, {pos=player:get_pos(), max_hear_distance=16}) minetest.sound_play({name="player_damage", gain = 1.0}, {pos=player:get_pos(), max_hear_distance=16}, true)
end) end)

View File

@ -385,7 +385,7 @@ function mcl_util.generate_on_place_plant_function(condition)
if success then if success then
if idef.sounds and idef.sounds.place then if idef.sounds and idef.sounds.place then
minetest.sound_play(idef.sounds.place, {pos=pointed_thing.above, gain=1}) minetest.sound_play(idef.sounds.place, {pos=pointed_thing.above, gain=1}, true)
end end
end end
itemstack = new_itemstack itemstack = new_itemstack

View File

@ -39,7 +39,7 @@ minetest.register_entity("drippingwater:drop_water", {
if minetest.get_node({x=ownpos.x, y=ownpos.y -0.5, z=ownpos.z}).name ~= "air" then if minetest.get_node({x=ownpos.x, y=ownpos.y -0.5, z=ownpos.z}).name ~= "air" then
self.object:remove() self.object:remove()
minetest.sound_play({name="drippingwater_drip"}, {pos = ownpos, gain = 0.5, max_hear_distance = 8}) minetest.sound_play({name="drippingwater_drip"}, {pos = ownpos, gain = 0.5, max_hear_distance = 8}, true)
end end
end, end,
}) })
@ -81,7 +81,7 @@ minetest.register_entity("drippingwater:drop_lava", {
if minetest.get_node({x=ownpos.x, y=ownpos.y -0.5, z=ownpos.z}).name ~= "air" then if minetest.get_node({x=ownpos.x, y=ownpos.y -0.5, z=ownpos.z}).name ~= "air" then
self.object:remove() self.object:remove()
minetest.sound_play({name="drippingwater_lavadrip"}, {pos = ownpos, gain = 0.5, max_hear_distance = 8}) minetest.sound_play({name="drippingwater_lavadrip"}, {pos = ownpos, gain = 0.5, max_hear_distance = 8}, true)
end end
end, end,
}) })

View File

@ -221,7 +221,7 @@ minetest.register_entity(":__builtin:falling_node", {
meta:from_table(self.meta) meta:from_table(self.meta)
end end
if def.sounds and def.sounds.place and def.sounds.place.name then if def.sounds and def.sounds.place and def.sounds.place.name then
minetest.sound_play(def.sounds.place, {pos = np}) minetest.sound_play(def.sounds.place, {pos = np}, true)
end end
end end
else else
@ -258,7 +258,7 @@ minetest.register_entity(":__builtin:falling_node", {
def._mcl_after_falling(npos3, get_falling_depth(self)) def._mcl_after_falling(npos3, get_falling_depth(self))
end end
if def.sounds and def.sounds.place and def.sounds.place.name then if def.sounds and def.sounds.place and def.sounds.place.name then
minetest.sound_play(def.sounds.place, {pos = np}) minetest.sound_play(def.sounds.place, {pos = np}, true)
end end
end end
deal_falling_damage(self, dtime) deal_falling_damage(self, dtime)

View File

@ -75,7 +75,7 @@ minetest.register_globalstep(function(dtime)
pos = pos, pos = pos,
max_hear_distance = 16, max_hear_distance = 16,
gain = 1.0, gain = 1.0,
}) }, true)
check_pickup_achievements(object, player) check_pickup_achievements(object, player)
@ -129,7 +129,7 @@ minetest.register_globalstep(function(dtime)
pos = pos, pos = pos,
max_hear_distance = 16, max_hear_distance = 16,
gain = 1.0, gain = 1.0,
}) }, true)
end end
check_pickup_achievements(object, player) check_pickup_achievements(object, player)
object:get_luaentity()._removed = true object:get_luaentity()._removed = true
@ -545,7 +545,7 @@ minetest.register_entity(":__builtin:item", {
local dg = minetest.get_item_group(nn, "destroys_items") local dg = minetest.get_item_group(nn, "destroys_items")
if (def and (lg ~= 0 or fg ~= 0 or dg == 1)) then if (def and (lg ~= 0 or fg ~= 0 or dg == 1)) then
if dg ~= 2 then if dg ~= 2 then
minetest.sound_play("builtin_item_lava", {pos = self.object:get_pos(), gain = 0.5}) minetest.sound_play("builtin_item_lava", {pos = self.object:get_pos(), gain = 0.5}, true)
end end
self._removed = true self._removed = true
self.object:remove() self.object:remove()

View File

@ -43,7 +43,7 @@ local function activate_tnt_minecart(self, timer)
"mcl_minecarts_minecart.png", "mcl_minecarts_minecart.png",
}}) }})
self._blinktimer = tnt.BLINKTIMER self._blinktimer = tnt.BLINKTIMER
minetest.sound_play("tnt_ignite", {pos = self.object:get_pos(), gain = 1.0, max_hear_distance = 15}) minetest.sound_play("tnt_ignite", {pos = self.object:get_pos(), gain = 1.0, max_hear_distance = 15}, true)
end end
local activate_normal_minecart = detach_driver local activate_normal_minecart = detach_driver

View File

@ -130,7 +130,7 @@ local mob_sound = function(self, soundname, is_opinion, fixed_pitch)
gain = 1.0, gain = 1.0,
max_hear_distance = self.sounds.distance, max_hear_distance = self.sounds.distance,
pitch = pitch, pitch = pitch,
}) }, true)
self.opinion_sound_cooloff = 1 self.opinion_sound_cooloff = 1
end end
end end
@ -2230,7 +2230,7 @@ local do_states = function(self, dtime)
pos = pos, pos = pos,
gain = 1.0, gain = 1.0,
max_hear_distance = self.sounds.distance or 32 max_hear_distance = self.sounds.distance or 32
}) }, true)
entity_physics(pos, entity_damage_radius) entity_physics(pos, entity_damage_radius)
effect(pos, 32, "tnt_smoke.png", nil, nil, node_break_radius, 1, 0) effect(pos, 32, "tnt_smoke.png", nil, nil, node_break_radius, 1, 0)
@ -2683,12 +2683,12 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir)
minetest.sound_play(weapon:get_definition().sounds[s], { minetest.sound_play(weapon:get_definition().sounds[s], {
object = self.object, --hitter, object = self.object, --hitter,
max_hear_distance = 8 max_hear_distance = 8
}) }, true)
else else
minetest.sound_play("default_punch", { minetest.sound_play("default_punch", {
object = self.object, --hitter, object = self.object, --hitter,
max_hear_distance = 5 max_hear_distance = 5
}) }, true)
end end
damage_effect(self, damage) damage_effect(self, damage)
@ -3797,7 +3797,7 @@ function mobs:safe_boom(self, pos, radius)
pos = pos, pos = pos,
gain = 1.0, gain = 1.0,
max_hear_distance = self.sounds and self.sounds.distance or 32 max_hear_distance = self.sounds and self.sounds.distance or 32
}) }, true)
entity_physics(pos, radius) entity_physics(pos, radius)
effect(pos, 32, "tnt_smoke.png", radius * 3, radius * 5, radius, 1, 0) effect(pos, 32, "tnt_smoke.png", radius * 3, radius * 5, radius, 1, 0)

View File

@ -318,7 +318,7 @@ function mobs.drive(entity, moving_anim, stand_anim, can_fly, dtime)
minetest.sound_play("default_punch", { minetest.sound_play("default_punch", {
object = entity.object, object = entity.object,
max_hear_distance = 5 max_hear_distance = 5
}) }, true)
entity.object:punch(entity.object, 1.0, { entity.object:punch(entity.object, 1.0, {
full_punch_interval = 1.0, full_punch_interval = 1.0,

View File

@ -568,7 +568,7 @@ if c("totem") then
player:set_wielded_item(wield) player:set_wielded_item(wield)
end end
-- Effects -- Effects
minetest.sound_play({name = "mcl_totems_totem", gain=1}, {pos=ppos, max_hear_distance=16}) minetest.sound_play({name = "mcl_totems_totem", gain=1}, {pos=ppos, max_hear_distance=16}, true)
-- Big totem overlay -- Big totem overlay
if not hud_totem[player:get_player_name()] then if not hud_totem[player:get_player_name()] then

View File

@ -85,7 +85,7 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
if obj:get_luaentity() ~= nil then if obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= "mobs_mc:arrow_entity" and obj:get_luaentity().name ~= "__builtin:item" then if obj:get_luaentity().name ~= "mobs_mc:arrow_entity" and obj:get_luaentity().name ~= "__builtin:item" then
local damage = 3 local damage = 3
minetest.sound_play("damage", {pos = pos}) minetest.sound_play("damage", {pos = pos}, true)
obj:punch(self.object, 1.0, { obj:punch(self.object, 1.0, {
full_punch_interval=1.0, full_punch_interval=1.0,
damage_groups={fleshy=damage}, damage_groups={fleshy=damage},
@ -94,7 +94,7 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
end end
else else
local damage = 3 local damage = 3
minetest.sound_play("damage", {pos = pos}) minetest.sound_play("damage", {pos = pos}, true)
obj:punch(self.object, 1.0, { obj:punch(self.object, 1.0, {
full_punch_interval=1.0, full_punch_interval=1.0,
damage_groups={fleshy=damage}, damage_groups={fleshy=damage},
@ -106,7 +106,7 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
if self.lastpos.x~=nil then if self.lastpos.x~=nil then
if node.name ~= "air" then if node.name ~= "air" then
minetest.sound_play("bowhit1", {pos = pos}) minetest.sound_play("bowhit1", {pos = pos}, true)
minetest.add_item(self.lastpos, 'mobs_mc:arrow') minetest.add_item(self.lastpos, 'mobs_mc:arrow')
self.object:remove() self.object:remove()
end end
@ -132,7 +132,7 @@ local throwing_shoot_arrow = function(itemstack, player)
obj:set_velocity({x=dir.x*22, y=dir.y*22, z=dir.z*22}) obj:set_velocity({x=dir.x*22, y=dir.y*22, z=dir.z*22})
obj:set_acceleration({x=dir.x*-3, y=-10, z=dir.z*-3}) obj:set_acceleration({x=dir.x*-3, y=-10, z=dir.z*-3})
obj:set_yaw(player:get_look_yaw()+math.pi) obj:set_yaw(player:get_look_yaw()+math.pi)
minetest.sound_play("throwing_sound", {pos=playerpos}) minetest.sound_play("throwing_sound", {pos=playerpos}, true)
if obj:get_luaentity().player == "" then if obj:get_luaentity().player == "" then
obj:get_luaentity().player = player obj:get_luaentity().player = player
end end
@ -266,7 +266,7 @@ if c("egg") then
pos = playerpos, pos = playerpos,
gain = 1.0, gain = 1.0,
max_hear_distance = 5, max_hear_distance = 5,
}) }, true)
local obj = minetest.add_entity({ local obj = minetest.add_entity({
x = playerpos.x, x = playerpos.x,

View File

@ -86,7 +86,7 @@ mobs:register_mob("mobs_mc:chicken", {
pos = pos, pos = pos,
gain = 1.0, gain = 1.0,
max_hear_distance = 16, max_hear_distance = 16,
}) }, true)
end, end,
}) })

View File

@ -87,7 +87,7 @@ mooshroom_def.on_rightclick = function(self, clicker)
-- Use shears to get mushrooms and turn mooshroom into cow -- Use shears to get mushrooms and turn mooshroom into cow
if item:get_name() == mobs_mc.items.shears then if item:get_name() == mobs_mc.items.shears then
local pos = self.object:get_pos() local pos = self.object:get_pos()
minetest.sound_play("shears", {pos = pos}) minetest.sound_play("shears", {pos = pos}, true)
if self.base_texture[1] == "mobs_mc_mooshroom_brown.png" then if self.base_texture[1] == "mobs_mc_mooshroom_brown.png" then
minetest.add_item({x=pos.x, y=pos.y+1.4, z=pos.z}, mobs_mc.items.mushroom_brown .. " 5") minetest.add_item({x=pos.x, y=pos.y+1.4, z=pos.z}, mobs_mc.items.mushroom_brown .. " 5")

View File

@ -57,12 +57,12 @@ mobs:register_mob("mobs_mc:creeper", {
item:add_wear(1000) item:add_wear(1000)
-- Tool break sound -- Tool break sound
if item:get_count() == 0 and wdef.sound and wdef.sound.breaks then if item:get_count() == 0 and wdef.sound and wdef.sound.breaks then
minetest.sound_play(wdef.sound.breaks, {pos = clicker:get_pos(), gain = 0.5}) minetest.sound_play(wdef.sound.breaks, {pos = clicker:get_pos(), gain = 0.5}, true)
end end
clicker:set_wielded_item(item) clicker:set_wielded_item(item)
end end
self._forced_explosion_countdown_timer = self.explosion_timer self._forced_explosion_countdown_timer = self.explosion_timer
minetest.sound_play(self.sounds.attack, {pos = self.object:get_pos(), gain = 1, max_hear_distance = 16}) minetest.sound_play(self.sounds.attack, {pos = self.object:get_pos(), gain = 1, max_hear_distance = 16}, true)
end end
end, end,
do_custom = function(self, dtime) do_custom = function(self, dtime)

View File

@ -81,7 +81,7 @@ mobs:register_arrow("mobs_mc:dragon_fireball", {
end, end,
hit_mob = function(self, mob) hit_mob = function(self, mob)
minetest.sound_play("tnt_explode", {pos = mob:get_pos(), gain = 1.5, max_hear_distance = 2*64}) minetest.sound_play("tnt_explode", {pos = mob:get_pos(), gain = 1.5, max_hear_distance = 2*64}, true)
mob:punch(self.object, 1.0, { mob:punch(self.object, 1.0, {
full_punch_interval = 0.5, full_punch_interval = 0.5,
damage_groups = {fleshy = 12}, damage_groups = {fleshy = 12},

View File

@ -255,7 +255,7 @@ mobs:register_mob("mobs_mc:enderman", {
self.animation = select_enderman_animation("block") self.animation = select_enderman_animation("block")
mobs:set_animation(self, self.animation.current) mobs:set_animation(self, self.animation.current)
if def.sounds and def.sounds.dug then if def.sounds and def.sounds.dug then
minetest.sound_play(def.sounds.dug, {pos = take_pos, max_hear_distance = 16}) minetest.sound_play(def.sounds.dug, {pos = take_pos, max_hear_distance = 16}, true)
end end
end end
end end
@ -276,7 +276,7 @@ mobs:register_mob("mobs_mc:enderman", {
self.animation = select_enderman_animation("normal") self.animation = select_enderman_animation("normal")
mobs:set_animation(self, self.animation.current) mobs:set_animation(self, self.animation.current)
if def.sounds and def.sounds.place then if def.sounds and def.sounds.place then
minetest.sound_play(def.sounds.place, {pos = place_pos, max_hear_distance = 16}) minetest.sound_play(def.sounds.place, {pos = place_pos, max_hear_distance = 16}, true)
end end
self._taken_node = "" self._taken_node = ""
end end

View File

@ -245,7 +245,7 @@ local horse = {
local tex = horse_extra_texture(self) local tex = horse_extra_texture(self)
self.base_texture = tex self.base_texture = tex
self.object:set_properties({textures = self.base_texture}) self.object:set_properties({textures = self.base_texture})
minetest.sound_play({name = "mcl_armor_equip_leather"}, {gain=0.5, max_hear_distance=12, pos=self.object:get_pos()}) minetest.sound_play({name = "mcl_armor_equip_leather"}, {gain=0.5, max_hear_distance=12, pos=self.object:get_pos()}, true)
-- Put on horse armor if tamed -- Put on horse armor if tamed
elseif can_equip_horse_armor(self.name) and not self.driver and not self._horse_armor elseif can_equip_horse_armor(self.name) and not self.driver and not self._horse_armor
@ -277,7 +277,7 @@ local horse = {
self.object:set_properties({textures = self.base_texture}) self.object:set_properties({textures = self.base_texture})
local def = w:get_definition() local def = w:get_definition()
if def.sounds and def.sounds._mcl_armor_equip then if def.sounds and def.sounds._mcl_armor_equip then
minetest.sound_play({name = def.sounds._mcl_armor_equip}, {gain=0.5, max_hear_distance=12, pos=self.object:get_pos()}) minetest.sound_play({name = def.sounds._mcl_armor_equip}, {gain=0.5, max_hear_distance=12, pos=self.object:get_pos()}, true)
end end
-- Mount horse -- Mount horse

View File

@ -125,7 +125,7 @@ mobs:register_mob("mobs_mc:pig", {
stack:take_item() stack:take_item()
inv:set_stack("main", clicker:get_wield_index(), stack) inv:set_stack("main", clicker:get_wield_index(), stack)
end end
minetest.sound_play({name = "mcl_armor_equip_leather"}, {gain=0.5, max_hear_distance=8, pos=self.object:get_pos()}) minetest.sound_play({name = "mcl_armor_equip_leather"}, {gain=0.5, max_hear_distance=8, pos=self.object:get_pos()}, true)
return return
end end
@ -149,7 +149,7 @@ mobs:register_mob("mobs_mc:pig", {
-- Break carrot on a stick -- Break carrot on a stick
local def = wielditem:get_definition() local def = wielditem:get_definition()
if def.sounds and def.sounds.breaks then if def.sounds and def.sounds.breaks then
minetest.sound_play(def.sounds.breaks, {pos = clicker:get_pos(), max_hear_distance = 8, gain = 0.5}) minetest.sound_play(def.sounds.breaks, {pos = clicker:get_pos(), max_hear_distance = 8, gain = 0.5}, true)
end end
wielditem = {name = mobs_mc.items.fishing_rod, count = 1} wielditem = {name = mobs_mc.items.fishing_rod, count = 1}
else else

View File

@ -155,7 +155,7 @@ mobs:register_mob("mobs_mc:sheep", {
if item:get_name() == mobs_mc.items.shears and not self.gotten and not self.child then if item:get_name() == mobs_mc.items.shears and not self.gotten and not self.child then
self.gotten = true self.gotten = true
local pos = self.object:get_pos() local pos = self.object:get_pos()
minetest.sound_play("shears", {pos = pos}) minetest.sound_play("shears", {pos = pos}, true)
pos.y = pos.y + 0.5 pos.y = pos.y + 0.5
if not self.color then if not self.color then
self.color = "unicolor_white" self.color = "unicolor_white"

View File

@ -115,7 +115,7 @@ mobs:register_mob("mobs_mc:snowman", {
}) })
local pos = self.object:get_pos() local pos = self.object:get_pos()
minetest.sound_play("shears", {pos = pos}) minetest.sound_play("shears", {pos = pos}, true)
-- Wear out -- Wear out
if not minetest.settings:get_bool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then

View File

@ -518,7 +518,7 @@ local function show_trade_formspec(playername, trader, tradenum)
.."listring[current_player;main]" .."listring[current_player;main]"
.."listring["..tradeinv..";input]" .."listring["..tradeinv..";input]"
.."listring[current_player;main]" .."listring[current_player;main]"
minetest.sound_play("mobs_mc_villager_trade", {to_player = playername}) minetest.sound_play("mobs_mc_villager_trade", {to_player = playername}, true)
minetest.show_formspec(playername, tradeinv_name, formspec) minetest.show_formspec(playername, tradeinv_name, formspec)
end end
@ -580,13 +580,13 @@ local update_offer = function(inv, player, sound)
(trade.locked == false)) then (trade.locked == false)) then
inv:set_stack("output", 1, inv:get_stack("offered", 1)) inv:set_stack("output", 1, inv:get_stack("offered", 1))
if sound then if sound then
minetest.sound_play("mobs_mc_villager_accept", {to_player = name}) minetest.sound_play("mobs_mc_villager_accept", {to_player = name}, true)
end end
return true return true
else else
inv:set_stack("output", 1, ItemStack("")) inv:set_stack("output", 1, ItemStack(""))
if sound then if sound then
minetest.sound_play("mobs_mc_villager_deny", {to_player = name}) minetest.sound_play("mobs_mc_villager_deny", {to_player = name}, true)
end end
return false return false
end end
@ -775,7 +775,7 @@ local trade_inventory = {
if not wanted2:is_empty() then if not wanted2:is_empty() then
inv:remove_item("input", inv:get_stack("wanted", 2)) inv:remove_item("input", inv:get_stack("wanted", 2))
end end
minetest.sound_play("mobs_mc_villager_accept", {to_player = player:get_player_name()}) minetest.sound_play("mobs_mc_villager_accept", {to_player = player:get_player_name()}, true)
end end
update_offer(inv, player, true) update_offer(inv, player, true)
end, end,
@ -881,9 +881,9 @@ local trade_inventory = {
update_offer(inv, player, false) update_offer(inv, player, false)
end end
if accept then if accept then
minetest.sound_play("mobs_mc_villager_accept", {to_player = name}) minetest.sound_play("mobs_mc_villager_accept", {to_player = name}, true)
else else
minetest.sound_play("mobs_mc_villager_deny", {to_player = name}) minetest.sound_play("mobs_mc_villager_deny", {to_player = name}, true)
end end
end, end,
} }

View File

@ -120,7 +120,7 @@ lightning.strike = function(pos)
glow = minetest.LIGHT_MAX, glow = minetest.LIGHT_MAX,
}) })
minetest.sound_play({ pos = pos, name = "lightning_thunder", gain = 10, max_hear_distance = 500 }) minetest.sound_play({ pos = pos, name = "lightning_thunder", gain = 10, max_hear_distance = 500 }, true)
-- damage nearby objects, transform mobs -- damage nearby objects, transform mobs
local objs = minetest.get_objects_inside_radius(pos2, 3.5) local objs = minetest.get_objects_inside_radius(pos2, 3.5)

View File

@ -207,7 +207,7 @@ if mcl_weather.allow_abm then
if mcl_weather.rain.raining and mcl_weather.rain.extinguish_fire then if mcl_weather.rain.raining and mcl_weather.rain.extinguish_fire then
if mcl_weather.is_outdoor(pos) then if mcl_weather.is_outdoor(pos) then
minetest.remove_node(pos) minetest.remove_node(pos)
minetest.sound_play("fire_extinguish_flame", {pos = pos, max_hear_distance = 8, gain = 0.1}) minetest.sound_play("fire_extinguish_flame", {pos = pos, max_hear_distance = 8, gain = 0.1}, true)
end end
end end
end, end,

View File

@ -191,7 +191,7 @@ function doc.mark_entry_as_revealed(playername, category_id, entry_id)
local last_sound = doc.data.players[playername].last_reveal_sound local last_sound = doc.data.players[playername].last_reveal_sound
if last_sound == nil or os.difftime(os.time(), last_sound) >= 1 then if last_sound == nil or os.difftime(os.time(), last_sound) >= 1 then
-- Play notification sound -- Play notification sound
minetest.sound_play({ name = "doc_reveal", gain = 0.2 }, { to_player = playername }) minetest.sound_play({ name = "doc_reveal", gain = 0.2 }, { to_player = playername }, true)
doc.data.players[playername].last_reveal_sound = os.time() doc.data.players[playername].last_reveal_sound = os.time()
end end
end end
@ -224,7 +224,7 @@ function doc.mark_all_entries_as_revealed(playername)
msg = S("All help entries revealed!") msg = S("All help entries revealed!")
-- Play notification sound (ignore sound limit intentionally) -- Play notification sound (ignore sound limit intentionally)
minetest.sound_play({ name = "doc_reveal", gain = 0.2 }, { to_player = playername }) minetest.sound_play({ name = "doc_reveal", gain = 0.2 }, { to_player = playername }, true)
doc.data.players[playername].last_reveal_sound = os.time() doc.data.players[playername].last_reveal_sound = os.time()
else else
msg = S("All help entries are already revealed.") msg = S("All help entries are already revealed.")

View File

@ -264,7 +264,7 @@ function awards.unlock(name, award)
-- Enforce sound delay to prevent sound spamming -- Enforce sound delay to prevent sound spamming
local lastsound = awards.players[name].lastsound local lastsound = awards.players[name].lastsound
if lastsound == nil or os.difftime(os.time(), lastsound) >= 1 then if lastsound == nil or os.difftime(os.time(), lastsound) >= 1 then
minetest.sound_play(sound, {to_player=name}) minetest.sound_play(sound, {to_player=name}, true)
awards.players[name].lastsound = os.time() awards.players[name].lastsound = os.time()
end end
end end

View File

@ -27,7 +27,7 @@ mesecon.push_button = function(pos, node)
local def = minetest.registered_nodes[node.name] local def = minetest.registered_nodes[node.name]
minetest.set_node(pos, {name="mesecons_button:button_"..def._mcl_button_basename.."_on", param2=node.param2}) minetest.set_node(pos, {name="mesecons_button:button_"..def._mcl_button_basename.."_on", param2=node.param2})
mesecon.receptor_on(pos, button_get_output_rules(node)) mesecon.receptor_on(pos, button_get_output_rules(node))
minetest.sound_play("mesecons_button_push", {pos=pos}) minetest.sound_play("mesecons_button_push", {pos=pos}, true)
local timer = minetest.get_node_timer(pos) local timer = minetest.get_node_timer(pos)
timer:start(def._mcl_button_timer) timer:start(def._mcl_button_timer)
end end
@ -73,7 +73,7 @@ local on_button_place = function(itemstack, placer, pointed_thing)
if success then if success then
if idef.sounds and idef.sounds.place then if idef.sounds and idef.sounds.place then
minetest.sound_play(idef.sounds.place, {pos=above, gain=1}) minetest.sound_play(idef.sounds.place, {pos=above, gain=1}, true)
end end
end end
return itemstack return itemstack
@ -179,7 +179,7 @@ mesecon.register_button = function(basename, description, texture, recipeitem, s
-- Normal operation: Un-press the button -- Normal operation: Un-press the button
minetest.set_node(pos, {name="mesecons_button:button_"..basename.."_off",param2=node.param2}) minetest.set_node(pos, {name="mesecons_button:button_"..basename.."_off",param2=node.param2})
minetest.sound_play("mesecons_button_pop", {pos=pos}) minetest.sound_play("mesecons_button_pop", {pos=pos}, true)
mesecon.receptor_off(pos, button_get_output_rules(node)) mesecon.receptor_off(pos, button_get_output_rules(node))
end end
end, end,

View File

@ -64,7 +64,7 @@ local piston_remove_pusher = function (pos, oldnode)
pos = pos, pos = pos,
max_hear_distance = 31, max_hear_distance = 31,
gain = 0.3, gain = 0.3,
}) }, true)
end end
end end
@ -85,7 +85,7 @@ local piston_remove_base = function (pos, oldnode)
pos = pos, pos = pos,
max_hear_distance = 31, max_hear_distance = 31,
gain = 0.3, gain = 0.3,
}) }, true)
end end
end end
@ -108,7 +108,7 @@ local piston_on = function (pos, node)
pos = pos, pos = pos,
max_hear_distance = 31, max_hear_distance = 31,
gain = 0.3, gain = 0.3,
}) }, true)
end end
end end

View File

@ -50,7 +50,7 @@ local torch_get_input_rules = function(node)
end end
local torch_overheated = function(pos) local torch_overheated = function(pos)
minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.02, max_hear_distance = 6}) minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.02, max_hear_distance = 6}, true)
minetest.add_particle({ minetest.add_particle({
pos = {x=pos.x, y=pos.y+0.2, z=pos.z}, pos = {x=pos.x, y=pos.y+0.2, z=pos.z},
velocity = {x = 0, y = 0.6, z = 0}, velocity = {x = 0, y = 0.6, z = 0},

View File

@ -53,7 +53,7 @@ minetest.register_node("mesecons_walllever:wall_lever_off", {
on_rightclick = function (pos, node) on_rightclick = function (pos, node)
minetest.swap_node(pos, {name="mesecons_walllever:wall_lever_on", param2=node.param2}) minetest.swap_node(pos, {name="mesecons_walllever:wall_lever_on", param2=node.param2})
mesecon.receptor_on(pos, lever_get_output_rules(node)) mesecon.receptor_on(pos, lever_get_output_rules(node))
minetest.sound_play("mesecons_lever", {pos=pos}) minetest.sound_play("mesecons_lever", {pos=pos}, true)
end, end,
node_placement_prediction = "", node_placement_prediction = "",
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
@ -116,7 +116,7 @@ minetest.register_node("mesecons_walllever:wall_lever_off", {
if success then if success then
if idef.sounds and idef.sounds.place then if idef.sounds and idef.sounds.place then
minetest.sound_play(idef.sounds.place, {pos=above, gain=1}) minetest.sound_play(idef.sounds.place, {pos=above, gain=1}, true)
end end
end end
return itemstack return itemstack
@ -152,7 +152,7 @@ minetest.register_node("mesecons_walllever:wall_lever_on", {
on_rightclick = function (pos, node) on_rightclick = function (pos, node)
minetest.swap_node(pos, {name="mesecons_walllever:wall_lever_off", param2=node.param2}) minetest.swap_node(pos, {name="mesecons_walllever:wall_lever_off", param2=node.param2})
mesecon.receptor_off(pos, lever_get_output_rules(node)) mesecon.receptor_off(pos, lever_get_output_rules(node))
minetest.sound_play("mesecons_lever", {pos=pos}) minetest.sound_play("mesecons_lever", {pos=pos}, true)
end, end,
sounds = mcl_sounds.node_sound_stone_defaults(), sounds = mcl_sounds.node_sound_stone_defaults(),
mesecons = {receptor = { mesecons = {receptor = {

View File

@ -220,17 +220,17 @@ local function damage_anvil(pos)
local new local new
if node.name == "mcl_anvils:anvil" then if node.name == "mcl_anvils:anvil" then
minetest.swap_node(pos, {name="mcl_anvils:anvil_damage_1", param2=node.param2}) minetest.swap_node(pos, {name="mcl_anvils:anvil_damage_1", param2=node.param2})
minetest.sound_play(mcl_sounds.node_sound_metal_defaults().dig, {pos=pos, max_hear_distance=16}) minetest.sound_play(mcl_sounds.node_sound_metal_defaults().dig, {pos=pos, max_hear_distance=16}, true)
return false return false
elseif node.name == "mcl_anvils:anvil_damage_1" then elseif node.name == "mcl_anvils:anvil_damage_1" then
minetest.swap_node(pos, {name="mcl_anvils:anvil_damage_2", param2=node.param2}) minetest.swap_node(pos, {name="mcl_anvils:anvil_damage_2", param2=node.param2})
minetest.sound_play(mcl_sounds.node_sound_metal_defaults().dig, {pos=pos, max_hear_distance=16}) minetest.sound_play(mcl_sounds.node_sound_metal_defaults().dig, {pos=pos, max_hear_distance=16}, true)
return false return false
elseif node.name == "mcl_anvils:anvil_damage_2" then elseif node.name == "mcl_anvils:anvil_damage_2" then
-- Destroy anvil -- Destroy anvil
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
drop_anvil_items(pos, meta) drop_anvil_items(pos, meta)
minetest.sound_play(mcl_sounds.node_sound_metal_defaults().dug, {pos=pos, max_hear_distance=16}) minetest.sound_play(mcl_sounds.node_sound_metal_defaults().dug, {pos=pos, max_hear_distance=16}, true)
minetest.remove_node(pos) minetest.remove_node(pos)
minetest.check_single_for_falling({x=pos.x, y=pos.y+1, z=pos.z}) minetest.check_single_for_falling({x=pos.x, y=pos.y+1, z=pos.z})
return true return true

View File

@ -322,7 +322,7 @@ armor.play_equip_sound = function(self, stack, player, pos, unequip)
if pos then if pos then
dist = 16 dist = 16
end end
minetest.sound_play(snd, {object=player, pos=pos, gain=0.5, max_hear_distance=dist}) minetest.sound_play(snd, {object=player, pos=pos, gain=0.5, max_hear_distance=dist}, true)
end end
end end

View File

@ -376,7 +376,7 @@ for colorid, colortab in pairs(mcl_banners.colors) do
minetest.set_node(pointed_thing.under, {name=new_node}) minetest.set_node(pointed_thing.under, {name=new_node})
-- Play sound (from mcl_potions mod) -- Play sound (from mcl_potions mod)
minetest.sound_play("mcl_potions_bottle_pour", {pos=pointed_thing.under, gain=0.5, max_hear_range=16}) minetest.sound_play("mcl_potions_bottle_pour", {pos=pointed_thing.under, gain=0.5, max_hear_range=16}, true)
return itemstack return itemstack
end end
@ -458,7 +458,7 @@ for colorid, colortab in pairs(mcl_banners.colors) do
if not minetest.settings:get_bool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
itemstack:take_item() itemstack:take_item()
end end
minetest.sound_play({name="default_place_node_hard", gain=1.0}, {pos = place_pos}) minetest.sound_play({name="default_place_node_hard", gain=1.0}, {pos = place_pos}, true)
return itemstack return itemstack
end, end,

View File

@ -145,7 +145,7 @@ ARROW_ENTITY.on_step = function(self, dtime)
pos = pos, pos = pos,
max_hear_distance = 16, max_hear_distance = 16,
gain = 1.0, gain = 1.0,
}) }, true)
end end
end end
self.object:remove() self.object:remove()
@ -224,7 +224,7 @@ ARROW_ENTITY.on_step = function(self, dtime)
if is_player then if is_player then
if self._shooter and self._shooter:is_player() then if self._shooter and self._shooter:is_player() then
-- “Ding” sound for hitting another player -- “Ding” sound for hitting another player
minetest.sound_play({name="mcl_bows_hit_player", gain=0.1}, {to_player=self._shooter}) minetest.sound_play({name="mcl_bows_hit_player", gain=0.1}, {to_player=self._shooter}, true)
end end
end end

View File

@ -48,7 +48,7 @@ mcl_bows.shoot_arrow = function(arrow_item, pos, dir, yaw, shooter, power, damag
le._shooter = shooter le._shooter = shooter
le._damage = damage le._damage = damage
le._startpos = pos le._startpos = pos
minetest.sound_play("mcl_bows_bow_shoot", {pos=pos}) minetest.sound_play("mcl_bows_bow_shoot", {pos=pos}, true)
if shooter ~= nil and shooter:is_player() then if shooter ~= nil and shooter:is_player() then
if obj:get_luaentity().player == "" then if obj:get_luaentity().player == "" then
obj:get_luaentity().player = shooter obj:get_luaentity().player = shooter

View File

@ -28,14 +28,14 @@ mcl_buckets.liquids = {}
local sound_place = function(itemname, pos) local sound_place = function(itemname, pos)
local def = minetest.registered_nodes[itemname] local def = minetest.registered_nodes[itemname]
if def and def.sounds and def.sounds.place then if def and def.sounds and def.sounds.place then
minetest.sound_play(def.sounds.place, {gain=1.0, pos = pos, pitch = 1 + math.random(-10, 10)*0.005}) minetest.sound_play(def.sounds.place, {gain=1.0, pos = pos, pitch = 1 + math.random(-10, 10)*0.005}, true)
end end
end end
local sound_take = function(itemname, pos) local sound_take = function(itemname, pos)
local def = minetest.registered_nodes[itemname] local def = minetest.registered_nodes[itemname]
if def and def.sounds and def.sounds.dug then if def and def.sounds and def.sounds.dug then
minetest.sound_play(def.sounds.dug, {gain=1.0, pos = pos, pitch = 1 + math.random(-10, 10)*0.005}) minetest.sound_play(def.sounds.dug, {gain=1.0, pos = pos, pitch = 1 + math.random(-10, 10)*0.005}, true)
end end
end end
@ -346,7 +346,7 @@ if mod_mcl_core then
else else
local dim = mcl_worlds.pos_to_dimension(pos) local dim = mcl_worlds.pos_to_dimension(pos)
if dim == "nether" then if dim == "nether" then
minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}) minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}, true)
return false return false
end end
end end
@ -389,7 +389,7 @@ if mod_mclx_core then
-- Evaporate water if used in Nether (except on cauldron) -- Evaporate water if used in Nether (except on cauldron)
local dim = mcl_worlds.pos_to_dimension(pos) local dim = mcl_worlds.pos_to_dimension(pos)
if dim == "nether" then if dim == "nether" then
minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}) minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}, true)
return false return false
end end
end end

View File

@ -43,7 +43,7 @@ function mcl_cocoas.place(itemstack, placer, pointed_thing, plantname)
-- Add the node, set facedir and remove 1 item from the itemstack -- Add the node, set facedir and remove 1 item from the itemstack
minetest.set_node(pt.above, {name = plantname, param2 = minetest.dir_to_facedir(clickdir)}) minetest.set_node(pt.above, {name = plantname, param2 = minetest.dir_to_facedir(clickdir)})
minetest.sound_play("default_place_node", {pos = pt.above, gain = 1.0}) minetest.sound_play("default_place_node", {pos = pt.above, gain = 1.0}, true)
if not minetest.settings:get_bool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
itemstack:take_item() itemstack:take_item()

View File

@ -21,21 +21,21 @@ minetest.register_abm({
-- Lava on top of water: Water turns into stone -- Lava on top of water: Water turns into stone
if water[w].y < pos.y and water[w].x == pos.x and water[w].z == pos.z then if water[w].y < pos.y and water[w].x == pos.x and water[w].z == pos.z then
minetest.set_node(water[w], {name="mcl_core:stone"}) minetest.set_node(water[w], {name="mcl_core:stone"})
minetest.sound_play("fire_extinguish_flame", {pos = water[w], gain = 0.25, max_hear_distance = 16}) minetest.sound_play("fire_extinguish_flame", {pos = water[w], gain = 0.25, max_hear_distance = 16}, true)
-- Flowing lava vs water on same level: Lava turns into cobblestone -- Flowing lava vs water on same level: Lava turns into cobblestone
elseif lavatype == "flowing" and water[w].y == pos.y and (water[w].x == pos.x or water[w].z == pos.z) then elseif lavatype == "flowing" and water[w].y == pos.y and (water[w].x == pos.x or water[w].z == pos.z) then
minetest.set_node(pos, {name="mcl_core:cobble"}) minetest.set_node(pos, {name="mcl_core:cobble"})
minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}) minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}, true)
-- Lava source vs flowing water above or horizontally neighbored: Lava turns into obsidian -- Lava source vs flowing water above or horizontally neighbored: Lava turns into obsidian
elseif lavatype == "source" and elseif lavatype == "source" and
((water[w].y > pos.y and water[w].x == pos.x and water[w].z == pos.z) or ((water[w].y > pos.y and water[w].x == pos.x and water[w].z == pos.z) or
(water[w].y == pos.y and (water[w].x == pos.x or water[w].z == pos.z))) then (water[w].y == pos.y and (water[w].x == pos.x or water[w].z == pos.z))) then
minetest.set_node(pos, {name="mcl_core:obsidian"}) minetest.set_node(pos, {name="mcl_core:obsidian"})
minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}) minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}, true)
-- Flowing water above flowing lava: Lava turns into cobblestone -- Flowing water above flowing lava: Lava turns into cobblestone
elseif watertype == "flowing" and lavatype == "flowing" and water[w].y > pos.y and water[w].x == pos.x and water[w].z == pos.z then elseif watertype == "flowing" and lavatype == "flowing" and water[w].y > pos.y and water[w].x == pos.x and water[w].z == pos.z then
minetest.set_node(pos, {name="mcl_core:cobble"}) minetest.set_node(pos, {name="mcl_core:cobble"})
minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}) minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}, true)
end end
end end
end, end,
@ -166,7 +166,7 @@ minetest.register_abm({
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
liquid_flow_action(pos, "lava", function(pos) liquid_flow_action(pos, "lava", function(pos)
minetest.remove_node(pos) minetest.remove_node(pos)
minetest.sound_play("builtin_item_lava", {pos = pos, gain = 0.25, max_hear_distance = 16}) minetest.sound_play("builtin_item_lava", {pos = pos, gain = 0.25, max_hear_distance = 16}, true)
core.check_for_falling(pos) core.check_for_falling(pos)
end) end)
end, end,

View File

@ -922,7 +922,7 @@ for i=1,8 do
fakestack:set_name("mcl_core:snow_"..math.min(8, (i+g))) fakestack:set_name("mcl_core:snow_"..math.min(8, (i+g)))
local success local success
itemstack, success = minetest.item_place(fakestack, placer, pointed_thing) itemstack, success = minetest.item_place(fakestack, placer, pointed_thing)
minetest.sound_play(mcl_sounds.node_sound_snow_defaults().place, {pos = below}) minetest.sound_play(mcl_sounds.node_sound_snow_defaults().place, {pos = below}, true)
itemstack:set_name(itemstring) itemstack:set_name(itemstring)
return itemstack return itemstack
end end
@ -932,7 +932,7 @@ for i=1,8 do
local bnode = minetest.get_node(below) local bnode = minetest.get_node(below)
if minetest.get_item_group(bnode.name, "solid") == 1 then if minetest.get_item_group(bnode.name, "solid") == 1 then
minetest.sound_play(mcl_sounds.node_sound_snow_defaults().place, {pos = below}) minetest.sound_play(mcl_sounds.node_sound_snow_defaults().place, {pos = below}, true)
return minetest.item_place_node(itemstack, placer, pointed_thing) return minetest.item_place_node(itemstack, placer, pointed_thing)
else else
return itemstack return itemstack

View File

@ -75,7 +75,7 @@ minetest.register_node("mcl_core:ladder", {
if success then if success then
if idef.sounds and idef.sounds.place then if idef.sounds and idef.sounds.place then
minetest.sound_play(idef.sounds.place, {pos=above, gain=1}) minetest.sound_play(idef.sounds.place, {pos=above, gain=1}, true)
end end
end end
return itemstack return itemstack
@ -146,7 +146,7 @@ minetest.register_node("mcl_core:vine", {
if success then if success then
if idef.sounds and idef.sounds.place then if idef.sounds and idef.sounds.place then
minetest.sound_play(idef.sounds.place, {pos=above, gain=1}) minetest.sound_play(idef.sounds.place, {pos=above, gain=1}, true)
end end
end end
return itemstack return itemstack

View File

@ -155,7 +155,7 @@ function mcl_doors:register_door(name, def)
minetest.set_node(pt2, {name=name.."_t_1", param2=p2}) minetest.set_node(pt2, {name=name.."_t_1", param2=p2})
if def.sounds and def.sounds.place then if def.sounds and def.sounds.place then
minetest.sound_play(def.sounds.place, {pos=pt}) minetest.sound_play(def.sounds.place, {pos=pt}, true)
end end
if def.only_placer_can_open then if def.only_placer_can_open then
@ -225,7 +225,7 @@ function mcl_doors:register_door(name, def)
meta1:set_int("is_open", 1) meta1:set_int("is_open", 1)
meta2:set_int("is_open", 1) meta2:set_int("is_open", 1)
end end
minetest.sound_play(door_switching_sound, {pos = pos, gain = 0.5, max_hear_distance = 16}) minetest.sound_play(door_switching_sound, {pos = pos, gain = 0.5, max_hear_distance = 16}, true)
end end
local function on_mesecons_signal_open(pos, node) local function on_mesecons_signal_open(pos, node)

View File

@ -67,11 +67,11 @@ function mcl_doors:register_trapdoor(name, def)
local tmp_node local tmp_node
-- Close -- Close
if minetest.get_item_group(me.name, "trapdoor") == 2 then if minetest.get_item_group(me.name, "trapdoor") == 2 then
minetest.sound_play(def.sound_close, {pos = pos, gain = 0.3, max_hear_distance = 16}) minetest.sound_play(def.sound_close, {pos = pos, gain = 0.3, max_hear_distance = 16}, true)
tmp_node = {name=name, param1=me.param1, param2=me.param2} tmp_node = {name=name, param1=me.param1, param2=me.param2}
-- Open -- Open
else else
minetest.sound_play(def.sound_open, {pos = pos, gain = 0.3, max_hear_distance = 16}) minetest.sound_play(def.sound_open, {pos = pos, gain = 0.3, max_hear_distance = 16}, true)
tmp_node = {name=name.."_open", param1=me.param1, param2=me.param2} tmp_node = {name=name.."_open", param1=me.param1, param2=me.param2}
end end
minetest.set_node(pos, tmp_node) minetest.set_node(pos, tmp_node)

View File

@ -191,7 +191,7 @@ minetest.register_node("mcl_end:chorus_flower", {
-- Placement OK! Proceed normally -- Placement OK! Proceed normally
local it, suc = minetest.item_place_node(itemstack, placer, pointed_thing) local it, suc = minetest.item_place_node(itemstack, placer, pointed_thing)
if suc then if suc then
minetest.sound_play(mcl_sounds.node_sound_wood_defaults().place, {pos = pos}) minetest.sound_play(mcl_sounds.node_sound_wood_defaults().place, {pos = pos}, true)
end end
return it return it
else else
@ -295,7 +295,7 @@ minetest.register_node("mcl_end:chorus_plant", {
-- Placement OK! Proceed normally -- Placement OK! Proceed normally
local it, suc = minetest.item_place_node(itemstack, placer, pointed_thing) local it, suc = minetest.item_place_node(itemstack, placer, pointed_thing)
if suc then if suc then
minetest.sound_play(mcl_sounds.node_sound_wood_defaults().place, {pos = pos_place}) minetest.sound_play(mcl_sounds.node_sound_wood_defaults().place, {pos = pos_place}, true)
end end
return it return it
else else
@ -516,7 +516,7 @@ local random_teleport = function(player)
-- JACKPOT! Now we can teleport. -- JACKPOT! Now we can teleport.
local goal = {x=tpos.x, y=tpos.y-1.5, z=tpos.z} local goal = {x=tpos.x, y=tpos.y-1.5, z=tpos.z}
player:set_pos(goal) player:set_pos(goal)
minetest.sound_play({name="mcl_end_teleport", gain=0.8}, {pos=goal, max_hear_distance=16}) minetest.sound_play({name="mcl_end_teleport", gain=0.8}, {pos=goal, max_hear_distance=16}, true)
return true return true
end end
end end

View File

@ -11,14 +11,14 @@ local function create_soil(pos, inv)
if above.name == "air" then if above.name == "air" then
node.name = "mcl_farming:soil" node.name = "mcl_farming:soil"
minetest.set_node(pos, node) minetest.set_node(pos, node)
minetest.sound_play("default_dig_crumbly", { pos = pos, gain = 0.5 }) minetest.sound_play("default_dig_crumbly", { pos = pos, gain = 0.5 }, true)
return true return true
end end
elseif minetest.get_item_group(name, "cultivatable") == 1 then elseif minetest.get_item_group(name, "cultivatable") == 1 then
if above.name == "air" then if above.name == "air" then
node.name = "mcl_core:dirt" node.name = "mcl_core:dirt"
minetest.set_node(pos, node) minetest.set_node(pos, node)
minetest.sound_play("default_dig_crumbly", { pos = pos, gain = 0.6 }) minetest.sound_play("default_dig_crumbly", { pos = pos, gain = 0.6 }, true)
return true return true
end end
end end

View File

@ -84,7 +84,7 @@ function mcl_farming:place_seed(itemstack, placer, pointed_thing, plantname)
local place_s = minetest.get_node(pos) local place_s = minetest.get_node(pos)
if string.find(farmland.name, "mcl_farming:soil") and string.find(place_s.name, "air") then if string.find(farmland.name, "mcl_farming:soil") and string.find(place_s.name, "air") then
minetest.sound_play(minetest.registered_nodes[plantname].sounds.place, {pos = pos}) minetest.sound_play(minetest.registered_nodes[plantname].sounds.place, {pos = pos}, true)
minetest.add_node(pos, {name=plantname, param2 = minetest.registered_nodes[plantname].place_param2}) minetest.add_node(pos, {name=plantname, param2 = minetest.registered_nodes[plantname].place_param2})
else else
return return

View File

@ -102,11 +102,11 @@ mcl_fences.register_fence_gate = function(id, fence_gate_name, texture, groups,
local tmp_node2 local tmp_node2
if state2 == 1 then if state2 == 1 then
state2 = 0 state2 = 0
minetest.sound_play(sound_close, {gain = sound_gain_close, max_hear_distance = 10, pos = pos}) minetest.sound_play(sound_close, {gain = sound_gain_close, max_hear_distance = 10, pos = pos}, true)
tmp_node2 = {name=gate_id, param1=node.param1, param2=node.param2} tmp_node2 = {name=gate_id, param1=node.param1, param2=node.param2}
else else
state2 = 1 state2 = 1
minetest.sound_play(sound_open, {gain = sound_gain_open, max_hear_distance = 10, pos = pos}) minetest.sound_play(sound_open, {gain = sound_gain_open, max_hear_distance = 10, pos = pos}, true)
tmp_node2 = {name=open_gate_id, param1=node.param1, param2=node.param2} tmp_node2 = {name=open_gate_id, param1=node.param1, param2=node.param2}
end end
update_gate(pos, tmp_node2) update_gate(pos, tmp_node2)

View File

@ -28,7 +28,8 @@ minetest.register_tool("mcl_fire:flint_and_steel", {
local idef = itemstack:get_definition() local idef = itemstack:get_definition()
minetest.sound_play( minetest.sound_play(
"fire_flint_and_steel", "fire_flint_and_steel",
{pos = pointed_thing.above, gain = 0.5, max_hear_distance = 8} {pos = pointed_thing.above, gain = 0.5, max_hear_distance = 8},
true
) )
local used = false local used = false
if pointed_thing.type == "node" then if pointed_thing.type == "node" then
@ -44,7 +45,7 @@ minetest.register_tool("mcl_fire:flint_and_steel", {
used = true used = true
end end
if itemstack:get_count() == 0 and idef.sound and idef.sound.breaks then if itemstack:get_count() == 0 and idef.sound and idef.sound.breaks then
minetest.sound_play(idef.sound.breaks, {pos=user:get_pos(), gain=0.5}) minetest.sound_play(idef.sound.breaks, {pos=user:get_pos(), gain=0.5}, true)
end end
if not minetest.settings:get_bool("creative_mode") and used == true then if not minetest.settings:get_bool("creative_mode") and used == true then
itemstack:add_wear(65535/65) -- 65 uses itemstack:add_wear(65535/65) -- 65 uses

View File

@ -67,7 +67,7 @@ minetest.register_node("mcl_fire:fire", {
floodable = true, floodable = true,
on_flood = function(pos, oldnode, newnode) on_flood = function(pos, oldnode, newnode)
if minetest.get_item_group(newnode.name, "water") ~= 0 then if minetest.get_item_group(newnode.name, "water") ~= 0 then
minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}) minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}, true)
end end
end, end,
on_timer = function(pos) on_timer = function(pos)
@ -151,7 +151,7 @@ minetest.register_node("mcl_fire:eternal_fire", {
floodable = true, floodable = true,
on_flood = function(pos, oldnode, newnode) on_flood = function(pos, oldnode, newnode)
if minetest.get_item_group(newnode.name, "water") ~= 0 then if minetest.get_item_group(newnode.name, "water") ~= 0 then
minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}) minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}, true)
end end
end, end,
on_timer = function(pos) on_timer = function(pos)
@ -310,7 +310,7 @@ minetest.register_abm({
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
minetest.remove_node(pos) minetest.remove_node(pos)
minetest.sound_play("fire_extinguish_flame", minetest.sound_play("fire_extinguish_flame",
{pos = pos, max_hear_distance = 16, gain = 0.15}) {pos = pos, max_hear_distance = 16, gain = 0.15}, true)
end, end,
}) })

View File

@ -105,7 +105,7 @@ local fish = function(itemstack, player)
local idef = itemstack:get_definition() local idef = itemstack:get_definition()
itemstack:add_wear(65535/65) -- 65 uses itemstack:add_wear(65535/65) -- 65 uses
if itemstack:get_count() == 0 and idef.sound and idef.sound.breaks then if itemstack:get_count() == 0 and idef.sound and idef.sound.breaks then
minetest.sound_play(idef.sound.breaks, {pos=player:get_pos(), gain=0.5}) minetest.sound_play(idef.sound.breaks, {pos=player:get_pos(), gain=0.5}, true)
end end
end end
end end
@ -119,7 +119,7 @@ local fish = function(itemstack, player)
local idef = itemstack:get_definition() local idef = itemstack:get_definition()
itemstack:add_wear((65535/65)*2) -- if so and not creative then wear double like in MC. itemstack:add_wear((65535/65)*2) -- if so and not creative then wear double like in MC.
if itemstack:get_count() == 0 and idef.sound and idef.sound.breaks then if itemstack:get_count() == 0 and idef.sound and idef.sound.breaks then
minetest.sound_play(idef.sound.breaks, {pos=player:get_pos(), gain=0.5}) minetest.sound_play(idef.sound.breaks, {pos=player:get_pos(), gain=0.5}, true)
end end
end end
end end

View File

@ -265,7 +265,7 @@ local function add_large_plant(name, desc, longdesc, bottom_img, top_img, inv_im
param2 = get_palette_color_from_pos(bottom) param2 = get_palette_color_from_pos(bottom)
end end
-- Success! We can now place the flower -- Success! We can now place the flower
minetest.sound_play(minetest.registered_nodes[itemstring].sounds.place, {pos = bottom, gain=1}) minetest.sound_play(minetest.registered_nodes[itemstring].sounds.place, {pos = bottom, gain=1}, true)
minetest.set_node(bottom, {name=itemstring, param2=param2}) minetest.set_node(bottom, {name=itemstring, param2=param2})
minetest.set_node(top, {name=itemstring.."_top", param2=param2}) minetest.set_node(top, {name=itemstring.."_top", param2=param2})
if not minetest.settings:get_bool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
@ -420,7 +420,7 @@ minetest.register_node("mcl_flowers:waterlily", {
local idef = itemstack:get_definition() local idef = itemstack:get_definition()
if idef.sounds and idef.sounds.place then if idef.sounds and idef.sounds.place then
minetest.sound_play(idef.sounds.place, {pos=pointed_thing.above, gain=1}) minetest.sound_play(idef.sounds.place, {pos=pointed_thing.above, gain=1}, true)
end end
if not minetest.settings:get_bool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then

View File

@ -125,7 +125,7 @@ minetest.register_craftitem("mcl_nether:nether_wart_item", {
-- Check if node above soil node allows placement -- Check if node above soil node allows placement
if minetest.registered_items[minetest.get_node(placepos).name].buildable_to then if minetest.registered_items[minetest.get_node(placepos).name].buildable_to then
-- Place nether wart -- Place nether wart
minetest.sound_play({name="default_place_node", gain=1.0}, {pos=placepos}) minetest.sound_play({name="default_place_node", gain=1.0}, {pos=placepos}, true)
minetest.set_node(placepos, {name="mcl_nether:nether_wart_0", param2 = 3}) minetest.set_node(placepos, {name="mcl_nether:nether_wart_0", param2 = 3})
if not minetest.settings:get_bool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then

View File

@ -59,7 +59,7 @@ local function coral_on_place(itemstack, placer, pointed_thing)
minetest.set_node(pos_under, node_under) minetest.set_node(pos_under, node_under)
local def_node = minetest.registered_nodes[node_under.name] local def_node = minetest.registered_nodes[node_under.name]
if def_node.sounds then if def_node.sounds then
minetest.sound_play(def_node.sounds.place, { gain = 0.5, pos = pos_under }) minetest.sound_play(def_node.sounds.place, { gain = 0.5, pos = pos_under }, true)
end end
if not (minetest.settings:get_bool("creative_mode")) then if not (minetest.settings:get_bool("creative_mode")) then
itemstack:take_item() itemstack:take_item()

View File

@ -120,7 +120,7 @@ local function kelp_on_place(itemstack, placer, pointed_thing)
-- Place or grow kelp -- Place or grow kelp
local def_node = minetest.registered_items[node_under.name] local def_node = minetest.registered_items[node_under.name]
if def_node.sounds then if def_node.sounds then
minetest.sound_play(def_node.sounds.place, { gain = 0.5, pos = pos_under }) minetest.sound_play(def_node.sounds.place, { gain = 0.5, pos = pos_under }, true)
end end
minetest.set_node(pos_under, node_under) minetest.set_node(pos_under, node_under)
if not (minetest.settings:get_bool("creative_mode")) then if not (minetest.settings:get_bool("creative_mode")) then

View File

@ -67,7 +67,7 @@ local function seagrass_on_place(itemstack, placer, pointed_thing)
end end
local def_node = minetest.registered_items[node_under.name] local def_node = minetest.registered_items[node_under.name]
if def_node.sounds then if def_node.sounds then
minetest.sound_play(def_node.sounds.place, { gain = 0.5, pos = pos_under }) minetest.sound_play(def_node.sounds.place, { gain = 0.5, pos = pos_under }, true)
end end
minetest.set_node(pos_under, node_under) minetest.set_node(pos_under, node_under)
if not (minetest.settings:get_bool("creative_mode")) then if not (minetest.settings:get_bool("creative_mode")) then

View File

@ -293,7 +293,7 @@ minetest.register_abm({
obj:set_look_horizontal(math.pi/2) obj:set_look_horizontal(math.pi/2)
end end
mcl_worlds.dimension_change(obj, mcl_worlds.pos_to_dimension(target)) mcl_worlds.dimension_change(obj, mcl_worlds.pos_to_dimension(target))
minetest.sound_play("mcl_portals_teleport", {pos=target, gain=0.5, max_hear_distance = 16}) minetest.sound_play("mcl_portals_teleport", {pos=target, gain=0.5, max_hear_distance = 16}, true)
end end
end end
end end
@ -404,7 +404,7 @@ minetest.override_item("mcl_end:ender_eye", {
end end
minetest.sound_play( minetest.sound_play(
"default_place_node_hard", "default_place_node_hard",
{pos = pointed_thing.under, gain = 0.5, max_hear_distance = 16}) {pos = pointed_thing.under, gain = 0.5, max_hear_distance = 16}, true)
if not minetest.settings:get_bool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
itemstack:take_item() -- 1 use itemstack:take_item() -- 1 use
end end

View File

@ -447,7 +447,7 @@ minetest.register_abm({
obj:set_pos(target) obj:set_pos(target)
if obj:is_player() then if obj:is_player() then
mcl_worlds.dimension_change(obj, mcl_worlds.pos_to_dimension(target)) mcl_worlds.dimension_change(obj, mcl_worlds.pos_to_dimension(target))
minetest.sound_play("mcl_portals_teleport", {pos=target, gain=0.5, max_hear_distance = 16}) minetest.sound_play("mcl_portals_teleport", {pos=target, gain=0.5, max_hear_distance = 16}, true)
end end
-- Enable teleportation cooloff for some seconds, to prevent back-and-forth teleportation -- Enable teleportation cooloff for some seconds, to prevent back-and-forth teleportation

View File

@ -108,7 +108,7 @@ minetest.register_craftitem("mcl_potions:glass_bottle", {
itemstack:take_item() itemstack:take_item()
end end
end end
minetest.sound_play("mcl_potions_bottle_fill", {pos=pointed_thing.under, gain=0.5, max_hear_range=16}) minetest.sound_play("mcl_potions_bottle_fill", {pos=pointed_thing.under, gain=0.5, max_hear_range=16}, true)
end end
end end
return itemstack return itemstack
@ -188,7 +188,7 @@ minetest.register_craftitem("mcl_potions:potion_water", {
end end
-- Increase water level of cauldron by 1 -- Increase water level of cauldron by 1
minetest.set_node(pointed_thing.under, {name=cauldron}) minetest.set_node(pointed_thing.under, {name=cauldron})
minetest.sound_play("mcl_potions_bottle_pour", {pos=pointed_thing.under, gain=0.5, max_hear_range=16}) minetest.sound_play("mcl_potions_bottle_pour", {pos=pointed_thing.under, gain=0.5, max_hear_range=16}, true)
if minetest.settings:get_bool("creative_mode") == true then if minetest.settings:get_bool("creative_mode") == true then
return itemstack return itemstack
else else
@ -234,7 +234,7 @@ minetest.register_craftitem("mcl_potions:potion_river_water", {
end end
-- Increase water level of cauldron by 1 -- Increase water level of cauldron by 1
minetest.set_node(pointed_thing.under, {name=cauldron}) minetest.set_node(pointed_thing.under, {name=cauldron})
minetest.sound_play("mcl_potions_bottle_pour", {pos=pointed_thing.under, gain=0.5, max_hear_range=16}) minetest.sound_play("mcl_potions_bottle_pour", {pos=pointed_thing.under, gain=0.5, max_hear_range=16}, true)
if minetest.settings:get_bool("creative_mode") == true then if minetest.settings:get_bool("creative_mode") == true then
return itemstack return itemstack
else else

View File

@ -391,7 +391,7 @@ minetest.register_node("mcl_signs:wall_sign", {
text_entity:set_yaw(sign_info.yaw) text_entity:set_yaw(sign_info.yaw)
text_entity:get_luaentity()._signnodename = nodeitem:get_name() text_entity:get_luaentity()._signnodename = nodeitem:get_name()
minetest.sound_play({name="default_place_node_hard", gain=1.0}, {pos = place_pos}) minetest.sound_play({name="default_place_node_hard", gain=1.0}, {pos = place_pos}, true)
show_formspec(placer, place_pos) show_formspec(placer, place_pos)
return itemstack return itemstack

View File

@ -182,14 +182,14 @@ local snowball_on_step = function(self, dtime)
-- Destroy when hitting a solid node -- Destroy when hitting a solid node
if self._lastpos.x~=nil then if self._lastpos.x~=nil then
if (def and def.walkable) or not def then if (def and def.walkable) or not def then
minetest.sound_play("mcl_throwing_snowball_impact_hard", { pos = self.object:get_pos(), max_hear_distance=16, gain=0.7 }) minetest.sound_play("mcl_throwing_snowball_impact_hard", { pos = self.object:get_pos(), max_hear_distance=16, gain=0.7 }, true)
self.object:remove() self.object:remove()
return return
end end
end end
if check_object_hit(self, pos, {snowball_vulnerable = 3}) then if check_object_hit(self, pos, {snowball_vulnerable = 3}) then
minetest.sound_play("mcl_throwing_snowball_impact_soft", { pos = self.object:get_pos(), max_hear_distance=16, gain=0.7 }) minetest.sound_play("mcl_throwing_snowball_impact_soft", { pos = self.object:get_pos(), max_hear_distance=16, gain=0.7 }, true)
return return
end end
@ -243,7 +243,7 @@ local egg_on_step = function(self, dtime)
end end
end end
end end
minetest.sound_play("mcl_throwing_egg_impact", { pos = self.object:get_pos(), max_hear_distance=10, gain=0.5 }) minetest.sound_play("mcl_throwing_egg_impact", { pos = self.object:get_pos(), max_hear_distance=10, gain=0.5 }, true)
self.object:remove() self.object:remove()
return return
end end
@ -251,7 +251,7 @@ local egg_on_step = function(self, dtime)
-- Destroy when hitting a mob or player (no chick spawning) -- Destroy when hitting a mob or player (no chick spawning)
if check_object_hit(self, pos) then if check_object_hit(self, pos) then
minetest.sound_play("mcl_throwing_egg_impact", { pos = self.object:get_pos(), max_hear_distance=10, gain=0.5 }) minetest.sound_play("mcl_throwing_egg_impact", { pos = self.object:get_pos(), max_hear_distance=10, gain=0.5 }, true)
return return
end end

View File

@ -4,7 +4,7 @@ local tnt_griefing = minetest.settings:get_bool("mcl_tnt_griefing", true)
local mod_death_messages = minetest.get_modpath("mcl_death_messages") local mod_death_messages = minetest.get_modpath("mcl_death_messages")
local function spawn_tnt(pos, entname) local function spawn_tnt(pos, entname)
minetest.sound_play("tnt_ignite", {pos = pos,gain = 1.0,max_hear_distance = 15,}) minetest.sound_play("tnt_ignite", {pos = pos,gain = 1.0,max_hear_distance = 15,}, true)
local tnt = minetest.add_entity(pos, entname) local tnt = minetest.add_entity(pos, entname)
tnt:set_armor_groups({immortal=1}) tnt:set_armor_groups({immortal=1})
return tnt return tnt
@ -228,7 +228,7 @@ tnt.boom = function(pos, info)
if info.is_tnt == nil then if info.is_tnt == nil then
info.is_tnt = true info.is_tnt = true
end end
minetest.sound_play(sound, {pos = pos,gain = 1.0,max_hear_distance = 16,}) minetest.sound_play(sound, {pos = pos,gain = 1.0,max_hear_distance = 16,}, true)
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
if minetest.get_item_group("water") == 1 or minetest.get_item_group("lava") == 1 then if minetest.get_item_group("water") == 1 or minetest.get_item_group("lava") == 1 then
-- Cancel the Explosion -- Cancel the Explosion

View File

@ -217,7 +217,7 @@ local make_grass_path = function(itemstack, placer, pointed_thing)
local wear = math.ceil(65535 / uses) local wear = math.ceil(65535 / uses)
itemstack:add_wear(wear) itemstack:add_wear(wear)
end end
minetest.sound_play({name="default_grass_footstep", gain=1}, {pos = above}) minetest.sound_play({name="default_grass_footstep", gain=1}, {pos = above}, true)
minetest.swap_node(pointed_thing.under, {name="mcl_core:grass_path"}) minetest.swap_node(pointed_thing.under, {name="mcl_core:grass_path"})
end end
end end
@ -251,7 +251,7 @@ if minetest.get_modpath("mcl_farming") then
local wear = math.ceil(65535 / uses) local wear = math.ceil(65535 / uses)
itemstack:add_wear(wear) itemstack:add_wear(wear)
end end
minetest.sound_play({name="default_grass_footstep", gain=1}, {pos = above}) minetest.sound_play({name="default_grass_footstep", gain=1}, {pos = above}, true)
local dir = vector.subtract(pointed_thing.under, pointed_thing.above) local dir = vector.subtract(pointed_thing.under, pointed_thing.above)
local param2 = minetest.dir_to_facedir(dir) local param2 = minetest.dir_to_facedir(dir)
minetest.swap_node(pointed_thing.under, {name="mcl_farming:pumpkin_face", param2 = param2}) minetest.swap_node(pointed_thing.under, {name="mcl_farming:pumpkin_face", param2 = param2})

View File

@ -127,7 +127,7 @@ mcl_torches.register_torch = function(substring, description, doc_items_longdesc
itemstack:set_name(itemstring) itemstack:set_name(itemstring)
if success and idef.sounds and idef.sounds.place then if success and idef.sounds and idef.sounds.place then
minetest.sound_play(idef.sounds.place, {pos=under, gain=1}) minetest.sound_play(idef.sounds.place, {pos=under, gain=1}, true)
end end
return itemstack return itemstack
end, end,

View File

@ -149,7 +149,7 @@ function mcl_hunger.item_eat(hunger_change, replace_with_item, poisontime, poiso
gain = 1.0, gain = 1.0,
pitch = 1 + math.random(-10, 10)*0.005, pitch = 1 + math.random(-10, 10)*0.005,
object = user, object = user,
}) }, true)
else else
-- Assume the item is a food -- Assume the item is a food
-- Add eat particle effect and sound -- Add eat particle effect and sound
@ -188,7 +188,7 @@ function mcl_hunger.item_eat(hunger_change, replace_with_item, poisontime, poiso
gain = 1.0, gain = 1.0,
pitch = 1 + math.random(-10, 10)*0.005, pitch = 1 + math.random(-10, 10)*0.005,
object = user, object = user,
}) }, true)
end end
if mcl_hunger.active and hunger_change then if mcl_hunger.active and hunger_change then