Make redstone stuff operable on rightclick

This commit is contained in:
Wuzzy 2017-02-05 17:57:33 +01:00
parent 708217b57d
commit 71a52de557
4 changed files with 7 additions and 7 deletions

View File

@ -38,7 +38,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_rightclick= 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})

View File

@ -112,7 +112,7 @@ minetest.register_node("mesecons_delayer:delayer_off_"..tostring(i), {
sunlight_propagates = true, sunlight_propagates = true,
is_ground_content = false, is_ground_content = false,
drop = 'mesecons_delayer:delayer_off_1', drop = 'mesecons_delayer:delayer_off_1',
on_punch = function (pos, node) on_rightclick = function (pos, node)
if node.name=="mesecons_delayer:delayer_off_1" then if node.name=="mesecons_delayer:delayer_off_1" then
mesecon:swap_node(pos,"mesecons_delayer:delayer_off_2") mesecon:swap_node(pos,"mesecons_delayer:delayer_off_2")
elseif node.name=="mesecons_delayer:delayer_off_2" then elseif node.name=="mesecons_delayer:delayer_off_2" then
@ -167,7 +167,7 @@ minetest.register_node("mesecons_delayer:delayer_on_"..tostring(i), {
sunlight_propagates = true, sunlight_propagates = true,
is_ground_content = false, is_ground_content = false,
drop = 'mesecons_delayer:delayer_off_1', drop = 'mesecons_delayer:delayer_off_1',
on_punch = function (pos, node) on_rightclick = function (pos, node)
if node.name=="mesecons_delayer:delayer_on_1" then if node.name=="mesecons_delayer:delayer_on_1" then
mesecon:swap_node(pos,"mesecons_delayer:delayer_on_2") mesecon:swap_node(pos,"mesecons_delayer:delayer_on_2")
elseif node.name=="mesecons_delayer:delayer_on_2" then elseif node.name=="mesecons_delayer:delayer_on_2" then

View File

@ -1,7 +1,7 @@
minetest.register_node("mesecons_noteblock:noteblock", { minetest.register_node("mesecons_noteblock:noteblock", {
description = "Note Block", description = "Note Block",
tiles = {"mesecons_noteblock.png"}, tiles = {"mesecons_noteblock.png"},
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, groups = {choppy=2,oddly_breakable_by_hand=2},
drawtype = "allfaces_optional", drawtype = "allfaces_optional",
visual_scale = 1.3, visual_scale = 1.3,
paramtype="light", paramtype="light",
@ -9,7 +9,7 @@ minetest.register_node("mesecons_noteblock:noteblock", {
after_place_node = function(pos) after_place_node = function(pos)
minetest.add_node(pos, {name="mesecons_noteblock:noteblock", param2=0}) minetest.add_node(pos, {name="mesecons_noteblock:noteblock", param2=0})
end, end,
on_punch = function (pos, node) -- change sound when punched on_rightclick = function (pos, node) -- change sound when punched
local param2 = node.param2+1 local param2 = node.param2+1
if param2==12 then param2=0 end if param2==12 then param2=0 end
minetest.add_node(pos, {name = node.name, param2 = param2}) minetest.add_node(pos, {name = node.name, param2 = param2})

View File

@ -30,7 +30,7 @@ minetest.register_node("mesecons_walllever:wall_lever_off", {
groups = {dig_immediate=2, dig_by_water=1}, groups = {dig_immediate=2, dig_by_water=1},
is_ground_content = false, is_ground_content = false,
description="Lever", description="Lever",
on_punch = function (pos, node) on_rightclick = function (pos, node)
mesecon:swap_node(pos, "mesecons_walllever:wall_lever_on") mesecon:swap_node(pos, "mesecons_walllever:wall_lever_on")
mesecon:receptor_on(pos, mesecon.rules.buttonlike_get(node)) mesecon:receptor_on(pos, mesecon.rules.buttonlike_get(node))
minetest.sound_play("mesecons_lever", {pos=pos}) minetest.sound_play("mesecons_lever", {pos=pos})
@ -70,7 +70,7 @@ minetest.register_node("mesecons_walllever:wall_lever_on", {
is_ground_content = false, is_ground_content = false,
drop = '"mesecons_walllever:wall_lever_off" 1', drop = '"mesecons_walllever:wall_lever_off" 1',
description="Lever", description="Lever",
on_punch = function (pos, node) on_rightclick = function (pos, node)
mesecon:swap_node(pos, "mesecons_walllever:wall_lever_off") mesecon:swap_node(pos, "mesecons_walllever:wall_lever_off")
mesecon:receptor_off(pos, mesecon.rules.buttonlike_get(node)) mesecon:receptor_off(pos, mesecon.rules.buttonlike_get(node))
minetest.sound_play("mesecons_lever", {pos=pos}) minetest.sound_play("mesecons_lever", {pos=pos})