diff --git a/computer/computers.lua b/computer/computers.lua index cf7c6ac..47ce2e1 100644 --- a/computer/computers.lua +++ b/computer/computers.lua @@ -29,6 +29,7 @@ minetest.register_node("computer:vanio", { on_rightclick = function(pos, node, clicker, itemstack) node.name = "computer:vanio_off" minetest.set_node(pos, node) + return itemstack end }) @@ -48,6 +49,7 @@ minetest.register_node("computer:vanio_off", { on_rightclick = function(pos, node, clicker, itemstack) node.name = "computer:vanio" minetest.set_node(pos, node) + return itemstack end }) @@ -168,6 +170,7 @@ minetest.register_node("computer:monitor", { on_rightclick = function(pos, node, clicker, itemstack) node.name = "computer:monitor_on" minetest.set_node(pos, node) + return itemstack end }) @@ -186,6 +189,7 @@ minetest.register_node("computer:monitor_on", { on_rightclick = function(pos, node, clicker, itemstack) node.name = "computer:monitor" minetest.set_node(pos, node) + return itemstack end }) @@ -294,12 +298,13 @@ minetest.register_node("computer:server", { on_rightclick = function(pos, node, clicker, itemstack) node.name = "computer:server_on" minetest.set_node(pos, node) + return itemstack end, on_place = function(itemstack, placer, pointed_thing) local pos = pointed_thing.above if minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "air" then minetest.chat_send_player( placer:get_player_name(), "Not enough vertical space to place a server!" ) - return + return itemstack end return minetest.item_place(itemstack, placer, pointed_thing) end @@ -333,5 +338,6 @@ minetest.register_node("computer:server_on", { on_rightclick = function(pos, node, clicker, itemstack) node.name = "computer:server" minetest.set_node(pos, node) + return itemstack end }) diff --git a/computer/init.lua b/computer/init.lua index 975f04f..bb690ed 100644 --- a/computer/init.lua +++ b/computer/init.lua @@ -27,11 +27,12 @@ computer.register = function (name, def) node_box = def.node_box, selection_box = def.node_box, on_rightclick = function (pos, node, clicker, itemstack) - if (def.on_turn_off) then - if (def.on_turn_off(pos, node, clicker, itemstack)) then return end + if def.on_turn_off and def.on_turn_off(pos, node, clicker, itemstack) then + return itemstack end node.name = OFFSTATE minetest.set_node(pos, node) + return itemstack end }) minetest.register_node(OFFSTATE, { @@ -50,11 +51,12 @@ computer.register = function (name, def) node_box = def.node_box_off or def.node_box, selection_box = def.node_box_off or def.node_box, on_rightclick = function (pos, node, clicker, itemstack) - if (def.on_turn_on) then - if (def.on_turn_on(pos, node, clicker, itemstack)) then return end + if def.on_turn_on and def.on_turn_on(pos, node, clicker, itemstack) then + return itemstack end node.name = ONSTATE minetest.set_node(pos, node) + return itemstack end, drop = ONSTATE }) diff --git a/computer/tetris.lua b/computer/tetris.lua index 5a9ffed..5f0b71c 100644 --- a/computer/tetris.lua +++ b/computer/tetris.lua @@ -276,7 +276,8 @@ minetest.register_node("computer:tetris_arcade", { end if minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "air" then minetest.chat_send_player(placer:get_player_name(), "No room for place the Arcade!") - return end + return itemstack + end local dir = placer:get_look_dir() local node = {name="computer:tetris_arcade", param1=0, param2 = minetest.dir_to_facedir(dir)} minetest.set_node(pos, node) diff --git a/fake_fire/init.lua b/fake_fire/init.lua index 08760de..92d04f9 100644 --- a/fake_fire/init.lua +++ b/fake_fire/init.lua @@ -84,8 +84,9 @@ for _, f in ipairs(flame_types) do {name=f.."_fire_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=1.5}}, }, - on_rightclick = function (pos, node, clicker) + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) start_smoke(pos, node, clicker) + return itemstack end, on_destruct = function (pos) stop_smoke(pos) @@ -113,8 +114,9 @@ minetest.register_node("fake_fire:fancy_fire", { tiles = { {name="fake_fire_animated.png", animation={type='vertical_frames', aspect_w=16, aspect_h=16, length=1}}, {name='fake_fire_logs.png'}}, - on_rightclick = function (pos, node, clicker) + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) start_smoke(pos, node, clicker) + return itemstack end, on_destruct = function (pos) stop_smoke(pos) @@ -161,9 +163,10 @@ for _, m in ipairs(materials) do type = "fixed", fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, }, - on_rightclick = function (pos, node, clicker) + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) local chimney = 1 start_smoke(pos, node, clicker, chimney) + return itemstack end, on_destruct = function (pos) stop_smoke(pos) diff --git a/homedecor/bathroom_sanitation.lua b/homedecor/bathroom_sanitation.lua index b83e69a..d5d396a 100644 --- a/homedecor/bathroom_sanitation.lua +++ b/homedecor/bathroom_sanitation.lua @@ -114,7 +114,7 @@ homedecor.register("sink", { --Taps -local function taps_on_rightclick(pos, node, clicker) +local function taps_on_rightclick(pos, node, clicker, itemstack, pointed_thing) local below = minetest.get_node_or_nil({x=pos.x, y=pos.y-1, z=pos.z}) if below and below.name == "homedecor:shower_tray" or @@ -129,6 +129,7 @@ local function taps_on_rightclick(pos, node, clicker) } homedecor.start_particle_spawner(pos, node, particledef, "homedecor_faucet") end + return itemstack end homedecor.register("taps", { @@ -225,7 +226,7 @@ homedecor.register("shower_head", { selection_box = sh_cbox, walkable = false, on_rotate = screwdriver.disallow, - on_rightclick = function (pos, node, clicker) + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) local below = minetest.get_node_or_nil({x=pos.x, y=pos.y-2.0, z=pos.z}) if below and below.name == "homedecor:shower_tray" then local particledef = { @@ -237,6 +238,7 @@ homedecor.register("shower_head", { } homedecor.start_particle_spawner(pos, node, particledef, "homedecor_shower") end + return itemstack end, on_destruct = function(pos) homedecor.stop_particle_spawner(pos) diff --git a/homedecor/bedroom.lua b/homedecor/bedroom.lua index 683e53a..51c4dd5 100644 --- a/homedecor/bedroom.lua +++ b/homedecor/bedroom.lua @@ -79,10 +79,11 @@ for i in ipairs(bedcolors) do after_dig_node = function(pos) homedecor.unextend_bed(pos, color) end, - on_rightclick = function(pos, node, clicker) + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) if minetest.get_modpath("beds") then beds.on_rightclick(pos, clicker) - else return end + end + return itemstack end }) @@ -104,10 +105,11 @@ for i in ipairs(bedcolors) do after_dig_node = function(pos) homedecor.unextend_bed(pos, color) end, - on_rightclick = function(pos, node, clicker) + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) if minetest.get_modpath("beds") then beds.on_rightclick(pos, clicker) - else return end + end + return itemstack end, drop = "homedecor:bed_"..color.."_regular" }) @@ -137,10 +139,11 @@ for i in ipairs(bedcolors) do inv:add_item("main", "homedecor:bed_"..color.."_regular 2") end end, - on_rightclick = function(pos, node, clicker) + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) if minetest.get_modpath("beds") then beds.on_rightclick(pos, clicker) - else return end + end + return itemstack end }) diff --git a/homedecor/books.lua b/homedecor/books.lua index 4783cb3..67da99e 100644 --- a/homedecor/books.lua +++ b/homedecor/books.lua @@ -112,7 +112,7 @@ for c in ipairs(bookcolors) do drop = "homedecor:book_"..color, walkable = false, on_dig = book_dig, - on_rightclick = function(pos, node, clicker) + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) local meta = minetest.get_meta(pos) local player_name = clicker:get_player_name() local title = meta:get_string("title") or "" @@ -136,6 +136,7 @@ for c in ipairs(bookcolors) do end player_current_book[player_name] = pos minetest.show_formspec(player_name, BOOK_FORMNAME, formspec) + return itemstack end, on_punch = function(pos, node, puncher, pointed_thing) local fdir = node.param2 diff --git a/homedecor/doors_and_gates.lua b/homedecor/doors_and_gates.lua index 82cdec3..3787e2b 100644 --- a/homedecor/doors_and_gates.lua +++ b/homedecor/doors_and_gates.lua @@ -252,8 +252,9 @@ for i in ipairs(sides) do on_construct = function(pos) minetest.get_meta(pos):set_int("closed", 1) end, - on_rightclick = function(pos, node, clicker) + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) homedecor.flip_door(pos, node, clicker, doorname, side) + return itemstack end, -- both left and right doors may be used for open or closed doors -- so they have to have both action_on and action_off and just @@ -385,8 +386,9 @@ for i in ipairs(gates_list) do type = "fixed", fixed = gate_models_closed[i] }, - on_rightclick = function(pos, node, clicker) + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) homedecor.flip_gate(pos, node, clicker, gate, "closed") + return itemstack end, mesecons = { effector = { @@ -413,8 +415,9 @@ for i in ipairs(gates_list) do tiles[3] } def.drop = "homedecor:gate_"..gate.."_closed" - def.on_rightclick = function(pos, node, clicker) + def.on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) homedecor.flip_gate(pos, node, clicker, gate, "open") + return itemstack end def.mesecons.effector = { action_off = function(pos,node) homedecor.flip_gate(pos,node,player,gate, "open") end @@ -605,8 +608,9 @@ homedecor.register("door_japanese_closed", { fixed = {-0.5, -0.5, -0.0625, 0.5, 1.5, 0}, }, expand = { top = "placeholder" }, - on_rightclick = function(pos, node, clicker) + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) minetest.set_node(pos, {name = "homedecor:door_japanese_open", param2 = node.param2}) + return itemstack end }) @@ -628,8 +632,9 @@ homedecor.register("door_japanese_open", { fixed = {-1.5, -0.5, -0.0625, -0.5, 1.5, 0}, }, expand = { top = "placeholder" }, - on_rightclick = function(pos, node, clicker) + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) minetest.set_node(pos, {name = "homedecor:door_japanese_closed", param2 = node.param2}) + return itemstack end, drop = "homedecor:door_japanese_closed", }) diff --git a/homedecor/furniture.lua b/homedecor/furniture.lua index 338a95c..fd79351 100644 --- a/homedecor/furniture.lua +++ b/homedecor/furniture.lua @@ -84,9 +84,10 @@ for i in ipairs(chaircolors) do collision_box = kc_cbox, groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, sounds = default.node_sound_wood_defaults(), - on_rightclick = function(pos, node, clicker) + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) pos.y = pos.y+0 -- where do I put my ass ? homedecor.sit(pos, node, clicker) + return itemstack end }) diff --git a/homedecor/kitchen_appliances.lua b/homedecor/kitchen_appliances.lua index ae59a40..af3009b 100644 --- a/homedecor/kitchen_appliances.lua +++ b/homedecor/kitchen_appliances.lua @@ -169,7 +169,7 @@ homedecor.register("toaster", { {-0.0625, -0.5, -0.125, 0.125, -0.3125, 0.125}, -- NodeBox1 }, }, - on_rightclick = function(pos, node, clicker) + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) local fdir = node.param2 minetest.set_node(pos, { name = "homedecor:toaster_loaf", param2 = fdir }) minetest.sound_play("toaster", { @@ -177,6 +177,7 @@ homedecor.register("toaster", { gain = 1.0, max_hear_distance = 5 }) + return itemstack end }) @@ -199,9 +200,10 @@ homedecor.register("toaster_loaf", { {0.0625, -0.3125, -0.0935, 0.0935, -0.25, 0.0935}, -- NodeBox3 }, }, - on_rightclick = function(pos, node, clicker) + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) local fdir = node.param2 minetest.set_node(pos, { name = "homedecor:toaster", param2 = fdir }) + return itemstack end, drop = "homedecor:toaster" }) diff --git a/homedecor/kitchen_furniture.lua b/homedecor/kitchen_furniture.lua index e64f423..cf240f8 100644 --- a/homedecor/kitchen_furniture.lua +++ b/homedecor/kitchen_furniture.lua @@ -117,7 +117,7 @@ homedecor.register("kitchen_faucet", { selection_box = kf_cbox, walkable = false, on_rotate = screwdriver.disallow, - on_rightclick = function(pos, node, clicker) + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) local below = minetest.get_node_or_nil({x=pos.x, y=pos.y-1, z=pos.z}) if below and below.name == "homedecor:sink" or @@ -131,6 +131,7 @@ homedecor.register("kitchen_faucet", { } homedecor.start_particle_spawner(pos, node, particledef, "homedecor_faucet") end + return itemstack end, on_destruct = homedecor.stop_particle_spawner }) diff --git a/homedecor/misc-nodes.lua b/homedecor/misc-nodes.lua index 67b341b..198d9e4 100644 --- a/homedecor/misc-nodes.lua +++ b/homedecor/misc-nodes.lua @@ -179,8 +179,9 @@ homedecor.register("fishtank", { collision_box = ft_cbox, groups = {cracky=3,oddly_breakable_by_hand=3}, sounds = default.node_sound_glass_defaults(), - on_rightclick = function(pos, node, clicker) + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) minetest.set_node(pos, {name = "homedecor:fishtank_lighted", param2 = node.param2}) + return itemstack end }) @@ -201,8 +202,9 @@ homedecor.register("fishtank_lighted", { collision_box = ft_cbox, groups = {cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1}, sounds = default.node_sound_glass_defaults(), - on_rightclick = function(pos, node, clicker) + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) minetest.set_node(pos, {name = "homedecor:fishtank", param2 = node.param2}) + return itemstack end, drop = "homedecor:fishtank", }) diff --git a/homedecor/office.lua b/homedecor/office.lua index 1da21dc..24fe30e 100644 --- a/homedecor/office.lua +++ b/homedecor/office.lua @@ -81,10 +81,11 @@ homedecor.register("calendar", { legacy_wallmounted = true, sounds = default.node_sound_defaults(), infotext = "Date (right-click to update):\n" .. os.date("%Y-%m-%d"), -- ISO 8601 format - on_rightclick = function(pos, node, clicker) + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) local meta = minetest.get_meta(pos) local date = os.date("%Y-%m-%d") meta:set_string("infotext", "Date (right-click to update):\n"..date) + return itemstack end }) diff --git a/homedecor/window_treatments.lua b/homedecor/window_treatments.lua index 2d9b125..1b7f915 100644 --- a/homedecor/window_treatments.lua +++ b/homedecor/window_treatments.lua @@ -125,12 +125,13 @@ for c in ipairs(curtaincolors) do paramtype2 = 'wallmounted', selection_box = { type = "wallmounted" }, -- Open the curtains - on_rightclick = function(pos, node, clicker, itemstack) + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) local topnode = minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z}) if string.find(topnode.name, "homedecor:curtainrod") then local fdir = node.param2 minetest.set_node(pos, { name = "homedecor:curtain_open_"..color, param2 = fdir }) end + return itemstack end }) @@ -147,12 +148,13 @@ for c in ipairs(curtaincolors) do paramtype2 = 'wallmounted', selection_box = { type = "wallmounted" }, -- Close the curtains - on_rightclick = function(pos, node, clicker, itemstack) + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) local topnode = minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z}) if string.find(topnode.name, "homedecor:curtainrod") then local fdir = node.param2 minetest.set_node(pos, { name = "homedecor:curtain_"..color, param2 = fdir }) end + return itemstack end }) diff --git a/inbox/init.lua b/inbox/init.lua index 7e5867a..28239f4 100644 --- a/inbox/init.lua +++ b/inbox/init.lua @@ -57,6 +57,7 @@ minetest.register_node("inbox:empty", { "default:chest_locked", inbox.get_inbox_insert_formspec(pos)) end + return itemstack end, can_dig = function(pos,player) local meta = minetest.get_meta(pos); diff --git a/lavalamp/init.lua b/lavalamp/init.lua index 8e0c3d5..93571c6 100644 --- a/lavalamp/init.lua +++ b/lavalamp/init.lua @@ -39,9 +39,10 @@ for i in ipairs(lavalamps_list) do }, groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3}, sounds = default.node_sound_glass_defaults(), - on_rightclick = function(pos, node, clicker) + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) node.name = "lavalamp:"..colour.."_off" minetest.set_node(pos, node) + return itemstack end, }) @@ -64,9 +65,10 @@ for i in ipairs(lavalamps_list) do groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, not_in_creative_inventory=1}, sounds = default.node_sound_glass_defaults(), drop = "lavalamp:"..colour, - on_rightclick = function(pos, node, clicker) + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) node.name = "lavalamp:"..colour minetest.set_node(pos, node) + return itemstack end, }) diff --git a/lrfurn/armchairs.lua b/lrfurn/armchairs.lua index 39999dd..f3b8225 100644 --- a/lrfurn/armchairs.lua +++ b/lrfurn/armchairs.lua @@ -24,13 +24,14 @@ for i in ipairs(lrfurn.colors) do groups = {snappy=3}, sounds = default.node_sound_wood_defaults(), node_box = armchair_cbox, - on_rightclick = function(pos, node, clicker) + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) if not clicker:is_player() then - return + return itemstack end pos.y = pos.y-0.5 clicker:setpos(pos) clicker:set_hp(20) + return itemstack end }) diff --git a/lrfurn/longsofas.lua b/lrfurn/longsofas.lua index 3bcd8ec..a1721a9 100644 --- a/lrfurn/longsofas.lua +++ b/lrfurn/longsofas.lua @@ -46,13 +46,14 @@ for i in ipairs(lrfurn.colors) do end return itemstack end, - on_rightclick = function(pos, node, clicker) + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) if not clicker:is_player() then - return + return itemstack end pos.y = pos.y-0.5 clicker:setpos(pos) clicker:set_hp(20) + return itemstack end }) diff --git a/lrfurn/sofas.lua b/lrfurn/sofas.lua index 1f7c217..bc071c2 100644 --- a/lrfurn/sofas.lua +++ b/lrfurn/sofas.lua @@ -48,13 +48,14 @@ for i in ipairs(lrfurn.colors) do end return itemstack end, - on_rightclick = function(pos, node, clicker) + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) if not clicker:is_player() then - return + return itemstack end pos.y = pos.y-0.5 clicker:setpos(pos) clicker:set_hp(20) + return itemstack end })