diff --git a/init.lua b/init.lua index 4711141..855770f 100644 --- a/init.lua +++ b/init.lua @@ -11,6 +11,26 @@ if( not( minetest.get_modpath( 'unified_inventory' ))) then end +-- the one from default is not available in MCL2 and not fixed enough yet +handle_schematics.can_interact_with_node = function(player, pos) + if player then + if minetest.check_player_privs(player, "protection_bypass") then + return true + end + else + return false + end + + local meta = minetest.get_meta(pos) + local owner = meta:get_string("owner") + + if owner and owner ~= "" and owner == player:get_player_name() then + return true + end + return false +end + + handle_schematics.modpath = minetest.get_modpath( "handle_schematics"); -- realtest handles some things diffrently without beeing easy to identify diff --git a/nodes.lua b/nodes.lua index 297bda9..31e8a9f 100644 --- a/nodes.lua +++ b/nodes.lua @@ -35,7 +35,7 @@ minetest.register_craft({ -- mobs who wish to use this function have to provide the required item in itemstack handle_schematics.place_node_using_support_setup = function(pos, clicker, itemstack ) -- TODO: does can_interact_with_node work with mobs? - if not( default.can_interact_with_node(clicker, pos)) then + if not( handle_schematics.can_interact_with_node(clicker, pos)) then return itemstack; end @@ -137,7 +137,7 @@ end -- right-clicking a dig_here-indicator ought to dig the next node below it that needs digging and place appropriate scaffolding handle_schematics.dig_node_using_dig_here_indicator = function(pos, clicker, itemstack ) - if not( default.can_interact_with_node(clicker, pos)) then + if not( handle_schematics.can_interact_with_node(clicker, pos)) then return itemstack; end