Make buttons react on rightclick

This commit is contained in:
Wuzzy 2017-01-12 00:30:28 +01:00
parent b2fddd4066
commit 65f3798076
1 changed files with 4 additions and 4 deletions

View File

@ -39,7 +39,7 @@ minetest.register_node("mesecons_button:button_stone_off", {
}, },
groups = {dig_immediate=2, attached_node=1, dig_by_water=1}, groups = {dig_immediate=2, attached_node=1, dig_by_water=1},
description = "Stone Button", description = "Stone Button",
on_punch = function (pos, node) on_rightclick= function (pos, node)
mesecon:swap_node(pos, "mesecons_button:button_stone_on") mesecon:swap_node(pos, "mesecons_button:button_stone_on")
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})
@ -98,13 +98,13 @@ minetest.register_node("mesecons_button:button_wood_off", {
}, },
groups = {dig_immediate=2, attached_node=1, dig_by_water=1}, groups = {dig_immediate=2, attached_node=1, dig_by_water=1},
description = "Wooden Button", description = "Wooden Button",
on_punch = function (pos, node) on_rightclick = function (pos, node)
mesecon:swap_node(pos, "mesecons_button:button_wood_on") mesecon:swap_node(pos, "mesecons_button:button_wood_on")
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})
minetest.after(1, mesecon.button_turnoff, pos) minetest.after(1, mesecon.button_turnoff, pos)
end, end,
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_wood_defaults(),
mesecons = {receptor = { mesecons = {receptor = {
state = mesecon.state.off, state = mesecon.state.off,
rules = mesecon.rules.buttonlike_get rules = mesecon.rules.buttonlike_get
@ -131,7 +131,7 @@ minetest.register_node("mesecons_button:button_wood_on", {
groups = {dig_immediate=2, not_in_creative_inventory=1, attached_node=1, dig_by_water=1}, groups = {dig_immediate=2, not_in_creative_inventory=1, attached_node=1, dig_by_water=1},
drop = 'mesecons_button:button_wood_off', drop = 'mesecons_button:button_wood_off',
description = "Wooden Button", description = "Wooden Button",
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_wood_defaults(),
mesecons = {receptor = { mesecons = {receptor = {
state = mesecon.state.on, state = mesecon.state.on,
rules = mesecon.rules.buttonlike_get rules = mesecon.rules.buttonlike_get