Page 1 of 1

easier chest handling for server admins

PostPosted: Thu May 23, 2013 13:36
by addi
in the minetest default game is a locked chast wich can only opend or viewed by its owner

my idea:

/mods/default/nodes.lua line 640
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
local function has_locked_chest_privilege(meta, player)
if player:get_player_name() ~= meta:get_string("owner") then
return false
end
return true
end


change it to something like this:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
local function has_locked_chest_privilege(meta, player)
if ~= meta:get_string("owner") then
return minetest.check_player_privs(player:get_player_name() , {server=true})
end
return true
end

so somebody with the server privilege (the admin) can open and view the chest too
this could be also with the locked door but there its not need because the admin can fly :)

PostPosted: Thu May 23, 2013 14:00
by PilzAdam
Well, correct code would be:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
local function has_locked_chest_privilege(meta, player)
    local name = player:get_player_name()
    if name == meta:get_string("owner") or (name and minetest.check_player_privs(name, {server=true})) then
        return true
    end
    return false
end

PostPosted: Thu May 23, 2013 17:13
by addi
PilzAdam wrote:Well, correct code would be:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
local function has_locked_chest_privilege(meta, player)
    local name = player:get_player_name()
    if name == meta:get_string("owner") or (name and minetest.check_player_privs(name, {server=true})) then
        return true
    end
    return false
end

or this, yes
both are working. i hope it was a good idea