Browse Source

Make sounds ephemeral (#521)

The handles were never used anyway
master
Vitaliy GitHub 1 week ago
parent
commit
c1eccba247
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 16 additions and 24 deletions
  1. +2
    -2
      mesecons_button/init.lua
  2. +4
    -4
      mesecons_doors/init.lua
  3. +4
    -4
      mesecons_fpga/tool.lua
  4. +1
    -1
      mesecons_movestones/init.lua
  5. +1
    -1
      mesecons_noteblock/init.lua
  6. +2
    -10
      mesecons_pistons/init.lua
  7. +1
    -1
      mesecons_switch/init.lua
  8. +1
    -1
      mesecons_walllever/init.lua

+ 2
- 2
mesecons_button/init.lua View File

@@ -8,7 +8,7 @@ mesecon.button_turnoff = function (pos)
return
end
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)
mesecon.receptor_off(pos, rules)
end
@@ -46,7 +46,7 @@ minetest.register_node("mesecons_button:button_off", {
on_rightclick = function (pos, node)
minetest.swap_node(pos, {name = "mesecons_button:button_on", param2=node.param2})
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)
end,
sounds = default.node_sound_stone_defaults(),


+ 4
- 4
mesecons_doors/init.lua View File

@@ -13,9 +13,9 @@ local function on_rightclick(pos, dir, check_name, replace, replace_dir, params)
minetest.swap_node(pos, {name = replace, param2 = p2})

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
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

@@ -79,10 +79,10 @@ local function trapdoor_switch(pos, node)
local state = minetest.get_meta(pos):get_int("state")

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})
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})
end



+ 4
- 4
mesecons_fpga/tool.lua View File

@@ -18,12 +18,12 @@ minetest.register_tool("mesecons_fpga:programmer", {
local meta = minetest.get_meta(pos)
if meta:get_string("instr") == "//////////////" then
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
end
itemstack:set_metadata(meta:get_string("instr"))
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
end,
@@ -45,7 +45,7 @@ minetest.register_tool("mesecons_fpga:programmer", {
local imeta = itemstack:get_metadata()
if imeta == "" then
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
end

@@ -53,7 +53,7 @@ minetest.register_tool("mesecons_fpga:programmer", {
meta:set_string("instr", imeta)
plg.update_meta(pos, imeta)
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
end


+ 1
- 1
mesecons_movestones/init.lua View File

@@ -66,7 +66,7 @@ function mesecon.register_movestone(name, def, is_sticky, is_vertical)
mesecon.on_dignode(pos, node)
mesecon.on_placenode(frontpos, node)
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 ###
if is_sticky then


+ 1
- 1
mesecons_noteblock/init.lua View File

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

+ 2
- 10
mesecons_pistons/init.lua View File

@@ -67,11 +67,7 @@ local function piston_remove_pusher(pos, node, check_falling)
end

minetest.remove_node(pusherpos)
minetest.sound_play("piston_retract", {
pos = pos,
max_hear_distance = 20,
gain = 0.3,
})
minetest.sound_play("piston_retract", { pos = pos, max_hear_distance = 20, gain = 0.3 }, true)

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


+ 1
- 1
mesecons_switch/init.lua View File

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


+ 1
- 1
mesecons_walllever/init.lua View File

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


Loading…
Cancel
Save