forked from MineClone5/MineClone5
New button and lever sounds
This commit is contained in:
parent
9fd27db688
commit
8dae3e3460
|
@ -0,0 +1,14 @@
|
||||||
|
Mesecons button mod.
|
||||||
|
This mod adds the buttons for MineClone 2.
|
||||||
|
|
||||||
|
MEDIA FILE CREDITS:
|
||||||
|
|
||||||
|
`mesecons_button_push.ogg`
|
||||||
|
* Author: junggle (CC BY 3.0 <http://creativecommons.org/licenses/by/3.0/>)
|
||||||
|
* Original name: `btn121.ogg`, created on January 16th, 2007
|
||||||
|
* Source: <https://freesound.org/people/junggle/sounds/29301/>
|
||||||
|
`mesecons_button_push_wood.ogg`
|
||||||
|
* Author: junggle (CC BY 3.0 <http://creativecommons.org/licenses/by/3.0/>)
|
||||||
|
* Original name: `btn314.ogg`, created on January 16th, 2007
|
||||||
|
* Sound file was modified
|
||||||
|
* Source: <https://freesound.org/people/junggle/sounds/29494/>
|
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
local S = minetest.get_translator("mesecons_button")
|
local S = minetest.get_translator("mesecons_button")
|
||||||
|
|
||||||
|
local button_sounds = {} -- remember button push sounds
|
||||||
|
|
||||||
local button_get_output_rules = mesecon.rules.wallmounted_get
|
local button_get_output_rules = mesecon.rules.wallmounted_get
|
||||||
|
|
||||||
local boxes_off = {
|
local boxes_off = {
|
||||||
|
@ -27,7 +29,10 @@ 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}, true)
|
local sfx = button_sounds[node.name]
|
||||||
|
if sfx then
|
||||||
|
minetest.sound_play(sfx, {pos=pos}, true)
|
||||||
|
end
|
||||||
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
|
||||||
|
@ -81,7 +86,7 @@ end
|
||||||
|
|
||||||
local buttonuse = S("Use the button to push it.")
|
local buttonuse = S("Use the button to push it.")
|
||||||
|
|
||||||
mesecon.register_button = function(basename, description, texture, recipeitem, sounds, plusgroups, button_timer, push_by_arrow, longdesc)
|
mesecon.register_button = function(basename, description, texture, recipeitem, sounds, plusgroups, button_timer, push_by_arrow, longdesc, button_sound)
|
||||||
local groups_off = table.copy(plusgroups)
|
local groups_off = table.copy(plusgroups)
|
||||||
groups_off.attached_node=1
|
groups_off.attached_node=1
|
||||||
groups_off.dig_by_water=1
|
groups_off.dig_by_water=1
|
||||||
|
@ -93,6 +98,11 @@ mesecon.register_button = function(basename, description, texture, recipeitem, s
|
||||||
groups_on.not_in_creative_inventory=1
|
groups_on.not_in_creative_inventory=1
|
||||||
groups_on.button=2 -- button (on)
|
groups_on.button=2 -- button (on)
|
||||||
|
|
||||||
|
if not button_sound then
|
||||||
|
button_sound = "mesecons_button_push"
|
||||||
|
end
|
||||||
|
button_sounds["mesecons_button:button_"..basename.."_off"] = button_sound
|
||||||
|
|
||||||
if push_by_arrow then
|
if push_by_arrow then
|
||||||
groups_off.button_push_by_arrow = 1
|
groups_off.button_push_by_arrow = 1
|
||||||
groups_on.button_push_by_arrow = 1
|
groups_on.button_push_by_arrow = 1
|
||||||
|
@ -179,7 +189,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}, true)
|
minetest.sound_play(button_sound, {pos=pos, pitch=0.9}, true)
|
||||||
mesecon.receptor_off(pos, button_get_output_rules(node))
|
mesecon.receptor_off(pos, button_get_output_rules(node))
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
@ -203,7 +213,8 @@ mesecon.register_button(
|
||||||
{material_stone=1,handy=1,pickaxey=1},
|
{material_stone=1,handy=1,pickaxey=1},
|
||||||
1,
|
1,
|
||||||
false,
|
false,
|
||||||
S("A stone button is a redstone component made out of stone which can be pushed to provide redstone power. When pushed, it powers adjacent redstone components for 1 second."))
|
S("A stone button is a redstone component made out of stone which can be pushed to provide redstone power. When pushed, it powers adjacent redstone components for 1 second."),
|
||||||
|
"mesecons_button_push")
|
||||||
|
|
||||||
local woods = {
|
local woods = {
|
||||||
{ "wood", "mcl_core:wood", "default_wood.png", S("Oak Button") },
|
{ "wood", "mcl_core:wood", "default_wood.png", S("Oak Button") },
|
||||||
|
@ -224,7 +235,8 @@ for w=1, #woods do
|
||||||
{material_wood=1,handy=1,axey=1},
|
{material_wood=1,handy=1,axey=1},
|
||||||
1.5,
|
1.5,
|
||||||
true,
|
true,
|
||||||
S("A wooden button is a redstone component made out of wood which can be pushed to provide redstone power. When pushed, it powers adjacent redstone components for 1.5 seconds. Wooden buttons may also be pushed by arrows."))
|
S("A wooden button is a redstone component made out of wood which can be pushed to provide redstone power. When pushed, it powers adjacent redstone components for 1.5 seconds. Wooden buttons may also be pushed by arrows."),
|
||||||
|
"mesecons_button_push_wood")
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "fuel",
|
type = "fuel",
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -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}, true)
|
minetest.sound_play("mesecons_button_push", {pos=pos, max_hear_distance=16}, true)
|
||||||
end,
|
end,
|
||||||
node_placement_prediction = "",
|
node_placement_prediction = "",
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
@ -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}, true)
|
minetest.sound_play("mesecons_button_push", {pos=pos, max_hear_distance=16, pitch=0.9}, true)
|
||||||
end,
|
end,
|
||||||
sounds = mcl_sounds.node_sound_stone_defaults(),
|
sounds = mcl_sounds.node_sound_stone_defaults(),
|
||||||
mesecons = {receptor = {
|
mesecons = {receptor = {
|
||||||
|
|
Loading…
Reference in New Issue