removed dependency from a function in default

This commit is contained in:
Sokomine 2019-03-24 17:23:41 +01:00
parent 833396f6de
commit 860263fa7b
2 changed files with 22 additions and 2 deletions

View File

@ -11,6 +11,26 @@ if( not( minetest.get_modpath( 'unified_inventory' ))) then
end 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"); handle_schematics.modpath = minetest.get_modpath( "handle_schematics");
-- realtest handles some things diffrently without beeing easy to identify -- realtest handles some things diffrently without beeing easy to identify

View File

@ -35,7 +35,7 @@ minetest.register_craft({
-- mobs who wish to use this function have to provide the required item in itemstack -- 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 ) handle_schematics.place_node_using_support_setup = function(pos, clicker, itemstack )
-- TODO: does can_interact_with_node work with mobs? -- 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; return itemstack;
end 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 -- 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 ) 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; return itemstack;
end end