easier chest handling for server admins

User avatar
addi
Member
 
Posts: 605
Joined: Thu Sep 20, 2012 03:16

easier chest handling for server admins

by addi » Thu May 23, 2013 13:36

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 :)
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Thu May 23, 2013 14:00

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
 

User avatar
addi
Member
 
Posts: 605
Joined: Thu Sep 20, 2012 03:16

by addi » Thu May 23, 2013 17:13

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
 


Return to Minetest Features

Who is online

Users browsing this forum: No registered users and 6 guests

cron