Make sounds ephemeral (#521)

The handles were never used anyway
This commit is contained in:
Vitaliy 2020-08-01 16:10:14 +03:00 committed by GitHub
parent 01332a7ba1
commit c1eccba247
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 16 additions and 24 deletions

@ -8,7 +8,7 @@ mesecon.button_turnoff = function (pos)
return return
end end
minetest.swap_node(pos, {name = "mesecons_button:button_off", param2 = node.param2}) minetest.swap_node(pos, {name = "mesecons_button:button_off", param2 = node.param2})
minetest.sound_play("mesecons_button_pop", {pos = pos}) minetest.sound_play("mesecons_button_pop", { pos = pos }, true)
local rules = mesecon.rules.buttonlike_get(node) local rules = mesecon.rules.buttonlike_get(node)
mesecon.receptor_off(pos, rules) mesecon.receptor_off(pos, rules)
end end
@ -46,7 +46,7 @@ minetest.register_node("mesecons_button:button_off", {
on_rightclick = function (pos, node) on_rightclick = function (pos, node)
minetest.swap_node(pos, {name = "mesecons_button:button_on", param2=node.param2}) minetest.swap_node(pos, {name = "mesecons_button:button_on", param2=node.param2})
mesecon.receptor_on(pos, mesecon.rules.buttonlike_get(node)) mesecon.receptor_on(pos, mesecon.rules.buttonlike_get(node))
minetest.sound_play("mesecons_button_push", {pos=pos}) minetest.sound_play("mesecons_button_push", { pos = pos }, true)
minetest.get_node_timer(pos):start(1) minetest.get_node_timer(pos):start(1)
end, end,
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),

@ -13,9 +13,9 @@ local function on_rightclick(pos, dir, check_name, replace, replace_dir, params)
minetest.swap_node(pos, {name = replace, param2 = p2}) minetest.swap_node(pos, {name = replace, param2 = p2})
if (minetest.get_meta(pos):get_int("right") ~= 0) == (params[1] ~= 3) then if (minetest.get_meta(pos):get_int("right") ~= 0) == (params[1] ~= 3) then
minetest.sound_play("doors_door_close", {pos = pos, gain = 0.3, max_hear_distance = 10}) minetest.sound_play("doors_door_close", { pos = pos, gain = 0.3, max_hear_distance = 10 }, true)
else else
minetest.sound_play("doors_door_open", {pos = pos, gain = 0.3, max_hear_distance = 10}) minetest.sound_play("doors_door_open", { pos = pos, gain = 0.3, max_hear_distance = 10 }, true)
end end
end end
@ -79,10 +79,10 @@ local function trapdoor_switch(pos, node)
local state = minetest.get_meta(pos):get_int("state") local state = minetest.get_meta(pos):get_int("state")
if state == 1 then if state == 1 then
minetest.sound_play("doors_door_close", {pos = pos, gain = 0.3, max_hear_distance = 10}) minetest.sound_play("doors_door_close", { pos = pos, gain = 0.3, max_hear_distance = 10 }, true)
minetest.set_node(pos, {name="doors:trapdoor", param2 = node.param2}) minetest.set_node(pos, {name="doors:trapdoor", param2 = node.param2})
else else
minetest.sound_play("doors_door_open", {pos = pos, gain = 0.3, max_hear_distance = 10}) minetest.sound_play("doors_door_open", { pos = pos, gain = 0.3, max_hear_distance = 10 }, true)
minetest.set_node(pos, {name="doors:trapdoor_open", param2 = node.param2}) minetest.set_node(pos, {name="doors:trapdoor_open", param2 = node.param2})
end end

@ -18,12 +18,12 @@ minetest.register_tool("mesecons_fpga:programmer", {
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
if meta:get_string("instr") == "//////////////" then if meta:get_string("instr") == "//////////////" then
minetest.chat_send_player(placer:get_player_name(), "This FPGA is unprogrammed.") minetest.chat_send_player(placer:get_player_name(), "This FPGA is unprogrammed.")
minetest.sound_play("mesecons_fpga_fail", { pos = placer:get_pos(), gain = 0.1, max_hear_distance = 4 }) minetest.sound_play("mesecons_fpga_fail", { pos = placer:get_pos(), gain = 0.1, max_hear_distance = 4 }, true)
return itemstack return itemstack
end end
itemstack:set_metadata(meta:get_string("instr")) itemstack:set_metadata(meta:get_string("instr"))
minetest.chat_send_player(placer:get_player_name(), "FPGA gate configuration was successfully copied!") minetest.chat_send_player(placer:get_player_name(), "FPGA gate configuration was successfully copied!")
minetest.sound_play("mesecons_fpga_copy", { pos = placer:get_pos(), gain = 0.1, max_hear_distance = 4 }) minetest.sound_play("mesecons_fpga_copy", { pos = placer:get_pos(), gain = 0.1, max_hear_distance = 4 }, true)
return itemstack return itemstack
end, end,
@ -45,7 +45,7 @@ minetest.register_tool("mesecons_fpga:programmer", {
local imeta = itemstack:get_metadata() local imeta = itemstack:get_metadata()
if imeta == "" then if imeta == "" then
minetest.chat_send_player(player_name, "Use shift+right-click to copy a gate configuration first.") minetest.chat_send_player(player_name, "Use shift+right-click to copy a gate configuration first.")
minetest.sound_play("mesecons_fpga_fail", { pos = user:get_pos(), gain = 0.1, max_hear_distance = 4 }) minetest.sound_play("mesecons_fpga_fail", { pos = user:get_pos(), gain = 0.1, max_hear_distance = 4 }, true)
return itemstack return itemstack
end end
@ -53,7 +53,7 @@ minetest.register_tool("mesecons_fpga:programmer", {
meta:set_string("instr", imeta) meta:set_string("instr", imeta)
plg.update_meta(pos, imeta) plg.update_meta(pos, imeta)
minetest.chat_send_player(player_name, "Gate configuration was successfully written to FPGA!") minetest.chat_send_player(player_name, "Gate configuration was successfully written to FPGA!")
minetest.sound_play("mesecons_fpga_write", { pos = user:get_pos(), gain = 0.1, max_hear_distance = 4 }) minetest.sound_play("mesecons_fpga_write", { pos = user:get_pos(), gain = 0.1, max_hear_distance = 4 }, true)
return itemstack return itemstack
end end

@ -66,7 +66,7 @@ function mesecon.register_movestone(name, def, is_sticky, is_vertical)
mesecon.on_dignode(pos, node) mesecon.on_dignode(pos, node)
mesecon.on_placenode(frontpos, node) mesecon.on_placenode(frontpos, node)
minetest.get_node_timer(frontpos):start(timer_interval) minetest.get_node_timer(frontpos):start(timer_interval)
minetest.sound_play("movestone", {pos = pos, max_hear_distance = 20, gain = 0.5,}) minetest.sound_play("movestone", { pos = pos, max_hear_distance = 20, gain = 0.5 }, true)
-- ### Step 3: If sticky, pull stack behind ### -- ### Step 3: If sticky, pull stack behind ###
if is_sticky then if is_sticky then

@ -67,5 +67,5 @@ mesecon.noteblock_play = function(pos, param2)
end end
end end
pos.y = pos.y+1 pos.y = pos.y+1
minetest.sound_play(soundname, {pos = pos}) minetest.sound_play(soundname, { pos = pos }, true)
end end

@ -67,11 +67,7 @@ local function piston_remove_pusher(pos, node, check_falling)
end end
minetest.remove_node(pusherpos) minetest.remove_node(pusherpos)
minetest.sound_play("piston_retract", { minetest.sound_play("piston_retract", { pos = pos, max_hear_distance = 20, gain = 0.3 }, true)
pos = pos,
max_hear_distance = 20,
gain = 0.3,
})
if check_falling then if check_falling then
minetest.check_for_falling(pusherpos) minetest.check_for_falling(pusherpos)
@ -96,11 +92,7 @@ local piston_on = function(pos, node)
end end
minetest.swap_node(pos, {param2 = node.param2, name = pistonspec.onname}) minetest.swap_node(pos, {param2 = node.param2, name = pistonspec.onname})
minetest.set_node(pusher_pos, {param2 = node.param2, name = pistonspec.pusher}) minetest.set_node(pusher_pos, {param2 = node.param2, name = pistonspec.pusher})
minetest.sound_play("piston_extend", { minetest.sound_play("piston_extend", { pos = pos, max_hear_distance = 20, gain = 0.3 }, true)
pos = pos,
max_hear_distance = 20,
gain = 0.3,
})
mesecon.mvps_process_stack(stack) mesecon.mvps_process_stack(stack)
mesecon.mvps_move_objects(pusher_pos, dir, oldstack) mesecon.mvps_move_objects(pusher_pos, dir, oldstack)
end end

@ -11,7 +11,7 @@ mesecon.register_node("mesecons_switch:mesecon_switch", {
else else
mesecon.receptor_off(pos) mesecon.receptor_off(pos)
end end
minetest.sound_play("mesecons_switch", {pos=pos}) minetest.sound_play("mesecons_switch", { pos = pos }, true)
end end
},{ },{
groups = {dig_immediate=2}, groups = {dig_immediate=2},

@ -22,7 +22,7 @@ mesecon.register_node("mesecons_walllever:wall_lever", {
else else
mesecon.receptor_off(pos, mesecon.rules.buttonlike_get(node)) mesecon.receptor_off(pos, mesecon.rules.buttonlike_get(node))
end end
minetest.sound_play("mesecons_lever", {pos=pos}) minetest.sound_play("mesecons_lever", { pos = pos }, true)
end end
},{ },{
tiles = { tiles = {