Use ephemeral sounds
This commit is contained in:
parent
16e375f952
commit
30af9afa8a
@ -54,7 +54,7 @@ for b=1, #water_buckets do
|
||||
|
||||
if not above_nodedef.walkable then
|
||||
minetest.add_node(pos, {name = bucket[4]})
|
||||
minetest.sound_play({name="default_place_node_water", gain=1.0}, {pos=pos})
|
||||
minetest.sound_play({name="default_place_node_water", gain=1.0}, {pos=pos}, true)
|
||||
end
|
||||
|
||||
return itemstack
|
||||
@ -103,7 +103,7 @@ minetest.register_craftitem(
|
||||
end
|
||||
end
|
||||
minetest.remove_node(pointed_thing.under)
|
||||
minetest.sound_play({name="default_dug_water", gain=1.0}, {pos=pointed_thing.pos})
|
||||
minetest.sound_play({name="default_dug_water", gain=1.0}, {pos=pointed_thing.pos}, true)
|
||||
return itemstack
|
||||
end
|
||||
|
||||
|
@ -1036,7 +1036,7 @@ minetest.register_node(
|
||||
-- Trim tall grass with shears
|
||||
_on_trim = function(pos, node, player, itemstack)
|
||||
-- This turns it to a normal grass clump and drops one bonus grass clump
|
||||
minetest.sound_play({name = "default_shears_cut", gain = 0.5}, {pos = player:get_pos(), max_hear_distance = 8})
|
||||
minetest.sound_play({name = "default_shears_cut", gain = 0.5}, {pos = player:get_pos(), max_hear_distance = 8}, true)
|
||||
minetest.set_node(pos, {name = "default:grass"})
|
||||
|
||||
item_drop.drop_item(pos, "default:grass")
|
||||
|
@ -85,7 +85,7 @@ function door.register_door(name, def)
|
||||
minetest.get_meta(pt2):set_int("right", 1)
|
||||
end
|
||||
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
|
||||
|
||||
if not minetest.settings:get_bool("creative_mode") then
|
||||
@ -133,7 +133,7 @@ function door.register_door(name, def)
|
||||
pos = pos,
|
||||
gain = 0.8,
|
||||
max_hear_distance = 10
|
||||
})
|
||||
}, true)
|
||||
else
|
||||
minetest.sound_play(
|
||||
snd_2,
|
||||
@ -141,7 +141,7 @@ function door.register_door(name, def)
|
||||
pos = pos,
|
||||
gain = 0.8,
|
||||
max_hear_distance = 10
|
||||
})
|
||||
}, true)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -203,7 +203,7 @@ local trim_cotton = function(pos, node, player, tool)
|
||||
-- This cuts down the cotton plant to stage 1 and might drop some bonus goodies
|
||||
|
||||
local name = tool:get_name()
|
||||
minetest.sound_play({name = "default_shears_cut", gain = 0.5}, {pos = player:get_pos(), max_hear_distance = 8})
|
||||
minetest.sound_play({name = "default_shears_cut", gain = 0.5}, {pos = player:get_pos(), max_hear_distance = 8}, true)
|
||||
minetest.set_node(pos, {name = "farming:cotton_2"})
|
||||
|
||||
-- Drop some seeds
|
||||
|
@ -200,7 +200,7 @@ local function on_item_eat(hpdata, replace_with_item, itemstack,
|
||||
local headpos = player:get_pos()
|
||||
|
||||
headpos.y = headpos.y + 1
|
||||
minetest.sound_play("hunger_eat", {pos = headpos, max_hear_distance = 8, object=player})
|
||||
minetest.sound_play("hunger_eat", {pos = headpos, max_hear_distance = 8, object=player}, true)
|
||||
|
||||
particlespawners[name] = minetest.add_particlespawner(
|
||||
{
|
||||
@ -303,7 +303,7 @@ local function on_globalstep(dtime)
|
||||
if (oldhng == 5 or oldhng == 3) and hp >= 0 then
|
||||
minetest.chat_send_player(name, minetest.colorize("#ff0", S("You are hungry.")))
|
||||
local pos_sound = player:get_pos()
|
||||
minetest.sound_play({name="hunger_hungry"}, {pos=pos_sound, max_hear_distance=3, object=player})
|
||||
minetest.sound_play({name="hunger_hungry"}, {pos=pos_sound, max_hear_distance=3, object=player}, true)
|
||||
end
|
||||
if hunger.userdata[name].hunger <= 0 and hp >= 0 then
|
||||
player:set_hp(hp - 1)
|
||||
@ -343,7 +343,7 @@ local function fake_on_item_eat(hpdata, replace_with_item, itemstack,
|
||||
pos = headpos,
|
||||
max_hear_distance = 8,
|
||||
object = player,
|
||||
})
|
||||
}, true)
|
||||
|
||||
if not minetest.settings:get_bool("creative_mode") then
|
||||
itemstack:take_item(1)
|
||||
|
@ -98,7 +98,7 @@ minetest.register_globalstep(
|
||||
pos = pos,
|
||||
gain = 0.3,
|
||||
max_hear_distance = 16
|
||||
})
|
||||
}, true)
|
||||
end
|
||||
-- Notify nav mod of inventory change
|
||||
if nav_mod and lua.itemstring == "nav:map" then
|
||||
|
@ -340,14 +340,14 @@ minetest.register_node(
|
||||
itemstack_changed = true
|
||||
end
|
||||
|
||||
minetest.sound_play({name="jewels_jewelling_a_tool"}, {gain=0.8, pos=pos, max_hear_distance=8})
|
||||
minetest.sound_play({name="jewels_jewelling_a_tool"}, {gain=0.8, pos=pos, max_hear_distance=8}, true)
|
||||
-- TODO: Graphical effect
|
||||
|
||||
achievements.trigger_achievement(player, "jeweler")
|
||||
achievements.trigger_achievement(player, "master_jeweler")
|
||||
else
|
||||
-- Failure
|
||||
minetest.sound_play({name="jewels_jewelling_fail"}, {gain=0.8, pos=pos, max_hear_distance=8})
|
||||
minetest.sound_play({name="jewels_jewelling_fail"}, {gain=0.8, pos=pos, max_hear_distance=8}, true)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -119,10 +119,10 @@ minetest.register_tool(
|
||||
minetest.colorize("#0f0", S("You have broken the lock!")))
|
||||
end
|
||||
achievements.trigger_achievement(player, "burglar")
|
||||
minetest.sound_play({name="locks_unlock",gain=0.8},{pos=pos, max_hear_distance=16})
|
||||
minetest.sound_play({name="locks_unlock",gain=0.8},{pos=pos, max_hear_distance=16}, true)
|
||||
else
|
||||
-- Failure!
|
||||
minetest.sound_play({name="locks_pick",gain=0.5},{pos=pos, max_hear_distance=16})
|
||||
minetest.sound_play({name="locks_pick",gain=0.5},{pos=pos, max_hear_distance=16}, true)
|
||||
end
|
||||
|
||||
if not minetest.settings:get_bool("creative_mode") then
|
||||
|
@ -62,7 +62,7 @@ local function mob_sound(self, sound, keep_pitch)
|
||||
pitch = pitch,
|
||||
object = self.object,
|
||||
max_hear_distance = self.sounds.distance
|
||||
})
|
||||
}, true)
|
||||
end
|
||||
|
||||
|
||||
@ -1078,7 +1078,7 @@ function mobs:register_mob(name, def)
|
||||
pos = pos,
|
||||
gain = 1.0,
|
||||
max_hear_distance = 16
|
||||
})
|
||||
}, true)
|
||||
end
|
||||
effect(pos, 15, "tnt_smoke.png", 5)
|
||||
return
|
||||
@ -1386,7 +1386,7 @@ function mobs:register_mob(name, def)
|
||||
minetest.sound_play("default_punch", {
|
||||
object = hitter,
|
||||
max_hear_distance = 5
|
||||
})
|
||||
}, true)
|
||||
|
||||
-- exit here if dead
|
||||
if check_for_death(self, hitter, damage) then
|
||||
|
@ -102,7 +102,7 @@ mobs:register_mob(
|
||||
local pos = self.object:get_pos()
|
||||
pos.y = pos.y + 0.5
|
||||
local obj = minetest.add_item(pos, ItemStack("mobs:wool"))
|
||||
minetest.sound_play({name = "default_shears_cut", gain = 0.5}, {pos = clicker:get_pos(), max_hear_distance = 8})
|
||||
minetest.sound_play({name = "default_shears_cut", gain = 0.5}, {pos = clicker:get_pos(), max_hear_distance = 8}, true)
|
||||
if obj then
|
||||
obj:set_velocity(
|
||||
{
|
||||
|
@ -159,7 +159,7 @@ end
|
||||
function tnt.burn(pos)
|
||||
local name = minetest.get_node(pos).name
|
||||
if tnt_enable and name == "tnt:tnt" then
|
||||
minetest.sound_play("tnt_ignite", {pos = pos})
|
||||
minetest.sound_play("tnt_ignite", {pos = pos}, true)
|
||||
minetest.set_node(pos, {name = "tnt:tnt_burning"})
|
||||
minetest.get_node_timer(pos):start(2)
|
||||
end
|
||||
@ -174,7 +174,7 @@ function tnt.explode(pos, radius, sound)
|
||||
pos = pos,
|
||||
gain = 1.5,
|
||||
max_hear_distance = 128
|
||||
})
|
||||
}, true)
|
||||
|
||||
local pos = vector.round(pos)
|
||||
local vm = VoxelManip()
|
||||
|
Loading…
Reference in New Issue
Block a user