diff --git a/mods/nc_api/util_misc.lua b/mods/nc_api/util_misc.lua index 02b9ed83..422b0d41 100644 --- a/mods/nc_api/util_misc.lua +++ b/mods/nc_api/util_misc.lua @@ -103,7 +103,11 @@ function nodecore.fixedbox(x, ...) end function nodecore.interact(player) + if not player then return end if type(player) ~= "string" then + if not (player.is_player and player:is_player()) then + return true + end player = player:get_player_name() end return minetest.get_player_privs(player).interact diff --git a/mods/nc_doors/operate.lua b/mods/nc_doors/operate.lua index c9e2079e..160a19bf 100644 --- a/mods/nc_doors/operate.lua +++ b/mods/nc_doors/operate.lua @@ -189,8 +189,7 @@ function nodecore.operate_door(pos, node, dir) and to.z + 0.5 > op.z + cb[3] and to.z - 0.5 < op.z + cb[6] then local lua = obj.get_luaentity and obj:get_luaentity() - if not ((lua and lua.is_stack) or (obj:is_player() - and not minetest.check_player_privs(obj, "interact"))) then + if not ((lua and lua.is_stack) or (not nodecore.interact(obj))) then return end end diff --git a/mods/nc_nodefall/disturb.lua b/mods/nc_nodefall/disturb.lua index 920172db..5ca59cf7 100644 --- a/mods/nc_nodefall/disturb.lua +++ b/mods/nc_nodefall/disturb.lua @@ -48,7 +48,7 @@ end local oldpos = {} local qtys = {} local function playercheck(dtime, player) - if not minetest.check_player_privs(player, "interact") then return end + if not nodecore.interact(player) then return end local name = player:get_player_name() diff --git a/mods/nc_player_hud/setup.lua b/mods/nc_player_hud/setup.lua index 20949978..4c5af03a 100644 --- a/mods/nc_player_hud/setup.lua +++ b/mods/nc_player_hud/setup.lua @@ -1,6 +1,6 @@ -- LUALOCALS < --------------------------------------------------------- -local math, minetest, pairs - = math, minetest, pairs +local math, minetest, nodecore, pairs + = math, minetest, nodecore, pairs local math_floor = math.floor -- LUALOCALS > --------------------------------------------------------- @@ -15,11 +15,10 @@ local function breathimg(br) end local function sethudflags(player, pname) - pname = pname or player:get_player_name() - local privs = minetest.get_player_privs(pname) + local interact = nodecore.interact(pname or player) player:hud_set_flags({ - wielditem = privs.interact or false, - hotbar = privs.interact or false, + wielditem = interact or false, + hotbar = interact or false, healthbar = false, breathbar = false, minimap = false, diff --git a/mods/nc_player_setup/setup.lua b/mods/nc_player_setup/setup.lua index e709ebd9..942eccfd 100644 --- a/mods/nc_player_setup/setup.lua +++ b/mods/nc_player_setup/setup.lua @@ -30,7 +30,7 @@ minetest.register_allow_player_inventory_action(function(_, action) end) local function privdropinv(player) - if minetest.check_player_privs(player, "interact") then return end + if nodecore.interact(player) then return end local pos = player:get_pos() pos.y = pos.y + player:get_properties().eye_height local inv = player:get_inventory() diff --git a/mods/nc_player_wield/init.lua b/mods/nc_player_wield/init.lua index 75158b76..e63c787c 100644 --- a/mods/nc_player_wield/init.lua +++ b/mods/nc_player_wield/init.lua @@ -23,7 +23,7 @@ local function entprops(stack, conf, widx) is_visible = false, static_save = false } - if not conf then return t end + if not (conf and conf.pname and nodecore.interact(conf.pname)) then return t end if conf.slot then t.is_visible = true t.textures = {modname .. "_slot.png^[transformFX^[opacity:160", "[combine:1x1"}