From 337dc05e706c6ff57e60aeb6334d3f68fca5fba3 Mon Sep 17 00:00:00 2001 From: Tim Date: Sun, 31 Jul 2016 01:17:23 +0200 Subject: [PATCH 1/3] Always return the ItemStack for on_rightclick to comply with the API. --- computer/computers.lua | 8 +++++++- computer/init.lua | 10 ++++++---- computer/tetris.lua | 3 ++- fake_fire/init.lua | 9 ++++++--- homedecor/bathroom_sanitation.lua | 6 ++++-- homedecor/bedroom.lua | 15 +++++++++------ homedecor/books.lua | 3 ++- homedecor/doors_and_gates.lua | 15 ++++++++++----- homedecor/furniture.lua | 3 ++- homedecor/kitchen_appliances.lua | 6 ++++-- homedecor/kitchen_furniture.lua | 3 ++- homedecor/misc-nodes.lua | 6 ++++-- homedecor/office.lua | 3 ++- homedecor/window_treatments.lua | 6 ++++-- inbox/init.lua | 1 + lavalamp/init.lua | 6 ++++-- lrfurn/armchairs.lua | 5 +++-- lrfurn/longsofas.lua | 5 +++-- lrfurn/sofas.lua | 5 +++-- 19 files changed, 78 insertions(+), 40 deletions(-) diff --git a/computer/computers.lua b/computer/computers.lua index cf7c6ac3..47ce2e1c 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 975f04f0..bb690ede 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 5a9ffed8..5f0b71ca 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 08760de3..92d04f97 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 b83e69a8..d5d396af 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 683e53aa..51c4dd54 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 4783cb39..67da99e1 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 82cdec30..3787e2ba 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 338a95c8..fd793510 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 ae59a40d..af3009ba 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 e64f4231..cf240f84 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 67b341b3..198d9e46 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 1da21dcb..24fe30e4 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 2d9b1253..1b7f9157 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 7e5867a5..28239f40 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 8e0c3d57..93571c6d 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 39999dd4..f3b82258 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 3bcd8ec4..a1721a9d 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 1f7c217f..bc071c2b 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 }) From df84e6279806d79dd0ace68ec49d2c0cb6566c9e Mon Sep 17 00:00:00 2001 From: Tim Date: Sun, 31 Jul 2016 01:23:10 +0200 Subject: [PATCH 2/3] LIGHT_MAX -> default.LIGHT_MAX --- chains/init.lua | 4 ++-- homedecor/climate-control.lua | 2 +- homedecor/misc-nodes.lua | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/chains/init.lua b/chains/init.lua index 2facad04..becbb35a 100644 --- a/chains/init.lua +++ b/chains/init.lua @@ -70,7 +70,7 @@ minetest.register_node("chains:chain_top_brass", { minetest.register_node("chains:chandelier", { description = "Chandelier (wrought iron)", paramtype = "light", - light_source = LIGHT_MAX-2, + light_source = default.LIGHT_MAX-2, walkable = false, climbable = true, sunlight_propagates = true, @@ -97,7 +97,7 @@ minetest.register_node("chains:chandelier", { minetest.register_node("chains:chandelier_brass", { description = "Chandelier (brass)", paramtype = "light", - light_source = LIGHT_MAX-2, + light_source = default.LIGHT_MAX-2, walkable = false, climbable = true, sunlight_propagates = true, diff --git a/homedecor/climate-control.lua b/homedecor/climate-control.lua index 09f714e6..462f4504 100644 --- a/homedecor/climate-control.lua +++ b/homedecor/climate-control.lua @@ -111,7 +111,7 @@ homedecor.register("ceiling_fan", { } }, groups = { snappy = 3 }, - light_source = LIGHT_MAX-1, + light_source = default.LIGHT_MAX-1, sounds = default.node_sound_glass_defaults(), }) diff --git a/homedecor/misc-nodes.lua b/homedecor/misc-nodes.lua index 198d9e46..70322d44 100644 --- a/homedecor/misc-nodes.lua +++ b/homedecor/misc-nodes.lua @@ -196,7 +196,7 @@ homedecor.register("fishtank_lighted", { "homedecor_fishtank_water_top_lighted.png", "homedecor_fishtank_sides_lighted.png", }, - light_source = LIGHT_MAX-4, + light_source = default.LIGHT_MAX-4, use_texture_alpha = true, selection_box = ft_cbox, collision_box = ft_cbox, From 436fdfac5520f991c26ff7edbf7806823be02981 Mon Sep 17 00:00:00 2001 From: Tim Date: Sun, 31 Jul 2016 01:42:11 +0200 Subject: [PATCH 3/3] Prevent crashs in can_dig on nil-player. --- inbox/init.lua | 3 ++- itemframes/init.lua | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/inbox/init.lua b/inbox/init.lua index 28239f40..61897848 100644 --- a/inbox/init.lua +++ b/inbox/init.lua @@ -61,9 +61,10 @@ minetest.register_node("inbox:empty", { end, can_dig = function(pos,player) local meta = minetest.get_meta(pos); + local name = player and player:get_player_name() local owner = meta:get_string("owner") local inv = meta:get_inventory() - return player:get_player_name() == owner and inv:is_empty("main") + return player == owner and inv:is_empty("main") end, on_metadata_inventory_put = function(pos, listname, index, stack, player) local meta = minetest.get_meta(pos) diff --git a/itemframes/init.lua b/itemframes/init.lua index 8900dd58..8fca5e92 100644 --- a/itemframes/init.lua +++ b/itemframes/init.lua @@ -141,9 +141,9 @@ minetest.register_node("itemframes:frame",{ end end, can_dig = function(pos,player) - + local name = player and player:get_player_name() local meta = minetest.get_meta(pos) - return player:get_player_name() == meta:get_string("owner") + return name == meta:get_string("owner") end, on_destruct = function(pos) local meta = minetest.get_meta(pos) @@ -198,9 +198,9 @@ minetest.register_node("itemframes:pedestal",{ end end, can_dig = function(pos,player) - + local name = player and player:get_player_name() local meta = minetest.get_meta(pos) - return player:get_player_name() == meta:get_string("owner") + return name == meta:get_string("owner") end, on_destruct = function(pos) local meta = minetest.get_meta(pos)