From f09481c3f0df73339060da05f5135c9d7885c522 Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Mon, 20 Feb 2017 18:30:59 -0500 Subject: [PATCH] switch over all punch-operated objects to use on_rightclick instead, for consistency with other parts of minetest, minetest_game, etc. --- homedecor/bathroom_sanitation.lua | 4 ++-- homedecor/climate-control.lua | 2 +- homedecor/electrics.lua | 2 +- homedecor/electronics.lua | 4 ++-- homedecor/gastronomy.lua | 23 +++++++++++------------ homedecor/lighting.lua | 4 ++-- plasmascreen/init.lua | 4 ++-- 7 files changed, 21 insertions(+), 22 deletions(-) diff --git a/homedecor/bathroom_sanitation.lua b/homedecor/bathroom_sanitation.lua index c586801..3f6f1cf 100644 --- a/homedecor/bathroom_sanitation.lua +++ b/homedecor/bathroom_sanitation.lua @@ -27,7 +27,7 @@ homedecor.register("toilet", { node_box = toilet_cbox, groups = {cracky=3}, sounds = default.node_sound_stone_defaults(), - on_punch = function (pos, node, puncher) + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) node.name = "homedecor:toilet_open" minetest.set_node(pos, node) end @@ -47,7 +47,7 @@ homedecor.register("toilet_open", { drop = "homedecor:toilet", groups = {cracky=3}, sounds = default.node_sound_stone_defaults(), - on_punch = function (pos, node, puncher) + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) node.name = "homedecor:toilet" minetest.set_node(pos, node) minetest.sound_play("homedecor_toilet_flush", { diff --git a/homedecor/climate-control.lua b/homedecor/climate-control.lua index bb68583..b47960d 100644 --- a/homedecor/climate-control.lua +++ b/homedecor/climate-control.lua @@ -59,7 +59,7 @@ homedecor.register("desk_fan", { meta:set_string("active", "no") add_mesh_desk_fan_entity(pos) end, - on_punch = function(pos) + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) local meta = minetest.get_meta(pos) local entities = minetest.get_objects_inside_radius(pos, 0.1) local entity = entities[1] or add_mesh_desk_fan_entity(pos) diff --git a/homedecor/electrics.lua b/homedecor/electrics.lua index d8cfa93..c5f27a6 100644 --- a/homedecor/electrics.lua +++ b/homedecor/electrics.lua @@ -71,7 +71,7 @@ homedecor.register("doorbell", { {-0.03125, 0.0625, 0.45, 0.03125, 0.125, 0.4675}, -- NodeBox2 } }, - on_punch = function(pos, node, puncher, pointed_thing) + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) minetest.sound_play("homedecor_doorbell", { pos = pos, gain = 1.0, diff --git a/homedecor/electronics.lua b/homedecor/electronics.lua index 420da6d..633adc1 100644 --- a/homedecor/electronics.lua +++ b/homedecor/electronics.lua @@ -11,7 +11,7 @@ homedecor.register("speaker", { }, groups = { snappy = 3 }, sounds = default.node_sound_wood_defaults(), - on_punch = function(pos, node, puncher, pointed_thing) + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) minetest.set_node(pos, {name = "homedecor:speaker_open", param2 = node.param2}) end }) @@ -27,7 +27,7 @@ homedecor.register("speaker_open", { }, groups = { snappy = 3, not_in_creative_inventory=1 }, sounds = default.node_sound_wood_defaults(), - on_punch = function(pos, node, puncher, pointed_thing) + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) minetest.set_node(pos, {name = "homedecor:speaker", param2 = node.param2}) end }) diff --git a/homedecor/gastronomy.lua b/homedecor/gastronomy.lua index b08ca5c..e780926 100644 --- a/homedecor/gastronomy.lua +++ b/homedecor/gastronomy.lua @@ -134,20 +134,19 @@ homedecor.register("beer_tap", { type = "fixed", fixed = { -0.25, -0.5, -0.4375, 0.25, 0.235, 0 } }, - on_punch = function(pos, node, puncher, pointed_thing) - local wielditem = puncher:get_wielded_item() - local inv = puncher:get_inventory() + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + local inv = clicker:get_inventory() - local wieldname = wielditem:get_name() + local wieldname = itemstack:get_name() if wieldname == "vessels:drinking_glass" then if inv:room_for_item("main", "homedecor:beer_mug 1") then - wielditem:take_item() - puncher:set_wielded_item(wielditem) + itemstack:take_item() + clicker:set_wielded_item(itemstack) inv:add_item("main", "homedecor:beer_mug 1") - minetest.chat_send_player(puncher:get_player_name(), + minetest.chat_send_player(clicker:get_player_name(), S("Ahh, a frosty cold beer - look in your inventory for it!")) else - minetest.chat_send_player(puncher:get_player_name(), + minetest.chat_send_player(clicker:get_player_name(), S("No room in your inventory to add a beer mug!")) end end @@ -196,21 +195,21 @@ homedecor.register("soda_machine", { expand = { top="placeholder" }, sounds = default.node_sound_wood_defaults(), on_rotate = screwdriver.rotate_simple, - on_punch = function(pos, node, puncher, pointed_thing) - local wielditem = puncher:get_wielded_item() + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + local wielditem = clicker:get_wielded_item() local wieldname = wielditem:get_name() local fdir_to_fwd = { {0, -1}, {-1, 0}, {0, 1}, {1, 0} } local fdir = node.param2 local pos_drop = { x=pos.x+fdir_to_fwd[fdir+1][1], y=pos.y, z=pos.z+fdir_to_fwd[fdir+1][2] } if wieldname == "homedecor:coin" then wielditem:take_item() - puncher:set_wielded_item(wielditem) + clicker:set_wielded_item(wielditem) minetest.spawn_item(pos_drop, "homedecor:soda_can") minetest.sound_play("insert_coin", { pos=pos, max_hear_distance = 5 }) else - minetest.chat_send_player(puncher:get_player_name(), S("Please insert a coin in the machine.")) + minetest.chat_send_player(clicker:get_player_name(), S("Please insert a coin in the machine.")) end end }) diff --git a/homedecor/lighting.lua b/homedecor/lighting.lua index d89a7df..369c5bd 100644 --- a/homedecor/lighting.lua +++ b/homedecor/lighting.lua @@ -513,7 +513,7 @@ homedecor.register("ceiling_lamp", { light_source = default.LIGHT_MAX, groups = {snappy=3}, walkable = false, - on_punch = function(pos, node, puncher) + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) minetest.set_node(pos, {name = "homedecor:ceiling_lamp_off"}) end, }) @@ -529,7 +529,7 @@ homedecor.register("ceiling_lamp_off", { }, groups = {snappy=3, not_in_creative_inventory=1}, walkable = false, - on_punch = function(pos, node, puncher) + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) minetest.set_node(pos, {name = "homedecor:ceiling_lamp"}) end, drop = "homedecor:ceiling_lamp" diff --git a/plasmascreen/init.lua b/plasmascreen/init.lua index 109e418..183d1f9 100644 --- a/plasmascreen/init.lua +++ b/plasmascreen/init.lua @@ -127,7 +127,7 @@ minetest.register_node("plasmascreen:tv", { return true -- "API: If return true no item is taken from itemstack" end end, - on_punch = function(pos, node, puncher, pointed_thing) + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) minetest.set_node(pos, {name = "plasmascreen:tv_off", param2 = node.param2}) end }) @@ -155,7 +155,7 @@ minetest.register_node("plasmascreen:tv_off", { return true -- "API: If return true no item is taken from itemstack" end end, - on_punch = function(pos, node, puncher, pointed_thing) + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) minetest.set_node(pos, {name = "plasmascreen:tv", param2 = node.param2}) end, drop = "plasmascreen:tv"